opt: pages

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-02-21 18:40:39 +08:00
parent 4c56fcd6a8
commit f94cb2a4b5
21 changed files with 728 additions and 748 deletions

View File

@@ -28,7 +28,6 @@ import 'package:share_plus/share_plus.dart';
import '../../../../http/search.dart';
import '../../../../models/model_hot_video_item.dart';
import '../related/index.dart';
import 'widgets/group_panel.dart';
class VideoIntroController extends GetxController
with GetTickerProviderStateMixin {
@@ -852,17 +851,6 @@ class VideoIntroController extends GetxController
return true;
}
// 设置关注分组
void setFollowGroup() {
if (videoDetail.value.owner == null) {
return;
}
Get.bottomSheet(
GroupPanel(mid: videoDetail.value.owner!.mid!),
isScrollControlled: true,
);
}
// ai总结
Future aiConclusion() async {
SmartDialog.showLoading(msg: '正在获取AI总结');

View File

@@ -38,184 +38,172 @@ class _FavPanelState extends State<FavPanel> {
}
return false;
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(18),
color: Theme.of(context).colorScheme.surface,
),
child: Column(
children: [
AppBar(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(18),
),
),
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.of(context).colorScheme.primary,
),
label: const Text('新建收藏夹'),
style: TextButton.styleFrom(
padding: const EdgeInsets.symmetric(
horizontal: 18, vertical: 14),
visualDensity: const VisualDensity(
horizontal: -2,
vertical: -2,
),
),
),
const SizedBox(width: 16),
],
child: Column(
children: [
AppBar(
backgroundColor: Colors.transparent,
leading: IconButton(
tooltip: '关闭',
onPressed: Get.back,
icon: const Icon(Icons.close_outlined),
),
Expanded(
child: Material(
color: Theme.of(context).colorScheme.surface,
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,
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.of(context).colorScheme.primary,
),
label: const Text('新建收藏夹'),
style: TextButton.styleFrom(
padding:
const EdgeInsets.symmetric(horizontal: 18, vertical: 14),
visualDensity: const VisualDensity(
horizontal: -2,
vertical: -2,
),
),
),
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,
callback: () => 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.isPublic(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.isPublicText(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'],
callback: () => setState(() {
_futureBuilderFuture =
widget.ctr.queryVideoInFolder();
}),
);
}
Map data = snapshot.data as Map;
if (data['status']) {
return Obx(
() => 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.isPublic(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.isPublicText(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'],
callback: () => setState(() {
_futureBuilderFuture =
widget.ctr.queryVideoInFolder();
}),
)
],
);
}
} else {
// 骨架屏
return const Center(
child: CircularProgressIndicator(),
);
}
},
)
],
);
}
} else {
// 骨架屏
return const Center(
child: CircularProgressIndicator(),
);
}
},
),
),
Divider(
height: 1,
color: Theme.of(context).disabledColor.withOpacity(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.of(context).colorScheme.outline,
backgroundColor:
Theme.of(context).colorScheme.onInverseSurface,
),
child: const Text('取消'),
),
),
),
Divider(
height: 1,
color: Theme.of(context).disabledColor.withOpacity(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.of(context).colorScheme.outline,
backgroundColor:
Theme.of(context).colorScheme.onInverseSurface,
const SizedBox(width: 25),
FilledButton.tonal(
onPressed: () async {
feedBack();
await widget.ctr.actionFavVideo();
},
style: FilledButton.styleFrom(
padding: const EdgeInsets.symmetric(
horizontal: 20, vertical: 10),
visualDensity: const VisualDensity(
horizontal: -1,
vertical: -2,
),
child: const Text('取消'),
),
const SizedBox(width: 25),
FilledButton.tonal(
onPressed: () async {
feedBack();
await widget.ctr.actionFavVideo();
},
style: FilledButton.styleFrom(
padding: const EdgeInsets.symmetric(
horizontal: 20, vertical: 10),
visualDensity: const VisualDensity(
horizontal: -1,
vertical: -2,
),
),
child: const Text('完成'),
),
],
),
child: const Text('完成'),
),
],
),
],
),
),
],
),
);
}

View File

@@ -77,126 +77,116 @@ class _GroupPanelState extends State<GroupPanel> {
}
return false;
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(18),
color: Theme.of(context).colorScheme.surface,
),
child: Column(
children: <Widget>[
AppBar(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(18),
),
),
leading: IconButton(
tooltip: '关闭',
onPressed: Get.back,
icon: const Icon(Icons.close_outlined)),
title: const Text('设置关注分组'),
),
Expanded(
child: Material(
color: Theme.of(context).colorScheme.surface,
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,
callback: () => setState(() {
_futureBuilderFuture = MemberHttp.followUpTags();
}),
);
}
Map data = snapshot.data as Map;
if (data['status']) {
return 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(() {});
},
),
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,
callback: () => 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'],
callback: () => setState(() {}),
),
],
);
}
} else {
// 骨架屏
return const Center(
child: CircularProgressIndicator(),
);
}
},
),
),
);
},
),
);
} else {
return CustomScrollView(
controller: widget.scrollController,
slivers: [
HttpError(
errMsg: data['msg'],
callback: () => setState(() {}),
),
],
);
}
} else {
// 骨架屏
return const Center(
child: CircularProgressIndicator(),
);
}
},
),
Divider(
height: 1,
color: Theme.of(context).disabledColor.withOpacity(0.08),
),
Divider(
height: 1,
color: Theme.of(context).disabledColor.withOpacity(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.of(context).colorScheme.onPrimary,
backgroundColor: Theme.of(context).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.of(context).colorScheme.onPrimary,
backgroundColor: Theme.of(context).colorScheme.primary,
),
],
),
child: Text(showDefaultBtn ? '保存至默认分组' : '保存'),
),
],
),
],
),
),
],
),
);
}

View File

@@ -19,10 +19,8 @@ class IntroDetail extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
color: Theme.of(context).colorScheme.surface,
return Padding(
padding: const EdgeInsets.only(left: 14, right: 14),
// height: Utils.getSheetHeight(context),
child: Column(
children: [
InkWell(