opt scrollPhysics

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-02-23 11:59:06 +08:00
parent d15ad4911d
commit ee04978e0c
2 changed files with 184 additions and 202 deletions

View File

@@ -200,55 +200,15 @@ class _AudioPageState extends State<AudioPage> {
builder: (context) { builder: (context) {
final theme = Theme.of(context); final theme = Theme.of(context);
final colorScheme = theme.colorScheme; final colorScheme = theme.colorScheme;
return FractionallySizedBox( Widget child = CustomScrollView(
heightFactor:
PlatformUtils.isMobile && !context.mediaQuerySize.isPortrait
? 1.0
: 0.7,
alignment: Alignment.bottomCenter,
child: Column(
children: [
InkWell(
onTap: Get.back,
borderRadius: StyleString.bottomSheetRadius,
child: SizedBox(
height: 35,
child: Center(
child: Container(
width: 32,
height: 3,
decoration: BoxDecoration(
color: colorScheme.outline,
borderRadius: const BorderRadius.all(
Radius.circular(3),
),
),
),
),
),
),
Expanded(
child: Material(
type: MaterialType.transparency,
child: Theme(
data: theme.copyWith(
dividerColor: Colors.transparent,
),
child: refreshIndicator(
onRefresh: () => _controller.loadPrev(context),
isClampingScrollPhysics: true,
child: CustomScrollView(
controller: scrollController, controller: scrollController,
physics: _controller.reachStart physics: _controller.reachStart
? const ClampingScrollPhysics() ? null
: const AlwaysScrollableScrollPhysics( : const AlwaysScrollableScrollPhysics(),
parent: ClampingScrollPhysics(),
),
slivers: [ slivers: [
SliverPadding( SliverPadding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
bottom: bottom: MediaQuery.paddingOf(context).bottom + 100,
MediaQuery.paddingOf(context).bottom + 100,
), ),
sliver: SliverList.builder( sliver: SliverList.builder(
itemCount: playlist.length, itemCount: playlist.length,
@@ -264,14 +224,9 @@ class _AudioPageState extends State<AudioPage> {
dense: true, dense: true,
minTileHeight: 45, minTileHeight: 45,
initiallyExpanded: isCurr, initiallyExpanded: isCurr,
collapsedIconColor: isCurr collapsedIconColor: isCurr ? colorScheme.primary : null,
? colorScheme.primary iconColor: isCurr ? null : colorScheme.onSurfaceVariant,
: null, controlAffinity: ListTileControlAffinity.leading,
iconColor: isCurr
? null
: colorScheme.onSurfaceVariant,
controlAffinity:
ListTileControlAffinity.leading,
title: Text( title: Text(
item.arc.title, item.arc.title,
maxLines: 1, maxLines: 1,
@@ -289,13 +244,11 @@ class _AudioPageState extends State<AudioPage> {
: iconButton( : iconButton(
icon: const Icon(Icons.clear), icon: const Icon(Icons.clear),
onPressed: () { onPressed: () {
if (index < if (index < _controller.index!) {
_controller.index!) {
_controller.index -= 1; _controller.index -= 1;
} }
playlist.removeAt(index); playlist.removeAt(index);
(context as Element) (context as Element).markNeedsBuild();
.markNeedsBuild();
}, },
iconColor: colorScheme.outline, iconColor: colorScheme.outline,
size: 28, size: 28,
@@ -306,8 +259,7 @@ class _AudioPageState extends State<AudioPage> {
return ListTile( return ListTile(
dense: true, dense: true,
minTileHeight: 45, minTileHeight: 45,
contentPadding: contentPadding: const EdgeInsetsDirectional.only(
const EdgeInsetsDirectional.only(
start: 56.0, start: 56.0,
end: 24.0, end: 24.0,
), ),
@@ -331,8 +283,7 @@ class _AudioPageState extends State<AudioPage> {
) )
: TextStyle( : TextStyle(
fontSize: 14, fontSize: 14,
color: colorScheme color: colorScheme.onSurfaceVariant,
.onSurfaceVariant,
), ),
TextSpan( TextSpan(
children: [ children: [
@@ -346,8 +297,7 @@ class _AudioPageState extends State<AudioPage> {
cacheWidth: 16.cacheSize( cacheWidth: 16.cacheSize(
context, context,
), ),
color: color: colorScheme.primary,
colorScheme.primary,
), ),
), ),
const TextSpan(text: ' '), const TextSpan(text: ' '),
@@ -411,8 +361,7 @@ class _AudioPageState extends State<AudioPage> {
_controller.index -= 1; _controller.index -= 1;
} }
playlist.removeAt(index); playlist.removeAt(index);
(context as Element) (context as Element).markNeedsBuild();
.markNeedsBuild();
}, },
iconColor: colorScheme.outline, iconColor: colorScheme.outline,
size: 28, size: 28,
@@ -423,11 +372,48 @@ class _AudioPageState extends State<AudioPage> {
), ),
), ),
], ],
);
if (!_controller.reachStart) {
child = refreshIndicator(
onRefresh: () => _controller.loadPrev(context),
isClampingScrollPhysics: true,
child: child,
);
}
return FractionallySizedBox(
heightFactor:
PlatformUtils.isMobile && !context.mediaQuerySize.isPortrait
? 1.0
: 0.7,
alignment: Alignment.bottomCenter,
child: Column(
children: [
InkWell(
onTap: Get.back,
borderRadius: StyleString.bottomSheetRadius,
child: SizedBox(
height: 35,
child: Center(
child: Container(
width: 32,
height: 3,
decoration: BoxDecoration(
color: colorScheme.outline,
borderRadius: const .all(.circular(3)),
), ),
), ),
), ),
), ),
), ),
Expanded(
child: Material(
type: MaterialType.transparency,
child: Theme(
data: theme.copyWith(dividerColor: Colors.transparent),
child: child,
),
),
),
Divider( Divider(
height: 1, height: 1,
color: colorScheme.outline.withValues(alpha: 0.1), color: colorScheme.outline.withValues(alpha: 0.1),

View File

@@ -185,11 +185,7 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel>
child: CustomScrollView( child: CustomScrollView(
key: ValueKey(scrollController.hashCode), key: ValueKey(scrollController.hashCode),
controller: scrollController, controller: scrollController,
physics: widget.isNested physics: const AlwaysScrollableScrollPhysics(),
? const AlwaysScrollableScrollPhysics(
parent: ClampingScrollPhysics(),
)
: const AlwaysScrollableScrollPhysics(),
slivers: [ slivers: [
if (!isDialogue) ...[ if (!isDialogue) ...[
if ((widget.firstFloor ?? _controller.firstFloor.value) if ((widget.firstFloor ?? _controller.firstFloor.value)