mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
@@ -4,8 +4,7 @@ import 'package:PiliPlus/common/constants.dart';
|
||||
import 'package:PiliPlus/common/widgets/badge.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/nine_grid_view.dart';
|
||||
import 'package:PiliPlus/common/widgets/interactiveviewer_gallery/interactiveviewer_gallery.dart'
|
||||
show SourceModel, SourceType;
|
||||
import 'package:PiliPlus/models/common/image_preview_type.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'dart:io';
|
||||
import 'package:PiliPlus/common/widgets/interactiveviewer_gallery/interactive_viewer.dart'
|
||||
as custom;
|
||||
import 'package:PiliPlus/common/widgets/interactiveviewer_gallery/interactive_viewer_boundary.dart';
|
||||
import 'package:PiliPlus/models/common/image_preview_type.dart';
|
||||
import 'package:PiliPlus/utils/download.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
@@ -32,24 +33,6 @@ typedef IndexedFocusedWidgetBuilder = Widget Function(
|
||||
|
||||
typedef IndexedTagStringBuilder = String Function(int index);
|
||||
|
||||
enum SourceType { fileImage, networkImage, livePhoto }
|
||||
|
||||
class SourceModel {
|
||||
final SourceType sourceType;
|
||||
final String url;
|
||||
final String? liveUrl;
|
||||
final int? width;
|
||||
final int? height;
|
||||
|
||||
const SourceModel({
|
||||
this.sourceType = SourceType.networkImage,
|
||||
required this.url,
|
||||
this.liveUrl,
|
||||
this.width,
|
||||
this.height,
|
||||
});
|
||||
}
|
||||
|
||||
class InteractiveviewerGallery<T> extends StatefulWidget {
|
||||
const InteractiveviewerGallery({
|
||||
super.key,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/models/common/avatar_badge_type.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
@@ -7,7 +8,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class PendantAvatar extends StatelessWidget {
|
||||
final _BadgeType _badgeType;
|
||||
final BadgeType _badgeType;
|
||||
final String? avatar;
|
||||
final double size;
|
||||
final double badgeSize;
|
||||
@@ -27,13 +28,13 @@ class PendantAvatar extends StatelessWidget {
|
||||
this.onTap,
|
||||
}) : _badgeType = officialType == null || officialType < 0
|
||||
? isVip == true
|
||||
? _BadgeType.vip
|
||||
: _BadgeType.none
|
||||
? BadgeType.vip
|
||||
: BadgeType.none
|
||||
: officialType == 0
|
||||
? _BadgeType.person
|
||||
? BadgeType.person
|
||||
: officialType == 1
|
||||
? _BadgeType.institution
|
||||
: _BadgeType.none,
|
||||
? BadgeType.institution
|
||||
: BadgeType.none,
|
||||
badgeSize = badgeSize ?? size / 3;
|
||||
|
||||
static bool showDynDecorate = GStorage.showDynDecorate;
|
||||
@@ -98,7 +99,7 @@ class PendantAvatar extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
)
|
||||
else if (_badgeType != _BadgeType.none)
|
||||
else if (_badgeType != BadgeType.none)
|
||||
_buildBadge(colorScheme),
|
||||
],
|
||||
);
|
||||
@@ -132,7 +133,7 @@ class PendantAvatar extends StatelessWidget {
|
||||
|
||||
Widget _buildBadge(ColorScheme colorScheme) {
|
||||
final child = switch (_badgeType) {
|
||||
_BadgeType.vip => Image.asset(
|
||||
BadgeType.vip => Image.asset(
|
||||
'assets/images/big-vip.png',
|
||||
height: badgeSize,
|
||||
semanticLabel: _badgeType.desc,
|
||||
@@ -157,15 +158,3 @@ class PendantAvatar extends StatelessWidget {
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
enum _BadgeType { none, vip, person, institution }
|
||||
|
||||
extension _BadgeTypeExt on _BadgeType {
|
||||
String get desc => const ['', '大会员', '认证个人', '认证机构'][index];
|
||||
Color get color => const [
|
||||
Colors.transparent,
|
||||
Color(0xFFFF6699),
|
||||
Color(0xFFFFCC00),
|
||||
Colors.lightBlueAccent
|
||||
][index];
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:PiliPlus/http/user.dart';
|
||||
import 'package:PiliPlus/http/video.dart';
|
||||
import 'package:PiliPlus/models/common/account_type.dart';
|
||||
import 'package:PiliPlus/models/home/rcmd/result.dart';
|
||||
import 'package:PiliPlus/models/model_video.dart';
|
||||
import 'package:PiliPlus/models/space_archive/item.dart';
|
||||
|
||||
Reference in New Issue
Block a user