mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-22 10:06:23 +08:00
@@ -6,14 +6,14 @@ class CustomSliverPersistentHeaderDelegate
|
||||
required this.child,
|
||||
required this.bgColor,
|
||||
double extent = 45,
|
||||
this.needRebuild,
|
||||
this.needRebuild = false,
|
||||
}) : _minExtent = extent,
|
||||
_maxExtent = extent;
|
||||
final double _minExtent;
|
||||
final double _maxExtent;
|
||||
final Widget child;
|
||||
final Color? bgColor;
|
||||
final bool? needRebuild;
|
||||
final bool needRebuild;
|
||||
|
||||
@override
|
||||
Widget build(
|
||||
@@ -26,15 +26,7 @@ class CustomSliverPersistentHeaderDelegate
|
||||
//overlapsContent:SliverPersistentHeader覆盖其他子组件返回true,否则返回false
|
||||
return bgColor != null
|
||||
? DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: bgColor,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: bgColor!,
|
||||
offset: const Offset(0, -2),
|
||||
),
|
||||
],
|
||||
),
|
||||
decoration: BoxDecoration(color: bgColor),
|
||||
child: child,
|
||||
)
|
||||
: child;
|
||||
@@ -51,6 +43,6 @@ class CustomSliverPersistentHeaderDelegate
|
||||
@override
|
||||
bool shouldRebuild(CustomSliverPersistentHeaderDelegate oldDelegate) {
|
||||
return oldDelegate.bgColor != bgColor ||
|
||||
(needRebuild == true && oldDelegate.child != child);
|
||||
(needRebuild && oldDelegate.child != child);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
void showConfirmDialog({
|
||||
Future<void> showConfirmDialog({
|
||||
required BuildContext context,
|
||||
required String title,
|
||||
dynamic content,
|
||||
required VoidCallback onConfirm,
|
||||
}) {
|
||||
showDialog(
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
|
||||
@@ -113,18 +113,14 @@ class _DynamicSliverAppBarMediumState extends State<DynamicSliverAppBarMedium> {
|
||||
});
|
||||
}
|
||||
|
||||
Orientation? _orientation;
|
||||
late Size size;
|
||||
double? _width;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
size = MediaQuery.sizeOf(context);
|
||||
final orientation = size.width > size.height
|
||||
? Orientation.landscape
|
||||
: Orientation.portrait;
|
||||
if (orientation != _orientation) {
|
||||
_orientation = orientation;
|
||||
final width = MediaQuery.widthOf(context);
|
||||
if (_width != width) {
|
||||
_width = width;
|
||||
_height = 0;
|
||||
_updateHeight();
|
||||
}
|
||||
@@ -139,7 +135,7 @@ class _DynamicSliverAppBarMediumState extends State<DynamicSliverAppBarMedium> {
|
||||
alignment: Alignment.topLeft,
|
||||
child: SizedBox(
|
||||
key: _childKey,
|
||||
width: size.width,
|
||||
width: _width,
|
||||
child: widget.flexibleSpace,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -11,7 +11,6 @@ import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:easy_debounce/easy_throttle.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:media_kit/media_kit.dart';
|
||||
import 'package:media_kit_video/media_kit_video.dart';
|
||||
@@ -48,7 +47,6 @@ class InteractiveviewerGallery extends StatefulWidget {
|
||||
this.minScale = 1.0,
|
||||
this.onPageChanged,
|
||||
this.onDismissed,
|
||||
this.setStatusBar = true,
|
||||
this.onClose,
|
||||
required this.quality,
|
||||
});
|
||||
@@ -57,8 +55,6 @@ class InteractiveviewerGallery extends StatefulWidget {
|
||||
|
||||
final ValueChanged<bool>? onClose;
|
||||
|
||||
final bool setStatusBar;
|
||||
|
||||
/// The sources to show.
|
||||
final List<SourceModel> sources;
|
||||
|
||||
@@ -114,10 +110,6 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
|
||||
duration: const Duration(milliseconds: 300),
|
||||
)..addListener(listener);
|
||||
|
||||
if (widget.setStatusBar) {
|
||||
setStatusBar();
|
||||
}
|
||||
|
||||
var item = widget.sources[currentIndex.value];
|
||||
if (item.sourceType == SourceType.livePhoto) {
|
||||
_onPlay(item.liveUrl!);
|
||||
@@ -128,18 +120,6 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
|
||||
_transformationController!.value = _animation?.value ?? Matrix4.identity();
|
||||
}
|
||||
|
||||
SystemUiMode? mode;
|
||||
Future<void> setStatusBar() async {
|
||||
if (Platform.isIOS || Platform.isAndroid) {
|
||||
SystemChrome.setEnabledSystemUIMode(
|
||||
SystemUiMode.immersiveSticky,
|
||||
);
|
||||
}
|
||||
if (Platform.isAndroid && (await Utils.sdkInt < 29)) {
|
||||
mode = SystemUiMode.manual;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
widget.onClose?.call(true);
|
||||
@@ -148,14 +128,6 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
|
||||
_animationController
|
||||
..removeListener(listener)
|
||||
..dispose();
|
||||
if (widget.setStatusBar) {
|
||||
if (Platform.isIOS || Platform.isAndroid) {
|
||||
SystemChrome.setEnabledSystemUIMode(
|
||||
mode ?? SystemUiMode.edgeToEdge,
|
||||
overlays: SystemUiOverlay.values,
|
||||
);
|
||||
}
|
||||
}
|
||||
for (var item in widget.sources) {
|
||||
if (item.sourceType == SourceType.networkImage) {
|
||||
CachedNetworkImageProvider(_getActualUrl(item.url)).evict();
|
||||
|
||||
1857
lib/common/widgets/list_tile.dart
Normal file
1857
lib/common/widgets/list_tile.dart
Normal file
File diff suppressed because it is too large
Load Diff
@@ -19,10 +19,7 @@ class HttpError extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return isSliver
|
||||
? SliverToBoxAdapter(child: content(context))
|
||||
: SizedBox(
|
||||
width: double.infinity,
|
||||
child: content(context),
|
||||
);
|
||||
: content(context);
|
||||
}
|
||||
|
||||
Widget content(BuildContext context) {
|
||||
|
||||
@@ -22,13 +22,13 @@ class PendantAvatar extends StatelessWidget {
|
||||
required this.avatar,
|
||||
this.size = 80,
|
||||
double? badgeSize,
|
||||
bool? isVip,
|
||||
bool isVip = false,
|
||||
int? officialType,
|
||||
this.garbPendantImage,
|
||||
this.roomId,
|
||||
this.onTap,
|
||||
}) : _badgeType = officialType == null || officialType < 0
|
||||
? isVip == true
|
||||
? isVip
|
||||
? BadgeType.vip
|
||||
: BadgeType.none
|
||||
: officialType == 0
|
||||
|
||||
@@ -18,6 +18,26 @@ class Segment {
|
||||
this.from,
|
||||
this.to,
|
||||
]);
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) {
|
||||
return true;
|
||||
}
|
||||
if (other is Segment) {
|
||||
return start == other.start &&
|
||||
end == other.end &&
|
||||
color == other.color &&
|
||||
title == other.title &&
|
||||
url == other.url &&
|
||||
from == other.from &&
|
||||
to == other.to;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(start, end, color, title, url, from, to);
|
||||
}
|
||||
|
||||
class SegmentProgressBar extends CustomPainter {
|
||||
@@ -126,7 +146,7 @@ class SegmentProgressBar extends CustomPainter {
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldRepaint(covariant CustomPainter oldDelegate) {
|
||||
return false;
|
||||
bool shouldRepaint(SegmentProgressBar oldDelegate) {
|
||||
return segmentColors != oldDelegate.segmentColors;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user