From 43866cbbfc15e6a7a12586872c967c9a02456ed3 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Sat, 12 Aug 2023 17:58:46 +0800 Subject: [PATCH] =?UTF-8?q?mod:=20=E6=94=B6=E8=97=8F=E5=A4=B9=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/video/detail/introduction/view.dart | 5 +- .../introduction/widgets/fav_panel.dart | 125 ++++++++++-------- .../introduction/widgets/intro_detail.dart | 5 +- lib/pages/video/detail/view.dart | 20 ++- 4 files changed, 92 insertions(+), 63 deletions(-) diff --git a/lib/pages/video/detail/introduction/view.dart b/lib/pages/video/detail/introduction/view.dart index 2a6aa172..04f8cbc0 100644 --- a/lib/pages/video/detail/introduction/view.dart +++ b/lib/pages/video/detail/introduction/view.dart @@ -210,7 +210,10 @@ class _VideoInfoState extends State with TickerProviderStateMixin { }), ), onPressed: showIntroDetail, - icon: const Icon(Icons.more_horiz), + icon: Icon( + Icons.more_horiz, + color: Theme.of(context).colorScheme.primary, + ), ), ), ], diff --git a/lib/pages/video/detail/introduction/widgets/fav_panel.dart b/lib/pages/video/detail/introduction/widgets/fav_panel.dart index 44502b0e..6a52e683 100644 --- a/lib/pages/video/detail/introduction/widgets/fav_panel.dart +++ b/lib/pages/video/detail/introduction/widgets/fav_panel.dart @@ -33,24 +33,13 @@ class _FavPanelState extends State { child: Column( children: [ AppBar( - toolbarHeight: 50, - automaticallyImplyLeading: false, centerTitle: false, - elevation: 1, - title: Text( - '选择文件夹', - style: Theme.of(context).textTheme.titleMedium, - ), - actions: [ - TextButton( - onPressed: () async { - feedBack(); - await widget.ctr!.actionFavVideo(); - }, - child: const Text('完成'), - ), - const SizedBox(width: 6), - ], + elevation: 0, + leading: IconButton( + onPressed: () => Get.back(), + icon: const Icon(Icons.close_outlined)), + title: + Text('添加到收藏夹', style: Theme.of(context).textTheme.titleMedium), ), Expanded( child: Material( @@ -63,45 +52,33 @@ class _FavPanelState extends State { return Obx( () => ListView.builder( itemCount: - widget.ctr!.favFolderData.value.list!.length + 1, + widget.ctr!.favFolderData.value.list!.length, itemBuilder: (context, index) { - if (index == 0) { - return const SizedBox(height: 10); - } else { - return ListTile( - onTap: () => widget.ctr!.onChoose( - widget.ctr!.favFolderData.value - .list![index - 1].favState != - 1, - index - 1), - dense: true, - leading: - const Icon(Icons.folder_special_outlined), - minLeadingWidth: 0, - title: Text(widget.ctr!.favFolderData.value - .list![index - 1].title!), - subtitle: Text( - '${widget.ctr!.favFolderData.value.list![index - 1].mediaCount}个内容', - style: TextStyle( - color: - Theme.of(context).colorScheme.outline, - fontSize: Theme.of(context) - .textTheme - .labelSmall! - .fontSize), + return ListTile( + onTap: () => widget.ctr!.onChoose( + widget.ctr!.favFolderData.value.list![index] + .favState != + 1, + index), + dense: true, + leading: const Icon(Icons.folder_outlined), + minLeadingWidth: 0, + title: Text(widget.ctr!.favFolderData.value + .list![index].title!), + subtitle: Text( + '${widget.ctr!.favFolderData.value.list![index].mediaCount}个内容', + ), + 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), ), - trailing: Transform.scale( - scale: 0.9, - child: Checkbox( - value: widget.ctr!.favFolderData.value - .list![index - 1].favState == - 1, - onChanged: (bool? checkValue) => widget.ctr! - .onChoose(checkValue!, index - 1), - ), - ), - ); - } + ), + ); }, ), ); @@ -119,6 +96,46 @@ class _FavPanelState extends State { ), ), ), + 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), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + TextButton( + onPressed: () => Get.back(), + style: TextButton.styleFrom( + padding: const EdgeInsets.only(left: 30, right: 30), + backgroundColor: Theme.of(context) + .colorScheme + .onInverseSurface, // 设置按钮背景色 + ), + child: const Text('取消'), + ), + const SizedBox(width: 10), + TextButton( + onPressed: () async { + feedBack(); + await widget.ctr!.actionFavVideo(); + }, + style: TextButton.styleFrom( + padding: const EdgeInsets.only(left: 30, right: 30), + foregroundColor: Theme.of(context).colorScheme.onPrimary, + backgroundColor: + Theme.of(context).colorScheme.primary, // 设置按钮背景色 + ), + child: const Text('完成'), + ), + ], + ), + ), ], ), ); diff --git a/lib/pages/video/detail/introduction/widgets/intro_detail.dart b/lib/pages/video/detail/introduction/widgets/intro_detail.dart index 35d60eda..99a40793 100644 --- a/lib/pages/video/detail/introduction/widgets/intro_detail.dart +++ b/lib/pages/video/detail/introduction/widgets/intro_detail.dart @@ -37,10 +37,7 @@ class IntroDetail extends StatelessWidget { width: 32, height: 3, decoration: BoxDecoration( - color: Theme.of(context) - .colorScheme - .onSecondaryContainer - .withOpacity(0.5), + color: Theme.of(context).colorScheme.primary, borderRadius: const BorderRadius.all(Radius.circular(3))), ), diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index 548acbce..7c56959e 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -1,11 +1,13 @@ import 'dart:async'; import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:get/get.dart'; import 'package:flutter/material.dart'; import 'package:hive/hive.dart'; import 'package:pilipala/common/widgets/network_img_layer.dart'; import 'package:pilipala/common/widgets/sliver_header.dart'; +import 'package:pilipala/http/user.dart'; import 'package:pilipala/models/common/search_type.dart'; import 'package:pilipala/pages/bangumi/introduction/index.dart'; import 'package:pilipala/pages/video/detail/introduction/widgets/menu_row.dart'; @@ -156,8 +158,11 @@ class _VideoDetailPageState extends State scrolledUnderElevation: 0, forceElevated: innerBoxIsScrolled, expandedHeight: videoHeight, - // backgroundColor: Colors.transparent, - backgroundColor: Theme.of(context).colorScheme.background, + backgroundColor: + MediaQuery.of(Get.context!).platformBrightness == + Brightness.dark + ? Colors.black + : Theme.of(context).colorScheme.background, flexibleSpace: FlexibleSpaceBar( background: Padding( padding: EdgeInsets.only(top: statusBarHeight), @@ -226,10 +231,17 @@ class _VideoDetailPageState extends State backgroundColor: Colors.transparent, actions: [ - /// TODO IconButton( tooltip: '稍后再看', - onPressed: () {}, + onPressed: () async { + var res = await UserHttp + .toViewLater( + bvid: + videoDetailController + .bvid); + SmartDialog.showToast( + res['msg']); + }, icon: const Icon(Icons .history_outlined)) ],