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
Widget build(BuildContext context) {
final theme = Theme.of(context);
return NotificationListener<DraggableScrollableNotification>(
onNotification: (notification) {
if (notification.extent <= 1e-5) {
Get.back();
}
return false;
},
child: Column(
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),
],
return Column(
children: [
AppBar(
backgroundColor: Colors.transparent,
leading: IconButton(
tooltip: '关闭',
onPressed: Get.back,
icon: const Icon(Icons.close_outlined),
),
Expanded(
child: FutureBuilder(
future: _futureBuilderFuture,
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
// TODO: refactor
if (snapshot.data is! Map) {
return HttpError(
isSliver: false,
onReload: () => setState(() {
_futureBuilderFuture = widget.ctr.queryVideoInFolder();
}),
);
}
Map data = snapshot.data as Map;
if (data['status']) {
return Obx(
() => Material(
color: Colors.transparent,
child: ListView.builder(
controller: widget.scrollController,
itemCount: widget.ctr.favFolderData.value.list.length,
itemBuilder: (context, index) {
return ListTile(
onTap: () => widget.ctr.onChoose(
widget.ctr.favFolderData.value.list[index]
.favState !=
1,
index),
dense: true,
leading: Utils.isPublicFav(widget
.ctr.favFolderData.value.list[index].attr)
? const Icon(Icons.folder_outlined)
: const Icon(Icons.lock_outline),
minLeadingWidth: 0,
title: Text(widget
.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(),
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(
child: FutureBuilder(
future: _futureBuilderFuture,
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
// TODO: refactor
if (snapshot.data is! Map) {
return HttpError(
isSliver: false,
onReload: () => setState(() {
_futureBuilderFuture = widget.ctr.queryVideoInFolder();
}),
);
}
},
),
),
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,
Map data = snapshot.data as Map;
if (data['status']) {
return Obx(
() => Material(
color: Colors.transparent,
child: ListView.builder(
controller: widget.scrollController,
itemCount: widget.ctr.favFolderData.value.list.length,
itemBuilder: (context, index) {
return ListTile(
onTap: () => widget.ctr.onChoose(
widget.ctr.favFolderData.value.list[index]
.favState !=
1,
index),
dense: true,
leading: Utils.isPublicFav(widget
.ctr.favFolderData.value.list[index].attr)
? const Icon(Icons.folder_outlined)
: const Icon(Icons.lock_outline),
minLeadingWidth: 0,
title: Text(widget
.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),
),
),
);
},
),
),
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('完成'),
),
],
),
);
} else {
return CustomScrollView(
controller: widget.scrollController,
slivers: [
HttpError(
errMsg: data['msg'],
onReload: () => setState(() {
_futureBuilderFuture =
widget.ctr.queryVideoInFolder();
}),
)
],
);
}
} else {
return const Center(
child: CircularProgressIndicator(),
);
}
},
),
],
),
),
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
Widget build(BuildContext context) {
final theme = Theme.of(context);
return NotificationListener<DraggableScrollableNotification>(
onNotification: (notification) {
if (notification.extent <= 1e-5) {
Get.back();
}
return false;
},
child: Column(
children: <Widget>[
AppBar(
backgroundColor: Colors.transparent,
leading: IconButton(
tooltip: '关闭',
onPressed: Get.back,
icon: const Icon(Icons.close_outlined)),
title: const Text('设置关注分组'),
),
Expanded(
child: FutureBuilder(
future: _futureBuilderFuture,
builder: (BuildContext context, AsyncSnapshot snapshot) {
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(),
return Column(
children: <Widget>[
AppBar(
backgroundColor: Colors.transparent,
leading: IconButton(
tooltip: '关闭',
onPressed: Get.back,
icon: const Icon(Icons.close_outlined)),
title: const Text('设置关注分组'),
),
Expanded(
child: FutureBuilder(
future: _futureBuilderFuture,
builder: (BuildContext context, AsyncSnapshot snapshot) {
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(),
);
}
},
),
Divider(
height: 1,
color: theme.disabledColor.withValues(alpha: 0.08),
),
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,
),
Padding(
padding: EdgeInsets.only(
left: 20,
right: 20,
top: 12,
bottom: MediaQuery.of(context).padding.bottom + 12,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
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: Row(
mainAxisAlignment: MainAxisAlignment.end,
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 ? '保存至默认分组' : '保存'),
),
],
),
],
),
),
],
);
}
}

View File

@@ -157,57 +157,49 @@ class _LiveAreaDetailPageState extends State<LiveAreaDetailPage> {
expand: false,
snapSizes: const [1],
builder: (_, scrollController) {
return NotificationListener<DraggableScrollableNotification>(
onNotification: (notification) {
if (notification.extent <= 1e-5) {
Get.back();
}
return false;
},
child: Column(
children: [
AppBar(
centerTitle: true,
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;
},
);
},
return Column(
children: [
AppBar(
centerTitle: true,
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;
},
);
},
),
],
),
),
],
);
},
);

View File

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