基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。
refactor(ui): unify bottom sheet styling with shared material components
Predidit610bfeeae85e
diff --git a/lib/bean/dialog/adaptive_bottom_sheet.dart b/lib/bean/dialog/adaptive_bottom_sheet.dartindex 5c003708..b3532650 100644--- a/lib/bean/dialog/adaptive_bottom_sheet.dart+++ b/lib/bean/dialog/adaptive_bottom_sheet.dart@@ -46,7 +46,10 @@ Future<T?> showAdaptiveBottomSheet<T>({maxHeightFactor: maxHeightFactor,compactLandscapeMaxHeightFactor: compactLandscapeMaxHeightFactor,),+ shape: const RoundedRectangleBorder(+ borderRadius: BorderRadius.vertical(top: Radius.circular(28)),+ ),clipBehavior: Clip.antiAlias,- backgroundColor: backgroundColor,+ backgroundColor: backgroundColor ?? Theme.of(context).colorScheme.surface,);}diff --git a/lib/bean/dialog/material_bottom_sheet.dart b/lib/bean/dialog/material_bottom_sheet.dartnew file mode 100644index 00000000..db1bf329--- /dev/null+++ b/lib/bean/dialog/material_bottom_sheet.dart@@ -0,0 +1,263 @@+import 'package:flutter/material.dart';++const double materialBottomSheetRadius = 24;+const EdgeInsets materialBottomSheetContentPadding =+ EdgeInsets.fromLTRB(16, 16, 16, 24);++class MaterialBottomSheetHeader extends StatelessWidget {+ const MaterialBottomSheetHeader({+ super.key,+ required this.title,+ this.description,+ this.onClose,+ this.footer,+ this.trailing,+ });++ final String title;+ final String? description;+ final VoidCallback? onClose;+ final Widget? footer;+ final Widget? trailing;++ @override+ Widget build(BuildContext context) {+ final theme = Theme.of(context);+ final colorScheme = theme.colorScheme;++ return Padding(+ padding: const EdgeInsets.fromLTRB(20, 20, 12, 16),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Row(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Expanded(+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(+ title,+ style: theme.textTheme.headlineSmall?.copyWith(+ color: colorScheme.onSurface,+ fontWeight: FontWeight.w700,+ ),+ ),+ if (description != null) ...[+ const SizedBox(height: 4),+ Text(+ description!,+ style: theme.textTheme.bodyMedium?.copyWith(+ color: colorScheme.onSurfaceVariant,+ ),+ ),+ ],+ ],+ ),+ ),+ if (trailing != null) ...[+ const SizedBox(width: 12),+ trailing!,+ ] else if (onClose != null) ...[+ const SizedBox(width: 12),+ IconButton.filledTonal(+ onPressed: onClose,+ tooltip: '关闭',+ icon: const Icon(Icons.close_rounded),+ ),+ ],+ ],+ ),+ if (footer != null) ...[+ const SizedBox(height: 16),+ footer!,+ ],+ ],+ ),+ );+ }+}++class MaterialBottomSheetTabBar extends StatelessWidget {+ const MaterialBottomSheetTabBar({+ super.key,+ required this.tabs,+ this.controller,+ this.trailing,+ this.isScrollable = false,+ this.tabAlignment,+ });++ final List<Widget> tabs;+ final TabController? controller;+ final Widget? trailing;+ final bool isScrollable;+ final TabAlignment? tabAlignment;++ @override+ Widget build(BuildContext context) {+ final colorScheme = Theme.of(context).colorScheme;+ final tabBar = TabBar(+ controller: controller,+ isScrollable: isScrollable,+ tabAlignment: tabAlignment,+ dividerColor: Colors.transparent,+ indicatorSize: TabBarIndicatorSize.tab,+ splashBorderRadius: BorderRadius.circular(20),+ indicator: BoxDecoration(+ color: colorScheme.secondaryContainer,+ borderRadius: BorderRadius.circular(20),+ ),+ labelColor: colorScheme.onSecondaryContainer,+ unselectedLabelColor: colorScheme.onSurfaceVariant,+ tabs: tabs,+ );++ return Container(+ height: 48,+ margin: const EdgeInsets.symmetric(horizontal: 16),+ padding: const EdgeInsets.all(4),+ decoration: BoxDecoration(+ color: colorScheme.surfaceContainerHighest,+ borderRadius: BorderRadius.circular(materialBottomSheetRadius),+ ),+ clipBehavior: Clip.antiAlias,+ child: trailing == null+ ? tabBar+ : Row(+ children: [+ Expanded(child: tabBar),+ SizedBox.square(+ dimension: 40,+ child: trailing!,+ ),+ ],+ ),+ );+ }+}++class MaterialBottomSheetSection extends StatelessWidget {+ const MaterialBottomSheetSection({+ super.key,+ required this.title,+ required this.child,+ this.description,+ this.icon,+ this.padding = const EdgeInsets.fromLTRB(18, 16, 18, 18),+ });++ final String title;+ final String? description;+ final IconData? icon;+ final Widget child;+ final EdgeInsetsGeometry padding;++ @override+ Widget build(BuildContext context) {+ final theme = Theme.of(context);+ final colorScheme = theme.colorScheme;++ return Material(+ color: colorScheme.surfaceContainerLow,+ borderRadius: BorderRadius.circular(materialBottomSheetRadius),+ clipBehavior: Clip.antiAlias,+ child: Padding(+ padding: padding,+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Row(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ if (icon != null) ...[+ Icon(icon, color: colorScheme.primary),+ const SizedBox(width: 12),+ ],+ Expanded(+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(+ title,+ style: theme.textTheme.titleMedium?.copyWith(+ color: colorScheme.onSurface,+ fontWeight: FontWeight.w700,+ ),+ ),+ if (description != null) ...[+ const SizedBox(height: 4),+ Text(+ description!,+ style: theme.textTheme.bodySmall?.copyWith(+ color: colorScheme.onSurfaceVariant,+ ),+ ),+ ],+ ],+ ),+ ),+ ],+ ),+ const SizedBox(height: 16),+ child,+ ],+ ),+ ),+ );+ }+}++class MaterialBottomSheetGroup extends StatelessWidget {+ const MaterialBottomSheetGroup({+ super.key,+ required this.title,+ required this.children,+ this.dividerIndent = 72,+ });++ final String title;+ final List<Widget> children;+ final double dividerIndent;++ @override+ Widget build(BuildContext context) {+ final theme = Theme.of(context);+ final colorScheme = theme.colorScheme;++ return Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Padding(+ padding: const EdgeInsets.fromLTRB(4, 0, 4, 8),+ child: Text(+ title,+ style: theme.textTheme.titleSmall?.copyWith(+ color: colorScheme.primary,+ fontWeight: FontWeight.w600,+ ),+ ),+ ),+ Material(+ color: colorScheme.surfaceContainerLow,+ borderRadius: BorderRadius.circular(materialBottomSheetRadius),+ clipBehavior: Clip.antiAlias,+ child: Column(+ children: [+ for (var index = 0; index < children.length; index++) ...[+ children[index],+ if (index != children.length - 1)+ Divider(+ height: 1,+ indent: dividerIndent,+ color: colorScheme.outlineVariant,+ ),+ ],+ ],+ ),+ ),+ ],+ );+ }+}diff --git a/lib/pages/download/download_episode_sheet.dart b/lib/pages/download/download_episode_sheet.dartindex a28aac72..d61a3942 100644--- a/lib/pages/download/download_episode_sheet.dart+++ b/lib/pages/download/download_episode_sheet.dart@@ -1,6 +1,7 @@import 'package:flutter/material.dart';import 'package:flutter_modular/flutter_modular.dart';import 'package:kazumi/bean/dialog/dialog_helper.dart';+import 'package:kazumi/bean/dialog/material_bottom_sheet.dart';import 'package:kazumi/modules/download/download_module.dart';import 'package:kazumi/modules/roads/road_module.dart';import 'package:kazumi/pages/download/download_controller.dart';@@ -56,30 +57,13 @@ class _DownloadEpisodeSheetState extends State<DownloadEpisodeSheet> {builder: (context, scrollController) {return Column(children: [- Padding(- padding: const EdgeInsets.fromLTRB(16, 16, 16, 8),- child: Row(- mainAxisAlignment: MainAxisAlignment.spaceBetween,+ MaterialBottomSheetHeader(+ title: '选择要下载的集数',+ description: '已选 ${_selectedEpisodes.length} 集',+ onClose: () => Navigator.of(context).pop(),+ footer: Row(children: [- const Text(- '选择要下载的集数',- style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),- ),- Text(- '已选 ${_selectedEpisodes.length} 集',- style: TextStyle(- fontSize: 14,- color: Theme.of(context).colorScheme.primary,- ),- ),- ],- ),- ),- Padding(- padding: const EdgeInsets.symmetric(horizontal: 16),- child: Row(- children: [- TextButton(+ FilledButton.tonal(onPressed: () {setState(() {_selectedEpisodes.clear();@@ -93,23 +77,20 @@ class _DownloadEpisodeSheetState extends State<DownloadEpisodeSheet> {},child: const Text('全选'),),+ const SizedBox(width: 8),TextButton(onPressed: () {- setState(() {- _selectedEpisodes.clear();- });+ setState(_selectedEpisodes.clear);},child: const Text('取消全选'),),],),),- SizedBox(height: 8),- // GridExpanded(child: GridView.builder(controller: scrollController,- padding: const EdgeInsets.symmetric(horizontal: 12),+ padding: const EdgeInsets.symmetric(horizontal: 16),gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3,crossAxisSpacing: 8,@@ -131,9 +112,9 @@ class _DownloadEpisodeSheetState extends State<DownloadEpisodeSheet> {.surfaceContainerHighest.withValues(alpha: 0.5): isSelected- ? Theme.of(context).colorScheme.primaryContainer- : Theme.of(context).colorScheme.onInverseSurface,- borderRadius: BorderRadius.circular(8),+ ? Theme.of(context).colorScheme.secondaryContainer+ : Theme.of(context).colorScheme.surfaceContainerLow,+ borderRadius: BorderRadius.circular(16),clipBehavior: Clip.hardEdge,child: InkWell(onTap: isDownloaded@@ -194,7 +175,6 @@ class _DownloadEpisodeSheetState extends State<DownloadEpisodeSheet> {},),),- // Action buttonsPadding(padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),child: SafeArea(diff --git a/lib/pages/info/character_page.dart b/lib/pages/info/character_page.dartindex 1c23cfc6..8547e962 100644--- a/lib/pages/info/character_page.dart+++ b/lib/pages/info/character_page.dart@@ -5,6 +5,7 @@ import 'package:kazumi/modules/comments/comment_item.dart';import 'package:kazumi/request/apis/bangumi_api.dart';import 'package:kazumi/bean/card/network_img_layer.dart';import 'package:kazumi/bean/card/character_comments_card.dart';+import 'package:kazumi/bean/dialog/material_bottom_sheet.dart';import 'package:kazumi/bean/widget/error_widget.dart';import 'package:kazumi/bean/widget/image_preview.dart';@@ -76,19 +77,21 @@ class _CharacterPageState extends State<CharacterPage> {return DefaultTabController(length: 2,child: Scaffold(+ backgroundColor: Theme.of(context).colorScheme.surface,body: Column(children: [- const PreferredSize(- preferredSize: Size.fromHeight(kToolbarHeight),- child: Material(- child: TabBar(- tabs: [- Tab(text: '人物资料'),- Tab(text: '吐槽箱'),- ],- ),- ),+ MaterialBottomSheetHeader(+ title: '人物详情',+ description: loadingCharacter ? '正在加载人物资料' : null,+ onClose: () => Navigator.of(context).pop(),+ ),+ const MaterialBottomSheetTabBar(+ tabs: [+ Tab(text: '人物资料'),+ Tab(text: '吐槽箱'),+ ],),+ const SizedBox(height: 4),Expanded(child: TabBarView(children: [characterInfoBody, characterCommentsBody],diff --git a/lib/pages/info/source_sheet.dart b/lib/pages/info/source_sheet.dartindex 554fc626..96cc146e 100644--- a/lib/pages/info/source_sheet.dart+++ b/lib/pages/info/source_sheet.dart@@ -4,6 +4,7 @@ import 'package:flutter_modular/flutter_modular.dart';import 'package:kazumi/pages/info/info_controller.dart';import 'package:kazumi/services/logging/logger.dart';import 'package:kazumi/bean/dialog/dialog_helper.dart';+import 'package:kazumi/bean/dialog/material_bottom_sheet.dart';import 'package:kazumi/plugins/plugins_controller.dart';import 'package:kazumi/plugins/plugins.dart';import 'package:kazumi/pages/video/video_playback_args.dart';@@ -477,156 +478,154 @@ class _SourceSheetState extends State<SourceSheet>@overrideWidget build(BuildContext context) {- return DefaultTabController(- length: 3,- child: Scaffold(- body: Column(- children: [- Row(- children: [- Expanded(- child: TabBar(- isScrollable: true,- tabAlignment: TabAlignment.center,- dividerHeight: 0,- controller: widget.tabController,- tabs: pluginsController.pluginList- .map(- (plugin) => Observer(- builder: (context) {- return Tab(- child: Row(- children: [- Text(- plugin.name,- overflow: TextOverflow.ellipsis,- style: TextStyle(- fontSize: Theme.of(context)- .textTheme- .titleMedium!- .fontSize,- color: Theme.of(context)- .colorScheme- .onSurface),- ),- const SizedBox(width: 5.0),- Container(- width: 8.0,- height: 8.0,- decoration: BoxDecoration(- color: switch (widget.infoController- .pluginSearchStatus[plugin.name]) {- 'success' => Colors.green,- 'noResult' => Colors.orange,- 'captcha' => Colors.blue,- 'error' => Colors.red,- _ => Colors.grey,- },- shape: BoxShape.circle,- ),- ),- ],- ),- );- },- ),- )- .toList(),+ return Scaffold(+ backgroundColor: Theme.of(context).colorScheme.surface,+ body: Column(+ children: [+ MaterialBottomSheetHeader(+ title: '选择播放源',+ description: '正在检索“$keyword”',+ onClose: () => Navigator.of(context).pop(),+ ),+ MaterialBottomSheetTabBar(+ isScrollable: true,+ tabAlignment: TabAlignment.center,+ controller: widget.tabController,+ tabs: pluginsController.pluginList+ .map(+ (plugin) => Observer(+ builder: (context) {+ return Tab(+ child: Row(+ children: [+ Text(+ plugin.name,+ overflow: TextOverflow.ellipsis,+ ),+ const SizedBox(width: 5.0),+ Container(+ width: 8.0,+ height: 8.0,+ decoration: BoxDecoration(+ color: switch (widget.infoController+ .pluginSearchStatus[plugin.name]) {+ 'success' => Colors.green,+ 'noResult' => Colors.orange,+ 'captcha' => Colors.blue,+ 'error' => Colors.red,+ _ => Colors.grey,+ },+ shape: BoxShape.circle,+ ),+ ),+ ],+ ),+ );+ },),- ),- IconButton(- onPressed: () {- int currentIndex = widget.tabController.index;- final currentPlugin =- pluginsController.pluginList[currentIndex];- final targetUrl = currentPlugin.usesApiSearch- ? currentPlugin.baseUrl- : currentPlugin.searchURL.replaceFirst(- '@keyword',- Uri.encodeQueryComponent(keyword),- );- launchUrl(- Uri.parse(targetUrl),- mode: LaunchMode.externalApplication,- );- },- icon: const Icon(Icons.open_in_browser_rounded),- ),- const SizedBox(width: 4),- ],+ )+ .toList(),+ trailing: IconButton(+ tooltip: '在浏览器中打开',+ onPressed: () {+ int currentIndex = widget.tabController.index;+ final currentPlugin =+ pluginsController.pluginList[currentIndex];+ final targetUrl = currentPlugin.usesApiSearch+ ? currentPlugin.baseUrl+ : currentPlugin.searchURL.replaceFirst(+ '@keyword',+ Uri.encodeQueryComponent(keyword),+ );+ launchUrl(+ Uri.parse(targetUrl),+ mode: LaunchMode.externalApplication,+ );+ },+ icon: const Icon(Icons.open_in_browser_rounded),),- const Divider(height: 1),- Expanded(- child: Observer(- builder: (context) => TabBarView(- controller: widget.tabController,- children: List.generate(pluginsController.pluginList.length,- (pluginIndex) {- var plugin = pluginsController.pluginList[pluginIndex];- var cardList = <Widget>[];- for (var searchResponse- in widget.infoController.pluginSearchResponseList) {- if (searchResponse.pluginName == plugin.name) {- for (var searchItem in searchResponse.data) {- cardList.add(- Card(- elevation: 0,- margin: const EdgeInsets.only(- left: 10, right: 10, top: 10),- child: InkWell(- borderRadius: BorderRadius.circular(12),- onTap: () async {- final cancelToken = RuleCancelToken();- KazumiDialog.showLoading(- msg: '获取中',- barrierDismissible: isDesktop(),- onDismiss: cancelToken.cancel,+ ),+ const SizedBox(height: 4),+ Expanded(+ child: Observer(+ builder: (context) => TabBarView(+ controller: widget.tabController,+ children: List.generate(pluginsController.pluginList.length,+ (pluginIndex) {+ var plugin = pluginsController.pluginList[pluginIndex];+ var cardList = <Widget>[];+ for (var searchResponse+ in widget.infoController.pluginSearchResponseList) {+ if (searchResponse.pluginName == plugin.name) {+ for (var searchItem in searchResponse.data) {+ cardList.add(+ Card(+ elevation: 0,+ color: Theme.of(context)+ .colorScheme+ .surfaceContainerLow,+ clipBehavior: Clip.antiAlias,+ shape: RoundedRectangleBorder(+ borderRadius: BorderRadius.circular(+ materialBottomSheetRadius,+ ),+ ),+ margin: const EdgeInsets.only(+ left: 10, right: 10, top: 10),+ child: InkWell(+ borderRadius: BorderRadius.circular(+ materialBottomSheetRadius,+ ),+ onTap: () async {+ final cancelToken = RuleCancelToken();+ KazumiDialog.showLoading(+ msg: '获取中',+ barrierDismissible: isDesktop(),+ onDismiss: cancelToken.cancel,+ );+ try {+ final roads = await plugin.queryChapterRoads(+ searchItem.src,+ cancelToken: cancelToken,);- try {- final roads =- await plugin.queryChapterRoads(- searchItem.src,- cancelToken: cancelToken,- );- if (roads.isEmpty) {- throw ChapterErrorException(plugin.name);- }- KazumiDialog.dismiss();- if (!mounted) return;- this.context.pushNamed(- '/video/',- arguments: OnlineVideoPlaybackArgs(- bangumiItem: widget- .infoController.bangumiItem,- plugin: plugin,- title: searchItem.name,- src: searchItem.src,- roads: roads,- ),- );- } catch (_) {- KazumiLogger().w(- "PluginSearchService: failed to query video playlist");- KazumiDialog.dismiss();+ if (roads.isEmpty) {+ throw ChapterErrorException(plugin.name);}- },- child: Padding(- padding: const EdgeInsets.all(20),- child: Text(searchItem.name),- ),+ KazumiDialog.dismiss();+ if (!mounted) return;+ this.context.pushNamed(+ '/video/',+ arguments: OnlineVideoPlaybackArgs(+ bangumiItem:+ widget.infoController.bangumiItem,+ plugin: plugin,+ title: searchItem.name,+ src: searchItem.src,+ roads: roads,+ ),+ );+ } catch (_) {+ KazumiLogger().w(+ "PluginSearchService: failed to query video playlist");+ KazumiDialog.dismiss();+ }+ },+ child: Padding(+ padding: const EdgeInsets.all(20),+ child: Text(searchItem.name),),),- );- }+ ),+ );}}- return buildPluginView(plugin, cardList);- }),- ),+ }+ return buildPluginView(plugin, cardList);+ }),),- )- ],- ),+ ),+ )+ ],),);}diff --git a/lib/pages/player/player_item.dart b/lib/pages/player/player_item.dartindex 6f8ee526..2dd07e43 100644--- a/lib/pages/player/player_item.dart+++ b/lib/pages/player/player_item.dart@@ -21,6 +21,7 @@ import 'package:window_manager/window_manager.dart';import 'package:canvas_danmaku/canvas_danmaku.dart';import 'package:kazumi/bean/dialog/adaptive_bottom_sheet.dart';import 'package:kazumi/bean/dialog/dialog_helper.dart';+import 'package:kazumi/bean/dialog/material_bottom_sheet.dart';import 'package:screen_brightness_platform_interface/screen_brightness_platform_interface.dart';import 'package:kazumi/pages/history/history_controller.dart';import 'package:kazumi/services/storage/storage.dart';@@ -1208,126 +1209,151 @@ class _PlayerItemState extends State<PlayerItem>);}- Widget get videoInfoBody {- return Observer(builder: (context) {- return ListView(+ void _copyVideoInfo(String label, String value) {+ Clipboard.setData(ClipboardData(text: '$label\n$value'));+ KazumiDialog.showToast(message: '已复制到剪贴板');+ }++ Widget _buildVideoInfoSection(+ BuildContext context, {+ required String title,+ required List<({IconData icon, String label, String value})> items,+ }) {+ final theme = Theme.of(context);+ final colorScheme = theme.colorScheme;++ return Padding(+ padding: const EdgeInsets.only(bottom: 24),+ child: MaterialBottomSheetGroup(+ title: title,children: [- ListTile(- title: const Text("Source"),- subtitle: Text(playerController.videoUrl),- onTap: () {- KazumiDialog.showToast(message: '已复制到剪贴板');- Clipboard.setData(- ClipboardData(text: playerController.videoUrl),- );- },- ),- ListTile(- title: const Text("Resolution"),- subtitle: Text(- '${playerController.debug.playerWidth}x${playerController.debug.playerHeight}'),- onTap: () {- KazumiDialog.showToast(message: '已复制到剪贴板');- Clipboard.setData(- ClipboardData(- text:- "Resolution\n${playerController.debug.playerWidth}x${playerController.debug.playerHeight}",- ),- );- },- ),- ListTile(- title: const Text("VideoParams"),- subtitle: Text(playerController.debug.playerVideoParams.toString()),- onTap: () {- KazumiDialog.showToast(message: '已复制到剪贴板');- Clipboard.setData(- ClipboardData(- text:- "VideoParams\n${playerController.debug.playerVideoParams.toString()}",+ for (final item in items)+ ListTile(+ contentPadding: const EdgeInsets.fromLTRB(16, 8, 12, 8),+ leading: Container(+ width: 40,+ height: 40,+ decoration: BoxDecoration(+ color: colorScheme.secondaryContainer,+ borderRadius: BorderRadius.circular(12),),- );- },- ),- ListTile(- title: const Text("AudioParams"),- subtitle: Text(playerController.debug.playerAudioParams.toString()),- onTap: () {- KazumiDialog.showToast(message: '已复制到剪贴板');- Clipboard.setData(- ClipboardData(- text:- "AudioParams\n${playerController.debug.playerAudioParams.toString()}",+ child: Icon(+ item.icon,+ color: colorScheme.onSecondaryContainer,+ size: 22,),- );- },- ),- ListTile(- title: const Text("Media"),- subtitle: Text(playerController.debug.playerPlaylist.toString()),- onTap: () {- KazumiDialog.showToast(message: '已复制到剪贴板');- Clipboard.setData(- ClipboardData(- text:- "Media\n${playerController.debug.playerPlaylist.toString()}",+ ),+ title: Text(+ item.label,+ style: theme.textTheme.labelLarge?.copyWith(+ color: colorScheme.onSurfaceVariant,),- );- },- ),- ListTile(- title: const Text("AudioTrack"),- subtitle: Text(playerController.debug.playerAudioTracks.toString()),- onTap: () {- KazumiDialog.showToast(message: '已复制到剪贴板');- Clipboard.setData(- ClipboardData(- text:- "AudioTrack\n${playerController.debug.playerAudioTracks.toString()}",+ ),+ subtitle: Padding(+ padding: const EdgeInsets.only(top: 4),+ child: Text(+ item.value.isEmpty ? '暂无数据' : item.value,+ style: theme.textTheme.bodyMedium?.copyWith(+ color: item.value.isEmpty+ ? colorScheme.outline+ : colorScheme.onSurface,+ ),),- );- },+ ),+ trailing: IconButton(+ onPressed: item.value.isEmpty+ ? null+ : () => _copyVideoInfo(item.label, item.value),+ tooltip: '复制${item.label}',+ icon: const Icon(Icons.copy_rounded),+ ),+ onTap: item.value.isEmpty+ ? null+ : () => _copyVideoInfo(item.label, item.value),+ ),+ ],+ ),+ );+ }++ Widget get videoInfoBody {+ return Observer(builder: (context) {+ final debug = playerController.debug;+ final resolution = debug.playerWidth > 0 && debug.playerHeight > 0+ ? '${debug.playerWidth} × ${debug.playerHeight}'+ : '';++ return ListView(+ padding: const EdgeInsets.fromLTRB(16, 16, 16, 12),+ children: [+ _buildVideoInfoSection(+ context,+ title: '播放源',+ items: [+ (+ icon: Icons.link_rounded,+ label: '媒体地址',+ value: playerController.videoUrl,+ ),+ ],),- ListTile(- title: const Text("VideoTrack"),- subtitle: Text(playerController.debug.playerVideoTracks.toString()),- onTap: () {- KazumiDialog.showToast(message: '已复制到剪贴板');- Clipboard.setData(- ClipboardData(- text:- "VideoTrack\n${playerController.debug.playerVideoTracks.toString()}",- ),- );- },+ _buildVideoInfoSection(+ context,+ title: '视频',+ items: [+ (+ icon: Icons.aspect_ratio_rounded,+ label: '分辨率',+ value: resolution,+ ),+ (+ icon: Icons.tune_rounded,+ label: '视频参数',+ value: debug.playerVideoParams,+ ),+ (+ icon: Icons.video_file_rounded,+ label: '视频轨道',+ value: debug.playerVideoTracks,+ ),+ (+ icon: Icons.speed_rounded,+ label: '视频码率',+ value: debug.playerVideoBitrate,+ ),+ ],),- ListTile(- title: const Text("VideoBitrate"),- subtitle:- Text(playerController.debug.playerVideoBitrate.toString()),- onTap: () {- KazumiDialog.showToast(message: '已复制到剪贴板');- Clipboard.setData(- ClipboardData(- text:- "VideoBitrate\n${playerController.debug.playerVideoBitrate.toString()}",- ),- );- },+ _buildVideoInfoSection(+ context,+ title: '音频',+ items: [+ (+ icon: Icons.graphic_eq_rounded,+ label: '音频参数',+ value: debug.playerAudioParams,+ ),+ (+ icon: Icons.audio_file_rounded,+ label: '音频轨道',+ value: debug.playerAudioTracks,+ ),+ (+ icon: Icons.speed_rounded,+ label: '音频码率',+ value: debug.playerAudioBitrate,+ ),+ ],),- ListTile(- title: const Text("AudioBitrate"),- subtitle:- Text(playerController.debug.playerAudioBitrate.toString()),- onTap: () {- KazumiDialog.showToast(message: '已复制到剪贴板');- Clipboard.setData(- ClipboardData(- text:- "AudioBitrate\n${playerController.debug.playerAudioBitrate.toString()}",- ),- );- },+ _buildVideoInfoSection(+ context,+ title: '媒体',+ items: [+ (+ icon: Icons.playlist_play_rounded,+ label: '播放列表',+ value: debug.playerPlaylist,+ ),+ ],),],);@@ -1335,48 +1361,112 @@ class _PlayerItemState extends State<PlayerItem>}Widget get videoDebugLogBody {- return Scaffold(- body: Padding(- padding: const EdgeInsets.fromLTRB(8.0, 8.0, 8.0, 0),- child: Observer(builder: (context) {- return ListView.builder(- itemCount: playerController.debug.playerLog.length,- itemBuilder: (context, index) {- return Text(playerController.debug.playerLog[index]);- },- );- }),- ),- floatingActionButton: FloatingActionButton(- child: const Icon(Icons.copy),- onPressed: () {- Clipboard.setData(- ClipboardData(text: playerController.debug.playerLog.join('\n')),- );- }),- );+ return Observer(builder: (context) {+ final theme = Theme.of(context);+ final colorScheme = theme.colorScheme;+ final logs = playerController.debug.playerLog;++ return Column(+ children: [+ Padding(+ padding: const EdgeInsets.fromLTRB(20, 16, 16, 8),+ child: Row(+ children: [+ Expanded(+ child: Text(+ '${logs.length} 条运行日志',+ style: theme.textTheme.titleSmall?.copyWith(+ color: colorScheme.onSurfaceVariant,+ ),+ ),+ ),+ FilledButton.tonalIcon(+ onPressed: logs.isEmpty+ ? null+ : () => _copyVideoInfo('播放器日志', logs.join('\n')),+ icon: const Icon(Icons.copy_all_rounded),+ label: const Text('全部复制'),+ ),+ ],+ ),+ ),+ Expanded(+ child: logs.isEmpty+ ? Center(+ child: Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ Icon(+ Icons.receipt_long_rounded,+ size: 48,+ color: colorScheme.outline,+ ),+ const SizedBox(height: 12),+ Text(+ '暂无运行日志',+ style: theme.textTheme.titleMedium?.copyWith(+ color: colorScheme.onSurfaceVariant,+ ),+ ),+ ],+ ),+ )+ : ListView.separated(+ padding: const EdgeInsets.fromLTRB(16, 8, 16, 24),+ itemCount: logs.length,+ separatorBuilder: (context, index) =>+ const SizedBox(height: 8),+ itemBuilder: (context, index) {+ return Container(+ width: double.infinity,+ padding: const EdgeInsets.all(14),+ decoration: BoxDecoration(+ color: colorScheme.surfaceContainerLow,+ borderRadius: BorderRadius.circular(16),+ ),+ child: SelectableText(+ logs[index],+ style: theme.textTheme.bodySmall?.copyWith(+ color: colorScheme.onSurfaceVariant,+ height: 1.45,+ ),+ ),+ );+ },+ ),+ ),+ ],+ );+ });}void showVideoInfo() {showAdaptiveBottomSheet<void>(context: context,+ maxHeightFactor: 0.86,+ backgroundColor: Theme.of(context).colorScheme.surface,builder: (context) {+ final theme = Theme.of(context);+ final colorScheme = theme.colorScheme;+return DefaultTabController(length: 2,child: Scaffold(+ backgroundColor: colorScheme.surface,body: Column(children: [- const PreferredSize(- preferredSize: Size.fromHeight(kToolbarHeight),- child: Material(- child: TabBar(- tabs: [- Tab(text: '状态'),- Tab(text: '日志'),- ],- ),- ),+ MaterialBottomSheetHeader(+ title: '视频详情',+ description: '实时播放状态与诊断信息',+ onClose: () => Navigator.of(context).pop(),+ ),+ const MaterialBottomSheetTabBar(+ tabs: [+ Tab(text: '状态'),+ Tab(text: '日志'),+ ],),+ const SizedBox(height: 4),Expanded(child: TabBarView(children: [diff --git a/lib/pages/search/search_page.dart b/lib/pages/search/search_page.dartindex 3c50d6b8..40e1b583 100644--- a/lib/pages/search/search_page.dart+++ b/lib/pages/search/search_page.dart@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';import 'package:flutter_mobx/flutter_mobx.dart';import 'package:flutter_modular/flutter_modular.dart';import 'package:kazumi/bean/dialog/adaptive_bottom_sheet.dart';+import 'package:kazumi/bean/dialog/material_bottom_sheet.dart';import 'package:kazumi/bean/appbar/sys_app_bar.dart';import 'package:kazumi/bean/card/bangumi_card.dart';import 'package:kazumi/bean/widget/error_widget.dart';@@ -581,58 +582,19 @@ class _SearchWorkbenchSheetState extends State<_SearchWorkbenchSheet> {@overrideWidget build(BuildContext context) {- final theme = Theme.of(context);- final colorScheme = theme.colorScheme;return SafeArea(child: Column(children: [- Padding(- padding: const EdgeInsets.fromLTRB(16, 12, 16, 8),- child: Container(- width: double.infinity,- padding: const EdgeInsets.fromLTRB(20, 16, 12, 16),- decoration: BoxDecoration(- color: colorScheme.surfaceContainerLow,- borderRadius: BorderRadius.circular(24),- ),- child: Row(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Expanded(- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Text(- '筛选条件',- style: theme.textTheme.titleLarge?.copyWith(- fontWeight: FontWeight.w700,- ),- ),- const SizedBox(height: 4),- Text(- '组合标签、季度和评分等条件,更快找到想看的番剧。',- style: theme.textTheme.bodyMedium?.copyWith(- color: colorScheme.onSurfaceVariant,- ),- ),- ],- ),- ),- const SizedBox(width: 12),- IconButton.filledTonal(- tooltip: '关闭',- onPressed: () => Navigator.pop(context),- icon: const Icon(Icons.close),- ),- ],- ),- ),+ MaterialBottomSheetHeader(+ title: '筛选条件',+ description: '组合标签、季度和评分等条件,更快找到想看的番剧。',+ onClose: () => Navigator.pop(context),),Expanded(child: ListView(padding: const EdgeInsets.fromLTRB(16, 4, 16, 24),children: [- _WorkbenchSection(+ MaterialBottomSheetSection(title: '排序',description: '选择列表优先展示的内容。',icon: Icons.sort_rounded,@@ -655,7 +617,7 @@ class _SearchWorkbenchSheetState extends State<_SearchWorkbenchSheet> {),),const SizedBox(height: 12),- _WorkbenchSection(+ MaterialBottomSheetSection(title: '标签',description: '选择多个标签时,会优先寻找同时包含这些标签的番剧。',icon: Icons.sell_outlined,@@ -739,7 +701,7 @@ class _SearchWorkbenchSheetState extends State<_SearchWorkbenchSheet> {),),const SizedBox(height: 12),- _WorkbenchSection(+ MaterialBottomSheetSection(title: '季度与日期',description: '按播出季度查找,也可以指定更精确的日期范围。',icon: Icons.calendar_month,@@ -803,7 +765,7 @@ class _SearchWorkbenchSheetState extends State<_SearchWorkbenchSheet> {),),const SizedBox(height: 12),- _WorkbenchSection(+ MaterialBottomSheetSection(title: '数值范围',description: '只显示符合评分或排名范围的番剧。',icon: Icons.tune_rounded,@@ -846,7 +808,7 @@ class _SearchWorkbenchSheetState extends State<_SearchWorkbenchSheet> {),),const SizedBox(height: 12),- _WorkbenchSection(+ MaterialBottomSheetSection(title: '星期',description: '按放送星期过滤,多个星期按任一匹配处理。',icon: Icons.today_outlined,@@ -876,7 +838,7 @@ class _SearchWorkbenchSheetState extends State<_SearchWorkbenchSheet> {),),const SizedBox(height: 12),- _WorkbenchSection(+ MaterialBottomSheetSection(title: '过滤',description: '控制是否隐藏已经看过或放弃的番剧。',icon: Icons.filter_alt_outlined,@@ -942,72 +904,6 @@ class _SearchWorkbenchSheetState extends State<_SearchWorkbenchSheet> {}}-class _WorkbenchSection extends StatelessWidget {- const _WorkbenchSection({- required this.title,- required this.description,- required this.icon,- required this.child,- });-- final String title;- final String description;- final IconData icon;- final Widget child;-- @override- Widget build(BuildContext context) {- final colorScheme = Theme.of(context).colorScheme;- final textTheme = Theme.of(context).textTheme;-- return Container(- width: double.infinity,- padding: const EdgeInsets.fromLTRB(18, 16, 18, 18),- decoration: BoxDecoration(- color: colorScheme.surfaceContainerLow,- borderRadius: BorderRadius.circular(24),- border: Border.all(- color: colorScheme.outlineVariant.withValues(alpha: 0.45),- ),- ),- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Row(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Icon(icon, color: colorScheme.primary),- const SizedBox(width: 12),- Expanded(- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Text(- title,- style: textTheme.titleMedium?.copyWith(- fontWeight: FontWeight.w700,- ),- ),- const SizedBox(height: 4),- Text(- description,- style: textTheme.bodySmall?.copyWith(- color: colorScheme.onSurfaceVariant,- ),- ),- ],- ),- ),- ],- ),- const SizedBox(height: 16),- child,- ],- ),- );- }-}-class _SearchSwitchTile extends StatelessWidget {const _SearchSwitchTile({required this.title,diff --git a/lib/pages/settings/danmaku/danmaku_settings_sheet.dart b/lib/pages/settings/danmaku/danmaku_settings_sheet.dartindex dd9a522b..235b5897 100644--- a/lib/pages/settings/danmaku/danmaku_settings_sheet.dart+++ b/lib/pages/settings/danmaku/danmaku_settings_sheet.dart@@ -1,6 +1,7 @@import 'package:canvas_danmaku/canvas_danmaku.dart';import 'package:flutter/material.dart';import 'package:kazumi/bean/dialog/adaptive_bottom_sheet.dart';+import 'package:kazumi/bean/dialog/material_bottom_sheet.dart';import 'package:kazumi/services/storage/storage.dart';import 'package:kazumi/pages/settings/danmaku/danmaku_shield_settings_sheet.dart';import 'package:kazumi/pages/settings/danmaku/danmaku_time_offset_sheet.dart';@@ -69,200 +70,245 @@ class _DanmakuSettingsSheetState extends State<_DanmakuSettingsSheet> {final fontFamily = Theme.of(context).textTheme.bodyMedium?.fontFamily;return SafeArea(bottom: false,- child: SettingsList(- sections: [- SettingsSection(- title: Text('弹幕屏蔽', style: TextStyle(fontFamily: fontFamily)),- tiles: [- SettingsTile.navigation(- onPressed: (_) {- _showDanmakuShieldSheet();- },- title: Text('关键词屏蔽', style: TextStyle(fontFamily: fontFamily)),- ),- ],- ),- SettingsSection(- title: Text('弹幕样式', style: TextStyle(fontFamily: fontFamily)),- tiles: [- SettingsTile(- title: Text('字体大小', style: TextStyle(fontFamily: fontFamily)),- description: Slider(- value: widget.danmakuController.option.fontSize,- min: 10,- max: isCompact() ? 32 : 48,- label:- '${widget.danmakuController.option.fontSize.floorToDouble()}',- onChanged: (value) {- setState(() => widget.danmakuController.updateOption(- widget.danmakuController.option.copyWith(- fontSize: value.floorToDouble(),- ),- ));- GStorage.putSetting<double>(- SettingsKeys.danmakuFontSize, value.floorToDouble());- },- ),- ),- SettingsTile(- title: Text('弹幕不透明度', style: TextStyle(fontFamily: fontFamily)),- description: Slider(- value: widget.danmakuController.option.opacity,- min: 0.1,- max: 1,- label:- '${(widget.danmakuController.option.opacity * 100).round()}%',- onChanged: (value) {- setState(() => widget.danmakuController.updateOption(- widget.danmakuController.option.copyWith(- opacity: value,- ),- ));- GStorage.putSetting<double>(SettingsKeys.danmakuOpacity,- double.parse(value.toStringAsFixed(2)));- },- ),- ),- ],- ),- SettingsSection(- title: Text('弹幕显示', style: TextStyle(fontFamily: fontFamily)),- tiles: [- SettingsTile.navigation(- onPressed: (context) {- Navigator.of(context)- .pop(_DanmakuSettingsDestination.timeOffset);- },- title: Text('时间轴偏移', style: TextStyle(fontFamily: fontFamily)),- value: Text(- formatDanmakuTimeOffset(- normalizeDanmakuTimeOffset(- GStorage.getSetting<double>(- SettingsKeys.danmakuTimeOffset),- ),+ child: Scaffold(+ body: Column(+ children: [+ MaterialBottomSheetHeader(+ title: '弹幕设置',+ description: '调整弹幕显示、样式与屏蔽规则',+ onClose: () => Navigator.of(context).pop(),+ ),+ Expanded(+ child: SettingsList(+ sections: [+ SettingsSection(+ title:+ Text('弹幕屏蔽', style: TextStyle(fontFamily: fontFamily)),+ tiles: [+ SettingsTile.navigation(+ onPressed: (_) {+ _showDanmakuShieldSheet();+ },+ title: Text('关键词屏蔽',+ style: TextStyle(fontFamily: fontFamily)),+ ),+ ],),- style: TextStyle(fontFamily: fontFamily),- ),- ),- SettingsTile(- title: Text('弹幕区域', style: TextStyle(fontFamily: fontFamily)),- description: Slider(- value: widget.danmakuController.option.area,- min: 0,- max: 1,- divisions: 8,- label:- '${(widget.danmakuController.option.area * 100).round()}%',- onChanged: (value) {- setState(() => widget.danmakuController.updateOption(- widget.danmakuController.option.copyWith(- area: value,- ),- ));- GStorage.putSetting<double>(- SettingsKeys.danmakuArea, value);- },- ),- ),- SettingsTile(- title: Text('持续时间', style: TextStyle(fontFamily: fontFamily)),- description: Slider(- value: widget.danmakuController.option.duration.toDouble(),- min: 2,- max: 16,- divisions: 14,- label: '${widget.danmakuController.option.duration.round()}',- onChanged: (value) {- setState(() => widget.danmakuController.updateOption(- widget.danmakuController.option.copyWith(- duration: value,- ),- ));- GStorage.putSetting<double>(- SettingsKeys.danmakuDuration, value.round().toDouble());- },- ),- ),- SettingsTile(- title: Text('行高', style: TextStyle(fontFamily: fontFamily)),- description: Slider(- value: widget.danmakuController.option.lineHeight,- min: 0,- max: 3,- divisions: 30,- label: widget.danmakuController.option.lineHeight- .toStringAsFixed(1),- onChanged: (value) {- setState(() => widget.danmakuController.updateOption(- widget.danmakuController.option.copyWith(- lineHeight: double.parse(value.toStringAsFixed(1)),+ SettingsSection(+ title:+ Text('弹幕样式', style: TextStyle(fontFamily: fontFamily)),+ tiles: [+ SettingsTile(+ title: Text('字体大小',+ style: TextStyle(fontFamily: fontFamily)),+ description: Slider(+ value: widget.danmakuController.option.fontSize,+ min: 10,+ max: isCompact() ? 32 : 48,+ label:+ '${widget.danmakuController.option.fontSize.floorToDouble()}',+ onChanged: (value) {+ setState(+ () => widget.danmakuController.updateOption(+ widget.danmakuController.option.copyWith(+ fontSize: value.floorToDouble(),+ ),+ ));+ GStorage.putSetting<double>(+ SettingsKeys.danmakuFontSize,+ value.floorToDouble());+ },+ ),+ ),+ SettingsTile(+ title: Text('弹幕不透明度',+ style: TextStyle(fontFamily: fontFamily)),+ description: Slider(+ value: widget.danmakuController.option.opacity,+ min: 0.1,+ max: 1,+ label:+ '${(widget.danmakuController.option.opacity * 100).round()}%',+ onChanged: (value) {+ setState(+ () => widget.danmakuController.updateOption(+ widget.danmakuController.option.copyWith(+ opacity: value,+ ),+ ));+ GStorage.putSetting<double>(+ SettingsKeys.danmakuOpacity,+ double.parse(value.toStringAsFixed(2)));+ },+ ),+ ),+ ],+ ),+ SettingsSection(+ title:+ Text('弹幕显示', style: TextStyle(fontFamily: fontFamily)),+ tiles: [+ SettingsTile.navigation(+ onPressed: (context) {+ Navigator.of(context)+ .pop(_DanmakuSettingsDestination.timeOffset);+ },+ title: Text('时间轴偏移',+ style: TextStyle(fontFamily: fontFamily)),+ value: Text(+ formatDanmakuTimeOffset(+ normalizeDanmakuTimeOffset(+ GStorage.getSetting<double>(+ SettingsKeys.danmakuTimeOffset),+ ),),- ));- GStorage.putSetting<double>(SettingsKeys.danmakuLineHeight,- double.parse(value.toStringAsFixed(1)));- },- ),- ),- SettingsTile.switchTile(- onToggle: (value) {- bool show = value ?? widget.danmakuController.option.hideTop;- setState(() => widget.danmakuController.updateOption(- widget.danmakuController.option.copyWith(- hideTop: !show,+ style: TextStyle(fontFamily: fontFamily),),- ));- GStorage.putSetting<bool>(SettingsKeys.danmakuTop, show);- },- title: Text('顶部弹幕', style: TextStyle(fontFamily: fontFamily)),- initialValue: !widget.danmakuController.option.hideTop,- ),- SettingsTile.switchTile(- onToggle: (value) {- bool show =- value ?? widget.danmakuController.option.hideBottom;- setState(() => widget.danmakuController.updateOption(- widget.danmakuController.option.copyWith(- hideBottom: !show,+ ),+ SettingsTile(+ title: Text('弹幕区域',+ style: TextStyle(fontFamily: fontFamily)),+ description: Slider(+ value: widget.danmakuController.option.area,+ min: 0,+ max: 1,+ divisions: 8,+ label:+ '${(widget.danmakuController.option.area * 100).round()}%',+ onChanged: (value) {+ setState(+ () => widget.danmakuController.updateOption(+ widget.danmakuController.option.copyWith(+ area: value,+ ),+ ));+ GStorage.putSetting<double>(+ SettingsKeys.danmakuArea, value);+ },),- ));- GStorage.putSetting<bool>(SettingsKeys.danmakuBottom, show);- },- title: Text('底部弹幕', style: TextStyle(fontFamily: fontFamily)),- initialValue: !widget.danmakuController.option.hideBottom,- ),- SettingsTile.switchTile(- onToggle: (value) {- bool show =- value ?? widget.danmakuController.option.hideScroll;- setState(() => widget.danmakuController.updateOption(- widget.danmakuController.option.copyWith(- hideScroll: !show,+ ),+ SettingsTile(+ title: Text('持续时间',+ style: TextStyle(fontFamily: fontFamily)),+ description: Slider(+ value: widget.danmakuController.option.duration+ .toDouble(),+ min: 2,+ max: 16,+ divisions: 14,+ label:+ '${widget.danmakuController.option.duration.round()}',+ onChanged: (value) {+ setState(+ () => widget.danmakuController.updateOption(+ widget.danmakuController.option.copyWith(+ duration: value,+ ),+ ));+ GStorage.putSetting<double>(+ SettingsKeys.danmakuDuration,+ value.round().toDouble());+ },),- ));- GStorage.putSetting<bool>(SettingsKeys.danmakuScroll, show);- },- title: Text('滚动弹幕', style: TextStyle(fontFamily: fontFamily)),- initialValue: !widget.danmakuController.option.hideScroll,- ),- SettingsTile.switchTile(- onToggle: (value) {- bool followSpeed = value ??- !GStorage.getSetting<bool>(- SettingsKeys.danmakuFollowSpeed);- GStorage.putSetting<bool>(- SettingsKeys.danmakuFollowSpeed, followSpeed);- widget.onUpdateDanmakuSpeed?.call();- setState(() {});- },- title: Text('跟随视频倍速', style: TextStyle(fontFamily: fontFamily)),- description: Text('弹幕速度随视频倍速变化',- style: TextStyle(fontFamily: fontFamily)),- initialValue:- GStorage.getSetting<bool>(SettingsKeys.danmakuFollowSpeed),+ ),+ SettingsTile(+ title: Text('行高',+ style: TextStyle(fontFamily: fontFamily)),+ description: Slider(+ value: widget.danmakuController.option.lineHeight,+ min: 0,+ max: 3,+ divisions: 30,+ label: widget.danmakuController.option.lineHeight+ .toStringAsFixed(1),+ onChanged: (value) {+ setState(() =>+ widget.danmakuController.updateOption(+ widget.danmakuController.option.copyWith(+ lineHeight:+ double.parse(value.toStringAsFixed(1)),+ ),+ ));+ GStorage.putSetting<double>(+ SettingsKeys.danmakuLineHeight,+ double.parse(value.toStringAsFixed(1)));+ },+ ),+ ),+ SettingsTile.switchTile(+ onToggle: (value) {+ bool show =+ value ?? widget.danmakuController.option.hideTop;+ setState(() => widget.danmakuController.updateOption(+ widget.danmakuController.option.copyWith(+ hideTop: !show,+ ),+ ));+ GStorage.putSetting<bool>(+ SettingsKeys.danmakuTop, show);+ },+ title: Text('顶部弹幕',+ style: TextStyle(fontFamily: fontFamily)),+ initialValue: !widget.danmakuController.option.hideTop,+ ),+ SettingsTile.switchTile(+ onToggle: (value) {+ bool show = value ??+ widget.danmakuController.option.hideBottom;+ setState(() => widget.danmakuController.updateOption(+ widget.danmakuController.option.copyWith(+ hideBottom: !show,+ ),+ ));+ GStorage.putSetting<bool>(+ SettingsKeys.danmakuBottom, show);+ },+ title: Text('底部弹幕',+ style: TextStyle(fontFamily: fontFamily)),+ initialValue:+ !widget.danmakuController.option.hideBottom,+ ),+ SettingsTile.switchTile(+ onToggle: (value) {+ bool show = value ??+ widget.danmakuController.option.hideScroll;+ setState(() => widget.danmakuController.updateOption(+ widget.danmakuController.option.copyWith(+ hideScroll: !show,+ ),+ ));+ GStorage.putSetting<bool>(+ SettingsKeys.danmakuScroll, show);+ },+ title: Text('滚动弹幕',+ style: TextStyle(fontFamily: fontFamily)),+ initialValue:+ !widget.danmakuController.option.hideScroll,+ ),+ SettingsTile.switchTile(+ onToggle: (value) {+ bool followSpeed = value ??+ !GStorage.getSetting<bool>(+ SettingsKeys.danmakuFollowSpeed);+ GStorage.putSetting<bool>(+ SettingsKeys.danmakuFollowSpeed, followSpeed);+ widget.onUpdateDanmakuSpeed?.call();+ setState(() {});+ },+ title: Text('跟随视频倍速',+ style: TextStyle(fontFamily: fontFamily)),+ description: Text('弹幕速度随视频倍速变化',+ style: TextStyle(fontFamily: fontFamily)),+ initialValue: GStorage.getSetting<bool>(+ SettingsKeys.danmakuFollowSpeed),+ ),+ ],+ ),+ ],),- ],- ),- ],+ ),+ ],+ ),),);}diff --git a/lib/pages/settings/danmaku/danmaku_shield_settings_sheet.dart b/lib/pages/settings/danmaku/danmaku_shield_settings_sheet.dartindex 31235ea9..beec42bb 100644--- a/lib/pages/settings/danmaku/danmaku_shield_settings_sheet.dart+++ b/lib/pages/settings/danmaku/danmaku_shield_settings_sheet.dart@@ -1,4 +1,5 @@import 'package:flutter/material.dart';+import 'package:kazumi/bean/dialog/material_bottom_sheet.dart';import 'package:kazumi/pages/my/my_controller.dart';import 'package:flutter_mobx/flutter_mobx.dart';import 'package:flutter_modular/flutter_modular.dart';@@ -25,73 +26,85 @@ class _DanmakuShieldSettingsSheetState@overrideWidget build(BuildContext context) {return Scaffold(- appBar: AppBar(- title: const Text("弹幕屏蔽"),- ),- body: ListView(- padding: EdgeInsets.all(12),+ body: Column(children: [- TextField(- controller: textEditingController,- decoration: InputDecoration(- border: const OutlineInputBorder(),- hintText: "输入关键词或正则表达式",- suffixIcon: TextButton.icon(- onPressed: () {- myController.addShieldList(- textEditingController.text.trim(),- );- },- icon: const Icon(Icons.add),- label: const Text("添加"),- ),- ),- onSubmitted: (_) {- myController.addShieldList(- textEditingController.text.trim(),- );- },- ),- SizedBox(height: 12),- Text(- '以"/"开头和结尾将视作正则表达式, 如"/\\d+/"表示屏蔽所有数字',+ MaterialBottomSheetHeader(+ title: '弹幕屏蔽',+ description: '使用关键词或正则表达式过滤弹幕',+ onClose: () => Navigator.of(context).pop(),),- Observer(builder: (context) {- return Text(- "已添加${myController.shieldList.length}个关键词",- );- }),- SizedBox(height: 12),- Observer(builder: (context) {- return Wrap(- runSpacing: 12,- spacing: 12,- children: myController.shieldList- .map(- (item) => Chip(- shape: RoundedRectangleBorder(- borderRadius: BorderRadius.circular(32)),- backgroundColor:- Theme.of(context).colorScheme.secondaryContainer,- materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,- side: BorderSide.none,- label: Text(- item,- style: TextStyle(- fontSize: 14,- ),+ Expanded(+ child: ListView(+ padding: materialBottomSheetContentPadding,+ children: [+ MaterialBottomSheetSection(+ title: '添加屏蔽规则',+ description: '以“/”开头和结尾将视作正则表达式,如“/\\d+/”表示屏蔽所有数字',+ icon: Icons.add_circle_outline_rounded,+ child: TextField(+ controller: textEditingController,+ decoration: InputDecoration(+ border: const OutlineInputBorder(),+ hintText: '输入关键词或正则表达式',+ suffixIcon: TextButton.icon(+ onPressed: () {+ myController.addShieldList(+ textEditingController.text.trim(),+ );+ },+ icon: const Icon(Icons.add),+ label: const Text('添加'),),- padding: EdgeInsets.symmetric(horizontal: 8, vertical: 4),- deleteIcon: Icon(Icons.close, size: 18),- deleteButtonTooltipMessage: '',- onDeleted: () {- myController.removeShieldList(item);- },),- )- .toList(),- );- })+ onSubmitted: (_) {+ myController.addShieldList(+ textEditingController.text.trim(),+ );+ },+ ),+ ),+ const SizedBox(height: 16),+ Observer(builder: (context) {+ return MaterialBottomSheetSection(+ title: '已添加${myController.shieldList.length}个关键词',+ icon: Icons.shield_outlined,+ child: Wrap(+ runSpacing: 12,+ spacing: 12,+ children: myController.shieldList+ .map(+ (item) => Chip(+ shape: RoundedRectangleBorder(+ borderRadius: BorderRadius.circular(32),+ ),+ backgroundColor: Theme.of(context)+ .colorScheme+ .secondaryContainer,+ materialTapTargetSize:+ MaterialTapTargetSize.shrinkWrap,+ side: BorderSide.none,+ label: Text(+ item,+ style: const TextStyle(fontSize: 14),+ ),+ padding: const EdgeInsets.symmetric(+ horizontal: 8,+ vertical: 4,+ ),+ deleteIcon: const Icon(Icons.close, size: 18),+ deleteButtonTooltipMessage: '',+ onDeleted: () {+ myController.removeShieldList(item);+ },+ ),+ )+ .toList(),+ ),+ );+ }),+ ],+ ),+ ),],),);diff --git a/lib/pages/settings/danmaku/danmaku_time_offset_sheet.dart b/lib/pages/settings/danmaku/danmaku_time_offset_sheet.dartindex f4751bb1..ef823e13 100644--- a/lib/pages/settings/danmaku/danmaku_time_offset_sheet.dart+++ b/lib/pages/settings/danmaku/danmaku_time_offset_sheet.dart@@ -1,4 +1,5 @@import 'package:flutter/material.dart';+import 'package:kazumi/bean/dialog/material_bottom_sheet.dart';import 'package:kazumi/services/storage/storage.dart';const double _minDanmakuTimeOffset = -180;@@ -79,130 +80,138 @@ class _DanmakuTimeOffsetSheetState extends State<DanmakuTimeOffsetSheet> {return SafeArea(top: false,- child: SingleChildScrollView(- padding: const EdgeInsets.fromLTRB(24, 20, 24, 24),- child: Column(- mainAxisSize: MainAxisSize.min,- crossAxisAlignment: CrossAxisAlignment.start,+ child: Scaffold(+ body: Column(children: [- Text(- '弹幕时间轴偏移',- style: theme.textTheme.titleLarge?.copyWith(- fontFamily: fontFamily,- fontWeight: FontWeight.w600,- ),+ MaterialBottomSheetHeader(+ title: '弹幕时间轴偏移',+ description: '校准弹幕相对于视频画面的显示时间',+ onClose: () => Navigator.of(context).pop(),),- const SizedBox(height: 24),- Container(- width: double.infinity,- padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 20),- decoration: BoxDecoration(- color: colorScheme.secondaryContainer,- borderRadius: BorderRadius.circular(28),- ),- child: Column(- children: [- Text(- direction,- style: theme.textTheme.titleMedium?.copyWith(- color: colorScheme.onSecondaryContainer,- fontFamily: fontFamily,- fontWeight: FontWeight.w600,+ Expanded(+ child: SingleChildScrollView(+ padding: materialBottomSheetContentPadding,+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Container(+ width: double.infinity,+ padding: const EdgeInsets.symmetric(+ horizontal: 24, vertical: 20),+ decoration: BoxDecoration(+ color: colorScheme.secondaryContainer,+ borderRadius: BorderRadius.circular(28),+ ),+ child: Column(+ children: [+ Text(+ direction,+ style: theme.textTheme.titleMedium?.copyWith(+ color: colorScheme.onSecondaryContainer,+ fontFamily: fontFamily,+ fontWeight: FontWeight.w600,+ ),+ ),+ const SizedBox(height: 4),+ Text(+ _formatDanmakuOffsetDuration(_offset),+ style: theme.textTheme.displaySmall?.copyWith(+ color: colorScheme.onSecondaryContainer,+ fontFamily: fontFamily,+ fontFeatures: const [+ FontFeature.tabularFigures()+ ],+ fontWeight: FontWeight.w500,+ ),+ ),+ ],+ ),),- ),- const SizedBox(height: 4),- Text(- _formatDanmakuOffsetDuration(_offset),- style: theme.textTheme.displaySmall?.copyWith(- color: colorScheme.onSecondaryContainer,- fontFamily: fontFamily,- fontFeatures: const [FontFeature.tabularFigures()],- fontWeight: FontWeight.w500,+ const SizedBox(height: 24),+ Row(+ children: [+ Text(+ '提前 3:00',+ style: theme.textTheme.labelMedium?.copyWith(+ color: colorScheme.onSurfaceVariant,+ fontFamily: fontFamily,+ ),+ ),+ const Spacer(),+ Text(+ '延后 3:00',+ style: theme.textTheme.labelMedium?.copyWith(+ color: colorScheme.onSurfaceVariant,+ fontFamily: fontFamily,+ ),+ ),+ ],),- ),- ],- ),- ),- const SizedBox(height: 24),- Row(- children: [- Text(- '提前 3:00',- style: theme.textTheme.labelMedium?.copyWith(- color: colorScheme.onSurfaceVariant,- fontFamily: fontFamily,- ),- ),- const Spacer(),- Text(- '延后 3:00',- style: theme.textTheme.labelMedium?.copyWith(- color: colorScheme.onSurfaceVariant,- fontFamily: fontFamily,- ),- ),- ],- ),- Slider(- value: _offset,- min: _minDanmakuTimeOffset,- max: _maxDanmakuTimeOffset,- divisions: _danmakuTimeOffsetDivisions,- label: formatDanmakuTimeOffset(_offset),- onChanged: _updateOffset,- ),- const SizedBox(height: 12),- LayoutBuilder(- builder: (context, constraints) {- final advanceButton = SizedBox(- width: double.infinity,- height: 56,- child: FilledButton.tonalIcon(- onPressed: _offset > _minDanmakuTimeOffset- ? () => _updateOffset(_offset - 1)- : null,- icon: const Icon(Icons.remove_rounded),- label: const Text('提前 1 秒'),- ),- );- final delayButton = SizedBox(- width: double.infinity,- height: 56,- child: FilledButton.tonalIcon(- onPressed: _offset < _maxDanmakuTimeOffset- ? () => _updateOffset(_offset + 1)- : null,- icon: const Icon(Icons.add_rounded),- label: const Text('延后 1 秒'),- ),- );+ Slider(+ value: _offset,+ min: _minDanmakuTimeOffset,+ max: _maxDanmakuTimeOffset,+ divisions: _danmakuTimeOffsetDivisions,+ label: formatDanmakuTimeOffset(_offset),+ onChanged: _updateOffset,+ ),+ const SizedBox(height: 12),+ LayoutBuilder(+ builder: (context, constraints) {+ final advanceButton = SizedBox(+ width: double.infinity,+ height: 56,+ child: FilledButton.tonalIcon(+ onPressed: _offset > _minDanmakuTimeOffset+ ? () => _updateOffset(_offset - 1)+ : null,+ icon: const Icon(Icons.remove_rounded),+ label: const Text('提前 1 秒'),+ ),+ );+ final delayButton = SizedBox(+ width: double.infinity,+ height: 56,+ child: FilledButton.tonalIcon(+ onPressed: _offset < _maxDanmakuTimeOffset+ ? () => _updateOffset(_offset + 1)+ : null,+ icon: const Icon(Icons.add_rounded),+ label: const Text('延后 1 秒'),+ ),+ );- if (constraints.maxWidth < 360) {- return Column(- children: [- advanceButton,- const SizedBox(height: 12),- delayButton,- ],- );- }- return Row(- children: [- Expanded(child: advanceButton),- const SizedBox(width: 12),- Expanded(child: delayButton),+ if (constraints.maxWidth < 360) {+ return Column(+ children: [+ advanceButton,+ const SizedBox(height: 12),+ delayButton,+ ],+ );+ }+ return Row(+ children: [+ Expanded(child: advanceButton),+ const SizedBox(width: 12),+ Expanded(child: delayButton),+ ],+ );+ },+ ),+ const SizedBox(height: 12),+ SizedBox(+ width: double.infinity,+ height: 52,+ child: OutlinedButton.icon(+ onPressed: _offset != 0 ? () => _updateOffset(0) : null,+ icon: const Icon(Icons.restart_alt_rounded),+ label: const Text('恢复无偏移'),+ ),+ ),],- );- },- ),- const SizedBox(height: 12),- SizedBox(- width: double.infinity,- height: 52,- child: OutlinedButton.icon(- onPressed: _offset != 0 ? () => _updateOffset(0) : null,- icon: const Icon(Icons.restart_alt_rounded),- label: const Text('恢复无偏移'),+ ),),),],diff --git a/lib/pages/timeline/timeline_page.dart b/lib/pages/timeline/timeline_page.dartindex 813d6edd..8764ec52 100644--- a/lib/pages/timeline/timeline_page.dart+++ b/lib/pages/timeline/timeline_page.dart@@ -4,6 +4,7 @@ import 'package:flutter_modular/flutter_modular.dart';import 'package:kazumi/modules/bangumi/bangumi_item.dart';import 'package:kazumi/pages/timeline/timeline_controller.dart';import 'package:kazumi/bean/dialog/adaptive_bottom_sheet.dart';+import 'package:kazumi/bean/dialog/material_bottom_sheet.dart';import 'package:kazumi/bean/card/bangumi_timeline_card.dart';import 'package:kazumi/utils/constants.dart';import 'package:kazumi/services/storage/storage.dart';@@ -121,64 +122,6 @@ class _TimelinePageState extends State<TimelinePage>);}- Widget buildTimelineBottomSheetHeaderCard(- BuildContext context, {- required String title,- required String description,- required Widget footer,- }) {- final colorScheme = Theme.of(context).colorScheme;- final textTheme = Theme.of(context).textTheme;-- return Container(- width: double.infinity,- padding: const EdgeInsets.fromLTRB(20, 18, 16, 18),- decoration: BoxDecoration(- color: colorScheme.surfaceContainerLow,- borderRadius: BorderRadius.circular(24),- ),- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Row(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Expanded(- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Text(- title,- style: textTheme.headlineSmall?.copyWith(- color: colorScheme.onSurface,- fontWeight: FontWeight.w700,- ),- ),- const SizedBox(height: 6),- Text(- description,- style: textTheme.bodyMedium?.copyWith(- color: colorScheme.onSurfaceVariant,- ),- ),- ],- ),- ),- const SizedBox(width: 12),- IconButton.filledTonal(- onPressed: KazumiDialog.dismiss,- tooltip: '关闭',- icon: const Icon(Icons.close),- ),- ],- ),- const SizedBox(height: 16),- footer,- ],- ),- );- }-Widget buildTimelineBottomSheetShell(BuildContext context, {required Widget header,@@ -194,10 +137,7 @@ class _TimelinePageState extends State<TimelinePage>child: Column(mainAxisSize: MainAxisSize.min,children: [- Padding(- padding: const EdgeInsets.fromLTRB(16, 16, 16, 8),- child: header,- ),+ header,Flexible(child: body),],),@@ -270,10 +210,10 @@ class _TimelinePageState extends State<TimelinePage>final colorScheme = Theme.of(context).colorScheme;final textTheme = Theme.of(context).textTheme;- return buildTimelineBottomSheetHeaderCard(- context,+ return MaterialBottomSheetHeader(title: '时间机器',description: '按季度回到任意放送季,时间线会立即切换。',+ onClose: KazumiDialog.dismiss,footer: Container(padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10),decoration: BoxDecoration(@@ -487,10 +427,10 @@ class _TimelinePageState extends State<TimelinePage>}Widget buildTimelineOptionsSheetHeader(BuildContext context) {- return buildTimelineBottomSheetHeaderCard(- context,+ return MaterialBottomSheetHeader(title: '时间线选项',description: '调整排序和过滤条件,结果会立即应用到当前时间线。',+ onClose: KazumiDialog.dismiss,footer: Observer(builder: (context) {final enabledFilterCount = getEnabledTimelineFilterCount();@@ -517,51 +457,6 @@ class _TimelinePageState extends State<TimelinePage>);}- Widget buildTimelineOptionSection(- BuildContext context, {- required String title,- required String description,- required Widget child,- Key? sectionKey,- }) {- final colorScheme = Theme.of(context).colorScheme;- final textTheme = Theme.of(context).textTheme;-- return Container(- key: sectionKey,- width: double.infinity,- padding: const EdgeInsets.fromLTRB(20, 18, 20, 20),- decoration: BoxDecoration(- color: colorScheme.surfaceContainerLow,- borderRadius: BorderRadius.circular(24),- border: Border.all(- color: colorScheme.outlineVariant.withValues(alpha: 0.5),- ),- ),- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Text(- title,- style: textTheme.titleMedium?.copyWith(- color: colorScheme.onSurface,- fontWeight: FontWeight.w700,- ),- ),- const SizedBox(height: 4),- Text(- description,- style: textTheme.bodyMedium?.copyWith(- color: colorScheme.onSurfaceVariant,- ),- ),- const SizedBox(height: 16),- child,- ],- ),- );- }-Widget buildSortOptionTile(BuildContext context, {required int sortType,@@ -688,9 +583,8 @@ class _TimelinePageState extends State<TimelinePage>}Widget showFilterSwitcher() {- return buildTimelineOptionSection(- context,- sectionKey: filterSectionKey,+ return MaterialBottomSheetSection(+ key: filterSectionKey,title: '过滤器',description: '按收藏状态收起不需要显示的条目,支持连续调整。',child: Column(@@ -739,8 +633,7 @@ class _TimelinePageState extends State<TimelinePage>}Widget showSortSwitcher() {- return buildTimelineOptionSection(- context,+ return MaterialBottomSheetSection(title: '排序方式',description: '选择每一天内番剧卡片的排列方式。',child: Column(diff --git a/lib/pages/video/video_page.dart b/lib/pages/video/video_page.dartindex 92203dce..5fb56d31 100644--- a/lib/pages/video/video_page.dart+++ b/lib/pages/video/video_page.dart@@ -14,6 +14,7 @@ import 'package:kazumi/services/player/pip_utils.dart';import 'package:kazumi/bean/appbar/drag_to_move_bar.dart' as dtb;import 'package:kazumi/bean/dialog/adaptive_bottom_sheet.dart';import 'package:kazumi/bean/dialog/dialog_helper.dart';+import 'package:kazumi/bean/dialog/material_bottom_sheet.dart';import 'package:screen_brightness_platform_interface/screen_brightness_platform_interface.dart';import 'package:scrollview_observer/scrollview_observer.dart';import 'package:kazumi/pages/player/episode_comments_sheet.dart';@@ -550,43 +551,42 @@ class _VideoPageState extends State<VideoPage>await showAdaptiveBottomSheet<DanmakuDestination>(context: context,builder: (context) {- final theme = Theme.of(context);return Padding(- padding: const EdgeInsets.fromLTRB(16, 20, 16, 16),+ padding: const EdgeInsets.only(bottom: 16),child: Column(mainAxisSize: MainAxisSize.min,crossAxisAlignment: CrossAxisAlignment.start,children: [- Padding(- padding: const EdgeInsets.symmetric(horizontal: 8),- child: Text(- '发送弹幕至',- style: theme.textTheme.titleLarge?.copyWith(- fontWeight: FontWeight.w600,- ),- ),+ MaterialBottomSheetHeader(+ title: '发送弹幕至',+ description: '选择这条弹幕的发送位置',+ onClose: () => Navigator.of(context).pop(),),- const SizedBox(height: 12),- ListTile(- leading: const Icon(Icons.groups_rounded),- title: const Text('发送到聊天室'),- subtitle: const Text('同步观看成员均可看到'),- shape: RoundedRectangleBorder(- borderRadius: BorderRadius.circular(16),- ),- onTap: () =>- Navigator.of(context).pop(DanmakuDestination.chatRoom),- ),- const SizedBox(height: 4),- ListTile(- leading: const Icon(Icons.cloud_upload_rounded),- title: const Text('发送到远程弹幕库'),- subtitle: const Text('作为视频弹幕发送'),- shape: RoundedRectangleBorder(- borderRadius: BorderRadius.circular(16),+ Padding(+ padding: const EdgeInsets.symmetric(horizontal: 16),+ child: MaterialBottomSheetGroup(+ title: '发送位置',+ children: [+ ListTile(+ contentPadding:+ const EdgeInsets.symmetric(horizontal: 16),+ leading: const Icon(Icons.groups_rounded),+ title: const Text('发送到聊天室'),+ subtitle: const Text('同步观看成员均可看到'),+ onTap: () => Navigator.of(context)+ .pop(DanmakuDestination.chatRoom),+ ),+ ListTile(+ contentPadding:+ const EdgeInsets.symmetric(horizontal: 16),+ leading: const Icon(Icons.cloud_upload_rounded),+ title: const Text('发送到远程弹幕库'),+ subtitle: const Text('作为视频弹幕发送'),+ onTap: () => Navigator.of(context)+ .pop(DanmakuDestination.remoteDanmaku),+ ),+ ],),- onTap: () =>- Navigator.of(context).pop(DanmakuDestination.remoteDanmaku),),],),@@ -1232,11 +1232,10 @@ class _VideoPageState extends State<VideoPage>onPressed: () {showAdaptiveBottomSheet<void>(context: context,- builder: (context) =>- DownloadEpisodeSheet(- road: visibleRoad,- videoPageController: videoPageController,- ),+ builder: (context) => DownloadEpisodeSheet(+ road: visibleRoad,+ videoPageController: videoPageController,+ ),);},),