enable new slider/progress

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-05-23 11:54:57 +08:00
parent 7fa6d81dc8
commit b1666095a6
4 changed files with 301 additions and 322 deletions

View File

@@ -31,173 +31,165 @@ class _FavPanelState extends State<FavPanel> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context); final theme = Theme.of(context);
return NotificationListener<DraggableScrollableNotification>( return Column(
onNotification: (notification) { children: [
if (notification.extent <= 1e-5) { AppBar(
Get.back(); backgroundColor: Colors.transparent,
} leading: IconButton(
return false; tooltip: '关闭',
}, onPressed: Get.back,
child: Column( icon: const Icon(Icons.close_outlined),
children: [
AppBar(
backgroundColor: Colors.transparent,
leading: IconButton(
tooltip: '关闭',
onPressed: Get.back,
icon: const Icon(Icons.close_outlined),
),
title: const Text('添加到收藏夹'),
actions: [
TextButton.icon(
onPressed: () => Get.toNamed('/createFav')?.then((data) {
if (data != null) {
(widget.ctr?.favFolderData.value as FavFolderData?)
?.list
?.insert(1, data);
widget.ctr?.favFolderData.refresh();
}
}),
icon: Icon(
Icons.add,
color: theme.colorScheme.primary,
),
label: const Text('新建收藏夹'),
style: TextButton.styleFrom(
padding:
const EdgeInsets.symmetric(horizontal: 18, vertical: 14),
visualDensity: VisualDensity.compact,
),
),
const SizedBox(width: 16),
],
), ),
Expanded( title: const Text('添加到收藏夹'),
child: FutureBuilder( actions: [
future: _futureBuilderFuture, TextButton.icon(
builder: (BuildContext context, AsyncSnapshot snapshot) { onPressed: () => Get.toNamed('/createFav')?.then((data) {
if (snapshot.connectionState == ConnectionState.done) { if (data != null) {
// TODO: refactor (widget.ctr?.favFolderData.value as FavFolderData?)
if (snapshot.data is! Map) { ?.list
return HttpError( ?.insert(1, data);
isSliver: false, widget.ctr?.favFolderData.refresh();
onReload: () => setState(() { }
_futureBuilderFuture = widget.ctr.queryVideoInFolder(); }),
}), icon: Icon(
); Icons.add,
} color: theme.colorScheme.primary,
Map data = snapshot.data as Map; ),
if (data['status']) { label: const Text('新建收藏夹'),
return Obx( style: TextButton.styleFrom(
() => Material( padding:
color: Colors.transparent, const EdgeInsets.symmetric(horizontal: 18, vertical: 14),
child: ListView.builder( visualDensity: VisualDensity.compact,
controller: widget.scrollController, ),
itemCount: widget.ctr.favFolderData.value.list.length, ),
itemBuilder: (context, index) { const SizedBox(width: 16),
return ListTile( ],
onTap: () => widget.ctr.onChoose( ),
widget.ctr.favFolderData.value.list[index] Expanded(
.favState != child: FutureBuilder(
1, future: _futureBuilderFuture,
index), builder: (BuildContext context, AsyncSnapshot snapshot) {
dense: true, if (snapshot.connectionState == ConnectionState.done) {
leading: Utils.isPublicFav(widget // TODO: refactor
.ctr.favFolderData.value.list[index].attr) if (snapshot.data is! Map) {
? const Icon(Icons.folder_outlined) return HttpError(
: const Icon(Icons.lock_outline), isSliver: false,
minLeadingWidth: 0, onReload: () => setState(() {
title: Text(widget _futureBuilderFuture = widget.ctr.queryVideoInFolder();
.ctr.favFolderData.value.list[index].title!), }),
subtitle: Text(
'${widget.ctr.favFolderData.value.list[index].mediaCount}个内容 . ${Utils.isPublicFavText(widget.ctr.favFolderData.value.list[index].attr)}',
),
trailing: Transform.scale(
scale: 0.9,
child: Checkbox(
value: widget.ctr.favFolderData.value
.list[index].favState ==
1,
onChanged: (bool? checkValue) =>
widget.ctr.onChoose(checkValue!, index),
),
),
);
},
),
),
);
} else {
return CustomScrollView(
controller: widget.scrollController,
slivers: [
HttpError(
errMsg: data['msg'],
onReload: () => setState(() {
_futureBuilderFuture =
widget.ctr.queryVideoInFolder();
}),
)
],
);
}
} else {
return const Center(
child: CircularProgressIndicator(),
); );
} }
}, Map data = snapshot.data as Map;
), if (data['status']) {
), return Obx(
Divider( () => Material(
height: 1, color: Colors.transparent,
color: theme.disabledColor.withValues(alpha: 0.08), child: ListView.builder(
), controller: widget.scrollController,
Padding( itemCount: widget.ctr.favFolderData.value.list.length,
padding: EdgeInsets.only( itemBuilder: (context, index) {
left: 20, return ListTile(
right: 20, onTap: () => widget.ctr.onChoose(
top: 12, widget.ctr.favFolderData.value.list[index]
bottom: MediaQuery.of(context).padding.bottom + 12, .favState !=
), 1,
child: Row( index),
mainAxisAlignment: MainAxisAlignment.end, dense: true,
children: <Widget>[ leading: Utils.isPublicFav(widget
TextButton( .ctr.favFolderData.value.list[index].attr)
onPressed: () => Get.back(), ? const Icon(Icons.folder_outlined)
style: TextButton.styleFrom( : const Icon(Icons.lock_outline),
padding: const EdgeInsets.symmetric( minLeadingWidth: 0,
horizontal: 20, vertical: 10), title: Text(widget
visualDensity: const VisualDensity( .ctr.favFolderData.value.list[index].title!),
horizontal: -1, subtitle: Text(
vertical: -2, '${widget.ctr.favFolderData.value.list[index].mediaCount}个内容 . ${Utils.isPublicFavText(widget.ctr.favFolderData.value.list[index].attr)}',
),
trailing: Transform.scale(
scale: 0.9,
child: Checkbox(
value: widget.ctr.favFolderData.value
.list[index].favState ==
1,
onChanged: (bool? checkValue) =>
widget.ctr.onChoose(checkValue!, index),
),
),
);
},
),
), ),
foregroundColor: theme.colorScheme.outline, );
backgroundColor: theme.colorScheme.onInverseSurface, } else {
), return CustomScrollView(
child: const Text('取消'), controller: widget.scrollController,
), slivers: [
const SizedBox(width: 25), HttpError(
FilledButton.tonal( errMsg: data['msg'],
onPressed: () { onReload: () => setState(() {
feedBack(); _futureBuilderFuture =
widget.ctr.actionFavVideo(); widget.ctr.queryVideoInFolder();
}, }),
style: FilledButton.styleFrom( )
padding: const EdgeInsets.symmetric( ],
horizontal: 20, vertical: 10), );
visualDensity: const VisualDensity( }
horizontal: -1, } else {
vertical: -2, return const Center(
), child: CircularProgressIndicator(),
), );
child: const Text('完成'), }
), },
],
),
), ),
], ),
), Divider(
height: 1,
color: theme.disabledColor.withValues(alpha: 0.08),
),
Padding(
padding: EdgeInsets.only(
left: 20,
right: 20,
top: 12,
bottom: MediaQuery.of(context).padding.bottom + 12,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
TextButton(
onPressed: () => Get.back(),
style: TextButton.styleFrom(
padding:
const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
visualDensity: const VisualDensity(
horizontal: -1,
vertical: -2,
),
foregroundColor: theme.colorScheme.outline,
backgroundColor: theme.colorScheme.onInverseSurface,
),
child: const Text('取消'),
),
const SizedBox(width: 25),
FilledButton.tonal(
onPressed: () {
feedBack();
widget.ctr.actionFavVideo();
},
style: FilledButton.styleFrom(
padding:
const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
visualDensity: const VisualDensity(
horizontal: -1,
vertical: -2,
),
),
child: const Text('完成'),
),
],
),
),
],
); );
} }
} }

View File

@@ -69,123 +69,114 @@ class _GroupPanelState extends State<GroupPanel> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context); final theme = Theme.of(context);
return NotificationListener<DraggableScrollableNotification>( return Column(
onNotification: (notification) { children: <Widget>[
if (notification.extent <= 1e-5) { AppBar(
Get.back(); backgroundColor: Colors.transparent,
} leading: IconButton(
return false; tooltip: '关闭',
}, onPressed: Get.back,
child: Column( icon: const Icon(Icons.close_outlined)),
children: <Widget>[ title: const Text('设置关注分组'),
AppBar( ),
backgroundColor: Colors.transparent, Expanded(
leading: IconButton( child: FutureBuilder(
tooltip: '关闭', future: _futureBuilderFuture,
onPressed: Get.back, builder: (BuildContext context, AsyncSnapshot snapshot) {
icon: const Icon(Icons.close_outlined)), if (snapshot.connectionState == ConnectionState.done) {
title: const Text('设置关注分组'), // TODO: refactor
), if (snapshot.data is! Map) {
Expanded( return HttpError(
child: FutureBuilder( isSliver: false,
future: _futureBuilderFuture, onReload: () => setState(() {
builder: (BuildContext context, AsyncSnapshot snapshot) { _futureBuilderFuture = MemberHttp.followUpTags();
if (snapshot.connectionState == ConnectionState.done) { }),
// TODO: refactor
if (snapshot.data is! Map) {
return HttpError(
isSliver: false,
onReload: () => setState(() {
_futureBuilderFuture = MemberHttp.followUpTags();
}),
);
}
Map data = snapshot.data as Map;
if (data['status']) {
return Material(
color: Colors.transparent,
child: ListView.builder(
controller: widget.scrollController,
itemCount: tagsList.length,
itemBuilder: (context, index) {
return ListTile(
onTap: () {
tagsList[index].checked =
!tagsList[index].checked!;
showDefaultBtn =
!tagsList.any((e) => e.checked == true);
setState(() {});
},
dense: true,
leading: const Icon(Icons.group_outlined),
minLeadingWidth: 0,
title: Text(tagsList[index].name ?? ''),
subtitle: tagsList[index].tip != ''
? Text(tagsList[index].tip ?? '')
: null,
trailing: Transform.scale(
scale: 0.9,
child: Checkbox(
value: tagsList[index].checked,
onChanged: (bool? checkValue) {
tagsList[index].checked = checkValue;
showDefaultBtn =
!tagsList.any((e) => e.checked == true);
setState(() {});
},
),
),
);
},
),
);
} else {
return CustomScrollView(
controller: widget.scrollController,
slivers: [
HttpError(
errMsg: data['msg'],
onReload: () => setState(() {}),
),
],
);
}
} else {
return const Center(
child: CircularProgressIndicator(),
); );
} }
}, Map data = snapshot.data as Map;
), if (data['status']) {
return Material(
color: Colors.transparent,
child: ListView.builder(
controller: widget.scrollController,
itemCount: tagsList.length,
itemBuilder: (context, index) {
return ListTile(
onTap: () {
tagsList[index].checked = !tagsList[index].checked!;
showDefaultBtn =
!tagsList.any((e) => e.checked == true);
setState(() {});
},
dense: true,
leading: const Icon(Icons.group_outlined),
minLeadingWidth: 0,
title: Text(tagsList[index].name ?? ''),
subtitle: tagsList[index].tip != ''
? Text(tagsList[index].tip ?? '')
: null,
trailing: Transform.scale(
scale: 0.9,
child: Checkbox(
value: tagsList[index].checked,
onChanged: (bool? checkValue) {
tagsList[index].checked = checkValue;
showDefaultBtn =
!tagsList.any((e) => e.checked == true);
setState(() {});
},
),
),
);
},
),
);
} else {
return CustomScrollView(
controller: widget.scrollController,
slivers: [
HttpError(
errMsg: data['msg'],
onReload: () => setState(() {}),
),
],
);
}
} else {
return const Center(
child: CircularProgressIndicator(),
);
}
},
), ),
Divider( ),
height: 1, Divider(
color: theme.disabledColor.withValues(alpha: 0.08), height: 1,
color: theme.disabledColor.withValues(alpha: 0.08),
),
Padding(
padding: EdgeInsets.only(
left: 20,
right: 20,
top: 12,
bottom: MediaQuery.of(context).padding.bottom + 12,
), ),
Padding( child: Row(
padding: EdgeInsets.only( mainAxisAlignment: MainAxisAlignment.end,
left: 20, children: [
right: 20, TextButton(
top: 12, onPressed: () => onSave(),
bottom: MediaQuery.of(context).padding.bottom + 12, style: TextButton.styleFrom(
), padding: const EdgeInsets.only(left: 30, right: 30),
child: Row( foregroundColor: theme.colorScheme.onPrimary,
mainAxisAlignment: MainAxisAlignment.end, backgroundColor: theme.colorScheme.primary,
children: [
TextButton(
onPressed: () => onSave(),
style: TextButton.styleFrom(
padding: const EdgeInsets.only(left: 30, right: 30),
foregroundColor: theme.colorScheme.onPrimary,
backgroundColor: theme.colorScheme.primary,
),
child: Text(showDefaultBtn ? '保存至默认分组' : '保存'),
), ),
], child: Text(showDefaultBtn ? '保存至默认分组' : '保存'),
), ),
],
), ),
], ),
), ],
); );
} }
} }

View File

@@ -157,57 +157,49 @@ class _LiveAreaDetailPageState extends State<LiveAreaDetailPage> {
expand: false, expand: false,
snapSizes: const [1], snapSizes: const [1],
builder: (_, scrollController) { builder: (_, scrollController) {
return NotificationListener<DraggableScrollableNotification>( return Column(
onNotification: (notification) { children: [
if (notification.extent <= 1e-5) { AppBar(
Get.back(); centerTitle: true,
} backgroundColor: Colors.transparent,
return false; automaticallyImplyLeading: false,
}, title: Text(widget.parentName),
child: Column( actions: [
children: [ IconButton(
AppBar( onPressed: Get.back,
centerTitle: true, icon: const Icon(Icons.clear),
backgroundColor: Colors.transparent,
automaticallyImplyLeading: false,
title: Text(widget.parentName),
actions: [
IconButton(
onPressed: Get.back,
icon: const Icon(Icons.clear),
),
const SizedBox(width: 12),
],
),
Expanded(
child: GridView.builder(
controller: scrollController,
padding: EdgeInsets.only(
top: 12,
bottom: MediaQuery.paddingOf(context).bottom + 80,
),
itemCount: list.length,
gridDelegate:
const SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 100,
mainAxisSpacing: 10,
crossAxisSpacing: 10,
mainAxisExtent: 80,
),
itemBuilder: (_, index) {
return _tagItem(
theme: theme,
item: list[index],
onTap: () {
Get.back();
DefaultTabController.of(context).index = index;
},
);
},
), ),
const SizedBox(width: 12),
],
),
Expanded(
child: GridView.builder(
controller: scrollController,
padding: EdgeInsets.only(
top: 12,
bottom: MediaQuery.paddingOf(context).bottom + 80,
),
itemCount: list.length,
gridDelegate:
const SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 100,
mainAxisSpacing: 10,
crossAxisSpacing: 10,
mainAxisExtent: 80,
),
itemBuilder: (_, index) {
return _tagItem(
theme: theme,
item: list[index],
onTap: () {
Get.back();
DefaultTabController.of(context).index = index;
},
);
},
), ),
], ),
), ],
); );
}, },
); );

View File

@@ -82,6 +82,8 @@ class ThemeUtils {
shadowColor: Colors.transparent, shadowColor: Colors.transparent,
), ),
progressIndicatorTheme: ProgressIndicatorThemeData( progressIndicatorTheme: ProgressIndicatorThemeData(
// ignore: deprecated_member_use
year2023: false,
refreshBackgroundColor: colorScheme.onSecondary, refreshBackgroundColor: colorScheme.onSecondary,
), ),
dialogTheme: DialogThemeData( dialogTheme: DialogThemeData(
@@ -101,6 +103,8 @@ class ThemeUtils {
), ),
), ),
), ),
// ignore: deprecated_member_use
sliderTheme: const SliderThemeData(year2023: false),
); );
if (isDark && GStorage.isPureBlackTheme) { if (isDark && GStorage.isPureBlackTheme) {
themeData = darkenTheme(themeData); themeData = darkenTheme(themeData);