From 510bfe01becee846493ebeebee45c3d933d62d2d Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Sun, 12 Oct 2025 20:56:19 +0800 Subject: [PATCH] opt btn Signed-off-by: bggRGjQaUbCoE --- lib/common/widgets/button/icon_button.dart | 41 ++++++------------- lib/common/widgets/image/image_save.dart | 16 +++----- lib/pages/audio/view.dart | 4 +- .../publish/common_rich_text_pub_page.dart | 6 +-- lib/pages/dynamics_create/view.dart | 7 +--- lib/pages/dynamics_create_vote/view.dart | 4 +- lib/pages/emote/view.dart | 4 +- lib/pages/episode_panel/view.dart | 41 +++++++++++-------- lib/pages/fav/article/widget/item.dart | 4 +- lib/pages/fav/note/child_view.dart | 2 +- lib/pages/fav/pgc/child_view.dart | 2 +- lib/pages/fav/pgc/widget/item.dart | 4 +- lib/pages/fav_detail/view.dart | 13 +++--- .../fav_detail/widget/fav_video_card.dart | 4 +- .../later/widgets/video_card_h_later.dart | 4 +- lib/pages/live/view.dart | 2 +- lib/pages/live_area/view.dart | 16 +++++--- lib/pages/live_area_detail/view.dart | 4 +- lib/pages/live_room/view.dart | 3 +- lib/pages/login/controller.dart | 4 +- lib/pages/member_cheese/widgets/item.dart | 4 +- lib/pages/pgc_review/post/view.dart | 10 ++--- lib/pages/save_panel/view.dart | 11 +++-- lib/pages/setting/view.dart | 22 +++++----- lib/pages/share/view.dart | 3 +- lib/pages/video/introduction/pgc/view.dart | 13 ++++-- .../pgc/widgets/intro_detail.dart | 11 ++--- lib/pages/video/medialist/view.dart | 10 ++--- lib/pages/video/member/view.dart | 2 +- lib/pages/video/note/view.dart | 9 ++-- lib/pages/video/post_panel/view.dart | 16 ++++---- lib/pages/video/send_danmaku/view.dart | 12 ++---- lib/pages/video/view_point/view.dart | 2 +- lib/pages/video/widgets/header_control.dart | 33 +++++++++------ 34 files changed, 154 insertions(+), 189 deletions(-) diff --git a/lib/common/widgets/button/icon_button.dart b/lib/common/widgets/button/icon_button.dart index 3476c302..e3778a0c 100644 --- a/lib/common/widgets/button/icon_button.dart +++ b/lib/common/widgets/button/icon_button.dart @@ -1,50 +1,35 @@ import 'package:flutter/material.dart'; Widget iconButton({ - required BuildContext context, + BuildContext? context, String? tooltip, - required IconData icon, + required Icon icon, required VoidCallback? onPressed, double size = 36, double? iconSize, Color? bgColor, Color? iconColor, }) { - late final theme = Theme.of(context); + Color? backgroundColor = bgColor; + Color? foregroundColor = iconColor; + if (context != null) { + final colorScheme = ColorScheme.of(context); + backgroundColor = colorScheme.secondaryContainer; + foregroundColor = colorScheme.onSecondaryContainer; + } return SizedBox( width: size, height: size, child: IconButton( + icon: icon, tooltip: tooltip, onPressed: onPressed, - icon: Icon( - icon, - size: iconSize ?? size / 2, - color: iconColor ?? theme.colorScheme.onSecondaryContainer, - ), style: IconButton.styleFrom( padding: EdgeInsets.zero, - backgroundColor: bgColor ?? theme.colorScheme.secondaryContainer, + iconSize: iconSize ?? size / 2, + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, ), ), ); } - -Widget mediumButton({ - String? tooltip, - IconData? icon, - VoidCallback? onPressed, -}) { - return SizedBox( - width: 34, - height: 34, - child: IconButton( - tooltip: tooltip, - icon: Icon(icon), - style: const ButtonStyle( - padding: WidgetStatePropertyAll(EdgeInsets.zero), - ), - onPressed: onPressed, - ), - ); -} diff --git a/lib/common/widgets/image/image_save.dart b/lib/common/widgets/image/image_save.dart index 380644b8..9718d25a 100644 --- a/lib/common/widgets/image/image_save.dart +++ b/lib/common/widgets/image/image_save.dart @@ -19,20 +19,16 @@ void imageSaveDialog({ animationType: SmartAnimationType.centerScale_otherSlide, builder: (context) { final theme = Theme.of(context); - late final iconColor = theme.colorScheme.onSurfaceVariant; Widget iconBtn({ String? tooltip, - required IconData icon, + required Icon icon, required VoidCallback? onPressed, }) { return iconButton( - context: context, - onPressed: onPressed, - iconSize: 20, icon: icon, - bgColor: Colors.transparent, - iconColor: iconColor, + iconSize: 20, + onPressed: onPressed, ); } @@ -105,7 +101,7 @@ void imageSaveDialog({ (res) => SmartDialog.showToast(res['msg']), ), }, - icon: Icons.watch_later_outlined, + icon: const Icon(Icons.watch_later_outlined), ), if (cover?.isNotEmpty == true) ...[ if (Utils.isMobile) @@ -115,7 +111,7 @@ void imageSaveDialog({ SmartDialog.dismiss(); ImageUtils.onShareImg(cover!); }, - icon: Icons.share, + icon: const Icon(Icons.share), ), iconBtn( tooltip: '保存封面图', @@ -128,7 +124,7 @@ void imageSaveDialog({ SmartDialog.dismiss(); } }, - icon: Icons.download, + icon: const Icon(Icons.download), ), ], ], diff --git a/lib/pages/audio/view.dart b/lib/pages/audio/view.dart index 78cb8ceb..252cb5cf 100644 --- a/lib/pages/audio/view.dart +++ b/lib/pages/audio/view.dart @@ -248,8 +248,7 @@ class _AudioPageState extends State { trailing: isCurr ? null : iconButton( - context: context, - icon: Icons.clear, + icon: const Icon(Icons.clear), onPressed: () { if (index < _controller.index!) { _controller.index -= 1; @@ -260,7 +259,6 @@ class _AudioPageState extends State { (context as Element) .markNeedsBuild(); }, - bgColor: Colors.transparent, iconColor: colorScheme.outline, size: 28, iconSize: 18, diff --git a/lib/pages/common/publish/common_rich_text_pub_page.dart b/lib/pages/common/publish/common_rich_text_pub_page.dart index 7a4a1012..1d186299 100644 --- a/lib/pages/common/publish/common_rich_text_pub_page.dart +++ b/lib/pages/common/publish/common_rich_text_pub_page.dart @@ -124,8 +124,7 @@ abstract class CommonRichTextPubPageState top: 34, right: 5, child: iconButton( - context: context, - icon: Icons.edit, + icon: const Icon(Icons.edit), onPressed: () => onCropImage(index), size: 24, iconSize: 14, @@ -136,8 +135,7 @@ abstract class CommonRichTextPubPageState top: 5, right: 5, child: iconButton( - context: context, - icon: Icons.clear, + icon: const Icon(Icons.clear), onPressed: onClear, size: 24, iconSize: 14, diff --git a/lib/pages/dynamics_create/view.dart b/lib/pages/dynamics_create/view.dart index f210094b..cc86f4d3 100644 --- a/lib/pages/dynamics_create/view.dart +++ b/lib/pages/dynamics_create/view.dart @@ -171,8 +171,7 @@ class _CreateDynPanelState extends CommonRichTextPubPageState { iconButton( size: 22, iconSize: 16, - context: context, - icon: Icons.clear, + icon: const Icon(Icons.clear), bgColor: theme.colorScheme.onInverseSurface, iconColor: theme.colorScheme.onSurfaceVariant, onPressed: () => topic.value = null, @@ -804,12 +803,10 @@ class _CreateDynPanelState extends CommonRichTextPubPageState { right: 18, top: 2, child: iconButton( - context: context, size: 30, iconSize: 18, - icon: Icons.clear, + icon: const Icon(Icons.clear), onPressed: () => _reserveCard.value = null, - bgColor: Colors.transparent, iconColor: theme.colorScheme.onSurfaceVariant, ), ), diff --git a/lib/pages/dynamics_create_vote/view.dart b/lib/pages/dynamics_create_vote/view.dart index 326e21f0..ef8264a7 100644 --- a/lib/pages/dynamics_create_vote/view.dart +++ b/lib/pages/dynamics_create_vote/view.dart @@ -324,10 +324,8 @@ class _CreateVotePageState extends State { size: 26, iconSize: 18, tooltip: '移除', - context: context, - icon: Icons.clear, + icon: const Icon(Icons.clear), onPressed: onDel, - bgColor: Colors.transparent, iconColor: theme.colorScheme.onSurfaceVariant, ), ], diff --git a/lib/pages/emote/view.dart b/lib/pages/emote/view.dart index 7ceb1910..cdb6a557 100644 --- a/lib/pages/emote/view.dart +++ b/lib/pages/emote/view.dart @@ -175,8 +175,6 @@ class _EmotePanelState extends State iconSize: 20, iconColor: theme.colorScheme.onSurfaceVariant .withValues(alpha: 0.8), - bgColor: Colors.transparent, - context: context, onPressed: () { final isDark = Get.isDarkMode; Get.toNamed( @@ -187,7 +185,7 @@ class _EmotePanelState extends State }, ); }, - icon: Icons.settings, + icon: const Icon(Icons.settings), ), ), Expanded( diff --git a/lib/pages/episode_panel/view.dart b/lib/pages/episode_panel/view.dart index 172b1071..5c927037 100644 --- a/lib/pages/episode_panel/view.dart +++ b/lib/pages/episode_panel/view.dart @@ -574,11 +574,12 @@ class _EpisodePanelState extends State Widget _buildFavBtn(LoadingState loadingState) { return switch (loadingState) { - Success(:var response) => mediumButton( + Success(:var response) => iconButton( + iconSize: 22, tooltip: response ? '取消订阅' : '订阅', icon: response - ? Icons.notifications_off_outlined - : Icons.notifications_active_outlined, + ? const Icon(Icons.notifications_off_outlined) + : const Icon(Icons.notifications_active_outlined), onPressed: () async { var result = await FavHttp.seasonFav( isFav: response, @@ -596,11 +597,12 @@ class _EpisodePanelState extends State }; } - Widget get _buildReverseBtn => mediumButton( + Widget get _buildReverseBtn => iconButton( + iconSize: 22, tooltip: widget.isReversed == true ? '正序播放' : '倒序播放', icon: widget.isReversed == true - ? MdiIcons.sortDescending - : MdiIcons.sortAscending, + ? const Icon(MdiIcons.sortDescending) + : const Icon(MdiIcons.sortAscending), onPressed: () => widget.onReverse?.call(), ); @@ -632,19 +634,22 @@ class _EpisodePanelState extends State style: theme.textTheme.titleMedium, ), if (_favState != null) Obx(() => _buildFavBtn(_favState!.value)), - mediumButton( + iconButton( + iconSize: 22, tooltip: '跳至顶部', - icon: Icons.vertical_align_top, + icon: const Icon(Icons.vertical_align_top), onPressed: _animToTopOrBottom, ), - mediumButton( + iconButton( + iconSize: 22, tooltip: '跳至底部', - icon: Icons.vertical_align_bottom, + icon: const Icon(Icons.vertical_align_bottom), onPressed: () => _animToTopOrBottom(top: false), ), - mediumButton( + iconButton( + iconSize: 22, tooltip: '跳至当前', - icon: Icons.my_location, + icon: const Icon(Icons.my_location), onPressed: () async { final currentTabIndex = _currentTabIndex.value; if (currentTabIndex != widget.initialTabIndex) { @@ -669,11 +674,12 @@ class _EpisodePanelState extends State Obx( () { final currentTabIndex = _currentTabIndex.value; - return mediumButton( + return iconButton( + iconSize: 22, tooltip: _isReversed[currentTabIndex] ? '顺序' : '倒序', icon: !_isReversed[currentTabIndex] - ? MdiIcons.sortNumericAscending - : MdiIcons.sortNumericDescending, + ? const Icon(MdiIcons.sortNumericAscending) + : const Icon(MdiIcons.sortNumericDescending), onPressed: () => setState(() { _isReversed[currentTabIndex] = !_isReversed[currentTabIndex]; }), @@ -681,9 +687,10 @@ class _EpisodePanelState extends State }, ), if (widget.onClose != null) - mediumButton( + iconButton( + iconSize: 22, tooltip: '关闭', - icon: Icons.close, + icon: const Icon(Icons.close), onPressed: widget.onClose, ), ], diff --git a/lib/pages/fav/article/widget/item.dart b/lib/pages/fav/article/widget/item.dart index 30649150..9ad12f7e 100644 --- a/lib/pages/fav/article/widget/item.dart +++ b/lib/pages/fav/article/widget/item.dart @@ -117,11 +117,9 @@ class FavArticleItem extends StatelessWidget { bottom: -6, child: iconButton( iconSize: 18, - context: context, onPressed: onDelete, - icon: Icons.clear, + icon: const Icon(Icons.clear), iconColor: theme.colorScheme.outline, - bgColor: Colors.transparent, ), ), ], diff --git a/lib/pages/fav/note/child_view.dart b/lib/pages/fav/note/child_view.dart index 14881c2d..b333ffaf 100644 --- a/lib/pages/fav/note/child_view.dart +++ b/lib/pages/fav/note/child_view.dart @@ -79,7 +79,7 @@ class _FavNoteChildPageState extends State size: 32, tooltip: '取消', context: context, - icon: Icons.clear, + icon: const Icon(Icons.clear), onPressed: _favNoteController.onDisable, ), const SizedBox(width: 12), diff --git a/lib/pages/fav/pgc/child_view.dart b/lib/pages/fav/pgc/child_view.dart index fdc4f064..e25b38bf 100644 --- a/lib/pages/fav/pgc/child_view.dart +++ b/lib/pages/fav/pgc/child_view.dart @@ -85,7 +85,7 @@ class _FavPgcChildPageState extends State size: 32, tooltip: '取消', context: context, - icon: Icons.clear, + icon: const Icon(Icons.clear), onPressed: _favPgcController.onDisable, ), const SizedBox(width: 12), diff --git a/lib/pages/fav/pgc/widget/item.dart b/lib/pages/fav/pgc/widget/item.dart index 1a41b566..06c8fbf9 100644 --- a/lib/pages/fav/pgc/widget/item.dart +++ b/lib/pages/fav/pgc/widget/item.dart @@ -140,11 +140,9 @@ class FavPgcItem extends StatelessWidget { bottom: 0, child: iconButton( iconSize: 18, - context: context, onPressed: onUpdateStatus, - icon: Icons.more_vert, + icon: const Icon(Icons.more_vert), iconColor: theme.colorScheme.outline, - bgColor: Colors.transparent, ), ), ], diff --git a/lib/pages/fav_detail/view.dart b/lib/pages/fav_detail/view.dart index 89d83a29..a98c1a98 100644 --- a/lib/pages/fav_detail/view.dart +++ b/lib/pages/fav_detail/view.dart @@ -399,24 +399,25 @@ class _FavDetailPageState extends State with GridMixin { right: 6, top: 6, child: Obx(() { - if (_favDetailController.isOwner) { + if (_favDetailController.isOwner || + _favDetailController.loadingState.value + is! Success) { return const SizedBox.shrink(); } bool isFav = folderInfo.favState == 1; return iconButton( - context: context, size: 28, iconSize: 18, tooltip: '${isFav ? '取消' : ''}收藏', onPressed: () => _favDetailController.onFav(isFav), icon: isFav - ? Icons.favorite - : Icons.favorite_border, + ? const Icon(Icons.favorite) + : const Icon(Icons.favorite_border), bgColor: isFav - ? null + ? theme.colorScheme.secondaryContainer : theme.colorScheme.onInverseSurface, iconColor: isFav - ? null + ? theme.colorScheme.onSecondaryContainer : theme.colorScheme.onSurfaceVariant, ); }), diff --git a/lib/pages/fav_detail/widget/fav_video_card.dart b/lib/pages/fav_detail/widget/fav_video_card.dart index 2a0ba144..b08b03ae 100644 --- a/lib/pages/fav_detail/widget/fav_video_card.dart +++ b/lib/pages/fav_detail/widget/fav_video_card.dart @@ -212,11 +212,9 @@ class FavVideoCardH extends StatelessWidget { right: 0, bottom: -8, child: iconButton( - context: context, - icon: Icons.clear, + icon: const Icon(Icons.clear), tooltip: '取消收藏', iconColor: theme.colorScheme.outline, - bgColor: Colors.transparent, onPressed: () => showDialog( context: context, builder: (context) { diff --git a/lib/pages/later/widgets/video_card_h_later.dart b/lib/pages/later/widgets/video_card_h_later.dart index 8307e913..fbadb660 100644 --- a/lib/pages/later/widgets/video_card_h_later.dart +++ b/lib/pages/later/widgets/video_card_h_later.dart @@ -258,11 +258,9 @@ class VideoCardHLater extends StatelessWidget { bottom: -8, child: iconButton( tooltip: '移除', - context: context, onPressed: () => ctr.toViewDel(context, index, videoItem.aid), - icon: Icons.clear, + icon: const Icon(Icons.clear), iconColor: theme.colorScheme.outline, - bgColor: Colors.transparent, ), ), ], diff --git a/lib/pages/live/view.dart b/lib/pages/live/view.dart index baa60976..b21e20ce 100644 --- a/lib/pages/live/view.dart +++ b/lib/pages/live/view.dart @@ -129,7 +129,7 @@ class _LivePageState extends CommonPageState iconSize: 16, context: context, tooltip: '全部标签', - icon: Icons.widgets, + icon: const Icon(Icons.widgets), onPressed: () => Get.to(const LiveAreaPage()), ), ], diff --git a/lib/pages/live_area/view.dart b/lib/pages/live_area/view.dart index 91721532..3096cbdb 100644 --- a/lib/pages/live_area/view.dart +++ b/lib/pages/live_area/view.dart @@ -286,10 +286,15 @@ class _LiveAreaPageState extends State { return iconButton( size: 17, iconSize: 13, - context: context, - icon: isFav ? MdiIcons.check : MdiIcons.plus, - bgColor: isFav ? theme.colorScheme.onInverseSurface : null, - iconColor: isFav ? theme.colorScheme.outline : null, + icon: isFav + ? const Icon(MdiIcons.check) + : const Icon(MdiIcons.plus), + bgColor: isFav + ? theme.colorScheme.onInverseSurface + : theme.colorScheme.secondaryContainer, + iconColor: isFav + ? theme.colorScheme.outline + : theme.colorScheme.onSecondaryContainer, onPressed: onPressed, ); } @@ -350,8 +355,7 @@ class _LiveAreaPageState extends State { return iconButton( size: 16, iconSize: 12, - context: context, - icon: Icons.horizontal_rule, + icon: const Icon(Icons.horizontal_rule), bgColor: isDark ? theme.colorScheme.error : theme.colorScheme.errorContainer, diff --git a/lib/pages/live_area_detail/view.dart b/lib/pages/live_area_detail/view.dart index cd04ebb7..d52a599d 100644 --- a/lib/pages/live_area_detail/view.dart +++ b/lib/pages/live_area_detail/view.dart @@ -101,9 +101,7 @@ class _LiveAreaDetailPageState extends State { ), ), iconButton( - context: context, - icon: Icons.menu, - bgColor: Colors.transparent, + icon: const Icon(Icons.menu), onPressed: () => _showTags(context, theme, bottom, response), ), diff --git a/lib/pages/live_room/view.dart b/lib/pages/live_room/view.dart index 0a4200ec..2b60f176 100644 --- a/lib/pages/live_room/view.dart +++ b/lib/pages/live_room/view.dart @@ -321,10 +321,9 @@ class _LiveRoomPageState extends State child: iconButton( size: 24, iconSize: 14, - context: context, bgColor: const Color(0xEEFFFFFF), iconColor: Colors.black54, - icon: Icons.clear, + icon: const Icon(Icons.clear), onPressed: () => _liveRoomController.fsSC.value = null, ), diff --git a/lib/pages/login/controller.dart b/lib/pages/login/controller.dart index b1cd4dd0..88dbe5c2 100644 --- a/lib/pages/login/controller.dart +++ b/lib/pages/login/controller.dart @@ -374,10 +374,8 @@ class LoginPageController extends GetxController hintText: "请输入短信验证码", hintStyle: const TextStyle(fontSize: 15), suffixIcon: iconButton( - context: Get.context!, - icon: Icons.clear, + icon: const Icon(Icons.clear), size: 32, - bgColor: Colors.transparent, onPressed: textFieldController.clear, ), suffixIconConstraints: const BoxConstraints( diff --git a/lib/pages/member_cheese/widgets/item.dart b/lib/pages/member_cheese/widgets/item.dart index 4f34aeae..2bf6c15d 100644 --- a/lib/pages/member_cheese/widgets/item.dart +++ b/lib/pages/member_cheese/widgets/item.dart @@ -63,11 +63,9 @@ class MemberCheeseItem extends StatelessWidget { bottom: -8, child: iconButton( tooltip: '移除', - context: context, onPressed: onRemove, - icon: Icons.clear, + icon: const Icon(Icons.clear), iconColor: theme.colorScheme.outline, - bgColor: Colors.transparent, ), ), ], diff --git a/lib/pages/pgc_review/post/view.dart b/lib/pages/pgc_review/post/view.dart index 94ecd8e6..98274141 100644 --- a/lib/pages/pgc_review/post/view.dart +++ b/lib/pages/pgc_review/post/view.dart @@ -1,4 +1,3 @@ -import 'package:PiliPlus/common/widgets/button/icon_button.dart'; import 'package:PiliPlus/common/widgets/custom_icon.dart'; import 'package:PiliPlus/http/pgc.dart'; import 'package:PiliPlus/utils/accounts.dart'; @@ -62,14 +61,11 @@ class _PgcReviewPostPanelState extends State { toolbarHeight: 45, title: Text(widget.name), actions: [ - iconButton( - context: context, - icon: Icons.clear, + IconButton( + icon: const Icon(Icons.clear, size: 20), onPressed: Get.back, - iconSize: 22, - bgColor: Colors.transparent, ), - const SizedBox(width: 12), + const SizedBox(width: 2), ], shape: Border( bottom: BorderSide( diff --git a/lib/pages/save_panel/view.dart b/lib/pages/save_panel/view.dart index 05bd8139..6154aa9b 100644 --- a/lib/pages/save_panel/view.dart +++ b/lib/pages/save_panel/view.dart @@ -558,8 +558,7 @@ class _SavePanelState extends State { iconButton( size: 42, tooltip: '关闭', - context: context, - icon: Icons.clear, + icon: const Icon(Icons.clear), onPressed: Get.back, bgColor: theme.colorScheme.onInverseSurface, iconColor: theme.colorScheme.onSurfaceVariant, @@ -569,8 +568,8 @@ class _SavePanelState extends State { tooltip: showBottom ? '隐藏' : '显示', context: context, icon: showBottom - ? Icons.visibility_off - : Icons.visibility, + ? const Icon(Icons.visibility_off) + : const Icon(Icons.visibility), onPressed: () => setState(() { showBottom = !showBottom; }), @@ -580,14 +579,14 @@ class _SavePanelState extends State { size: 42, tooltip: '分享', context: context, - icon: Icons.share, + icon: const Icon(Icons.share), onPressed: () => _onSaveOrSharePic(true), ), iconButton( size: 42, tooltip: '保存', context: context, - icon: Icons.save_alt, + icon: const Icon(Icons.save_alt), onPressed: _onSaveOrSharePic, ), ], diff --git a/lib/pages/setting/view.dart b/lib/pages/setting/view.dart index b26a8fb8..bb001782 100644 --- a/lib/pages/setting/view.dart +++ b/lib/pages/setting/view.dart @@ -23,7 +23,7 @@ import 'package:material_design_icons_flutter/material_design_icons_flutter.dart class _SettingsModel { final SettingType type; final String? subtitle; - final IconData icon; + final Icon icon; const _SettingsModel({ required this.type, @@ -48,40 +48,40 @@ class _SettingPageState extends State { _SettingsModel( type: SettingType.privacySetting, subtitle: '黑名单、无痕模式', - icon: Icons.privacy_tip_outlined, + icon: Icon(Icons.privacy_tip_outlined), ), _SettingsModel( type: SettingType.recommendSetting, subtitle: '推荐来源(web/app)、刷新保留内容、过滤器', - icon: Icons.explore_outlined, + icon: Icon(Icons.explore_outlined), ), _SettingsModel( type: SettingType.videoSetting, subtitle: '画质、音质、解码、缓冲、音频输出等', - icon: Icons.video_settings_outlined, + icon: Icon(Icons.video_settings_outlined), ), _SettingsModel( type: SettingType.playSetting, subtitle: '双击/长按、全屏、后台播放、弹幕、字幕、底部进度条等', - icon: Icons.touch_app_outlined, + icon: Icon(Icons.touch_app_outlined), ), _SettingsModel( type: SettingType.styleSetting, subtitle: '横屏适配(平板)、侧栏、列宽、首页、动态红点、主题、字号、图片、帧率等', - icon: Icons.style_outlined, + icon: Icon(Icons.style_outlined), ), _SettingsModel( type: SettingType.extraSetting, subtitle: '震动、搜索、收藏、ai、评论、动态、代理、更新检查等', - icon: Icons.extension_outlined, + icon: Icon(Icons.extension_outlined), ), _SettingsModel( type: SettingType.webdavSetting, - icon: MdiIcons.databaseCogOutline, + icon: Icon(MdiIcons.databaseCogOutline), ), _SettingsModel( type: SettingType.about, - icon: Icons.info_outline, + icon: Icon(Icons.info_outline), ), ]; @@ -180,7 +180,7 @@ class _SettingPageState extends State { (item) => ListTile( tileColor: _getTileColor(theme, item.type), onTap: () => _toPage(item.type), - leading: Icon(item.icon), + leading: item.icon, title: Text(item.type.title, style: titleStyle), subtitle: item.subtitle == null ? null @@ -204,7 +204,7 @@ class _SettingPageState extends State { ListTile( tileColor: _getTileColor(theme, _items.last.type), onTap: () => _toPage(_items.last.type), - leading: Icon(_items.last.icon), + leading: _items.last.icon, title: Text(_items.last.type.title, style: titleStyle), ), ], diff --git a/lib/pages/share/view.dart b/lib/pages/share/view.dart index cb83c7a2..82661486 100644 --- a/lib/pages/share/view.dart +++ b/lib/pages/share/view.dart @@ -98,8 +98,7 @@ class _SharePanelState extends State { size: 32, iconSize: 18, tooltip: '关闭', - context: context, - icon: Icons.clear, + icon: const Icon(Icons.clear), onPressed: Get.back, ), ], diff --git a/lib/pages/video/introduction/pgc/view.dart b/lib/pages/video/introduction/pgc/view.dart index 8787e58e..da4e8a4d 100644 --- a/lib/pages/video/introduction/pgc/view.dart +++ b/lib/pages/video/introduction/pgc/view.dart @@ -176,14 +176,19 @@ class _PgcIntroPageState extends State { child: Obx(() { final isFav = introController.isFav.value; return iconButton( - context: context, size: 28, iconSize: 26, tooltip: '${isFav ? '取消' : ''}收藏', onPressed: () => introController.onFavPugv(isFav), - icon: isFav ? Icons.star_rounded : Icons.star_border_rounded, - bgColor: isFav ? null : theme.colorScheme.onInverseSurface, - iconColor: isFav ? null : theme.colorScheme.onSurfaceVariant, + icon: isFav + ? const Icon(Icons.star_rounded) + : const Icon(Icons.star_border_rounded), + bgColor: isFav + ? theme.colorScheme.secondaryContainer + : theme.colorScheme.onInverseSurface, + iconColor: isFav + ? theme.colorScheme.onSecondaryContainer + : theme.colorScheme.onSurfaceVariant, ); }), ), diff --git a/lib/pages/video/introduction/pgc/widgets/intro_detail.dart b/lib/pages/video/introduction/pgc/widgets/intro_detail.dart index 497c17b5..76a2146d 100644 --- a/lib/pages/video/introduction/pgc/widgets/intro_detail.dart +++ b/lib/pages/video/introduction/pgc/widgets/intro_detail.dart @@ -1,4 +1,3 @@ -import 'package:PiliPlus/common/widgets/button/icon_button.dart'; import 'package:PiliPlus/common/widgets/keep_alive_wrapper.dart'; import 'package:PiliPlus/common/widgets/page/tabs.dart'; import 'package:PiliPlus/common/widgets/scroll_physics.dart'; @@ -70,14 +69,12 @@ class _IntroDetailState extends State }, ), ), - iconButton( - context: context, - icon: Icons.clear, + IconButton( + tooltip: '关闭', + icon: const Icon(Icons.close, size: 20), onPressed: Get.back, - iconSize: 22, - bgColor: Colors.transparent, ), - const SizedBox(width: 12), + const SizedBox(width: 2), ], ), children: [ diff --git a/lib/pages/video/medialist/view.dart b/lib/pages/video/medialist/view.dart index f4aba57f..85dd43c6 100644 --- a/lib/pages/video/medialist/view.dart +++ b/lib/pages/video/medialist/view.dart @@ -75,19 +75,19 @@ class _MediaListPanelState extends State title: Text(widget.panelTitle ?? '稍后再看'), backgroundColor: Colors.transparent, actions: [ - mediumButton( + iconButton( tooltip: widget.desc ? '顺序播放' : '倒序播放', icon: widget.desc - ? MdiIcons.sortAscending - : MdiIcons.sortDescending, + ? const Icon(MdiIcons.sortAscending) + : const Icon(MdiIcons.sortDescending), onPressed: () { Get.back(); widget.onReverse(); }, ), - mediumButton( + iconButton( tooltip: '关闭', - icon: Icons.close, + icon: const Icon(Icons.close), onPressed: Get.back, ), const SizedBox(width: 14), diff --git a/lib/pages/video/member/view.dart b/lib/pages/video/member/view.dart index 4993f80b..4feb063f 100644 --- a/lib/pages/video/member/view.dart +++ b/lib/pages/video/member/view.dart @@ -89,7 +89,7 @@ class _HorizontalMemberPageState extends State { context: context, onPressed: Get.back, tooltip: '关闭', - icon: Icons.clear, + icon: const Icon(Icons.clear), size: 32, ), const SizedBox(width: 16), diff --git a/lib/pages/video/note/view.dart b/lib/pages/video/note/view.dart index 67dda60c..6532f8b0 100644 --- a/lib/pages/video/note/view.dart +++ b/lib/pages/video/note/view.dart @@ -1,5 +1,4 @@ import 'package:PiliPlus/common/skeleton/video_reply.dart'; -import 'package:PiliPlus/common/widgets/button/icon_button.dart'; import 'package:PiliPlus/common/widgets/image/network_img_layer.dart'; import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart'; import 'package:PiliPlus/common/widgets/refresh_indicator.dart'; @@ -72,14 +71,12 @@ class _NoteListPageState extends State ), ), actions: [ - iconButton( - context: context, + IconButton( tooltip: '关闭', - icon: Icons.clear, + icon: const Icon(Icons.close, size: 20), onPressed: Get.back, - size: 32, ), - const SizedBox(width: 16), + const SizedBox(width: 2), ], ), ), diff --git a/lib/pages/video/post_panel/view.dart b/lib/pages/video/post_panel/view.dart index 35a407f1..e240f28e 100644 --- a/lib/pages/video/post_panel/view.dart +++ b/lib/pages/video/post_panel/view.dart @@ -76,7 +76,7 @@ class PostPanel extends CommonSlidePage { context: context, size: 26, tooltip: '设为当前', - icon: Icons.my_location, + icon: const Icon(Icons.my_location), onPressed: () { updateSegment( isFirst: isFirst, @@ -90,7 +90,9 @@ class PostPanel extends CommonSlidePage { context: context, size: 26, tooltip: isFirst ? '视频开头' : '视频结尾', - icon: isFirst ? Icons.first_page : Icons.last_page, + icon: isFirst + ? const Icon(Icons.first_page) + : const Icon(Icons.last_page), onPressed: () { updateSegment( isFirst: isFirst, @@ -104,7 +106,7 @@ class PostPanel extends CommonSlidePage { context: context, size: 26, tooltip: '编辑', - icon: Icons.edit, + icon: const Icon(Icons.edit), onPressed: () async { final res = await showDialog( context: context, @@ -222,7 +224,7 @@ class _PostPanelState extends State ); }); }, - icon: Icons.add, + icon: const Icon(Icons.add), ), const SizedBox(width: 10), iconButton( @@ -230,7 +232,7 @@ class _PostPanelState extends State context: context, tooltip: '关闭', onPressed: Get.back, - icon: Icons.close, + icon: const Icon(Icons.close), ), const SizedBox(width: 16), ], @@ -494,7 +496,7 @@ class _PostPanelState extends State context: context, size: 26, tooltip: '移除', - icon: Icons.clear, + icon: const Icon(Icons.clear), onPressed: () { setState(() { list.removeAt(index); @@ -509,7 +511,7 @@ class _PostPanelState extends State context: context, size: 26, tooltip: '预览', - icon: Icons.preview_outlined, + icon: const Icon(Icons.preview_outlined), onPressed: () async { final videoCtr = widget.plPlayerController.videoPlayerController; if (videoCtr != null) { diff --git a/lib/pages/video/send_danmaku/view.dart b/lib/pages/video/send_danmaku/view.dart index 1dc3cc6f..8c921910 100644 --- a/lib/pages/video/send_danmaku/view.dart +++ b/lib/pages/video/send_danmaku/view.dart @@ -334,16 +334,14 @@ class _SendDanmakuPanelState extends CommonTextPubPageState { () { final isEmoji = panelType.value == PanelType.emoji; return iconButton( - context: context, tooltip: '弹幕样式', onPressed: () { updatePanelType( isEmoji ? PanelType.keyboard : PanelType.emoji, ); }, - bgColor: Colors.transparent, iconSize: 24, - icon: Icons.text_format, + icon: const Icon(Icons.text_format), iconColor: isEmoji ? themeData.colorScheme.primary : themeData.colorScheme.onSurfaceVariant, @@ -393,30 +391,26 @@ class _SendDanmakuPanelState extends CommonTextPubPageState { Obx( () => enablePublish.value ? iconButton( - context: context, - bgColor: Colors.transparent, iconSize: 22, iconColor: themeData.colorScheme.onSurfaceVariant, onPressed: () { editController.clear(); enablePublish.value = false; }, - icon: Icons.clear, + icon: const Icon(Icons.clear), ) : const SizedBox.shrink(), ), const SizedBox(width: 12), Obx( () => iconButton( - context: context, tooltip: '发送', - bgColor: Colors.transparent, iconSize: 22, iconColor: enablePublish.value ? themeData.colorScheme.primary : themeData.colorScheme.outline, onPressed: enablePublish.value ? onPublish : null, - icon: Icons.send, + icon: const Icon(Icons.send), ), ), ], diff --git a/lib/pages/video/view_point/view.dart b/lib/pages/video/view_point/view.dart index e8be3a6a..d669f85e 100644 --- a/lib/pages/video/view_point/view.dart +++ b/lib/pages/video/view_point/view.dart @@ -62,7 +62,7 @@ class _ViewPointsPageState extends State iconButton( context: context, size: 30, - icon: Icons.clear, + icon: const Icon(Icons.clear), tooltip: '关闭', onPressed: Get.back, ), diff --git a/lib/pages/video/widgets/header_control.dart b/lib/pages/video/widgets/header_control.dart index d3909674..fcfe7986 100644 --- a/lib/pages/video/widgets/header_control.dart +++ b/lib/pages/video/widgets/header_control.dart @@ -1373,9 +1373,8 @@ class HeaderControlState extends State { bool isDanmaku = true, }) { return iconButton( - context: context, tooltip: '默认值: $def', - icon: Icons.refresh, + icon: const Icon(Icons.refresh), onPressed: () { onPressed(); if (isDanmaku) { @@ -1384,7 +1383,6 @@ class HeaderControlState extends State { plPlayerController.putSubtitleSettings(); } }, - bgColor: Colors.transparent, iconColor: theme.colorScheme.outline, size: 24, iconSize: 24, @@ -1943,16 +1941,23 @@ class HeaderControlState extends State { SliverPersistentHeader( pinned: true, delegate: CustomSliverPersistentHeaderDelegate( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 14, - vertical: 7, + child: Container( + height: 45, + padding: const EdgeInsets.symmetric(horizontal: 14), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: theme.colorScheme.outline.withValues( + alpha: 0.1, + ), + ), + ), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ const Text('弹幕列表'), - IconButton( + iconButton( onPressed: () => setState(() {}), icon: const Icon(Icons.refresh), ), @@ -1965,6 +1970,7 @@ class HeaderControlState extends State { ?_buildDanmakuList(ctr.staticDanmaku), ?_buildDanmakuList(ctr.scrollDanmaku), ?_buildDanmakuList(ctr.specialDanmaku), + const SliverToBoxAdapter(child: SizedBox(height: 12)), ], ), ), @@ -1985,12 +1991,15 @@ class HeaderControlState extends State { dense: true, contentPadding: const EdgeInsets.symmetric(horizontal: 14), onLongPress: () => Utils.copyText(item.content.text), - title: Text(item.content.text), + title: Text( + item.content.text, + style: const TextStyle(fontSize: 14), + ), trailing: Row( mainAxisSize: MainAxisSize.min, children: [ Builder( - builder: (context) => IconButton( + builder: (context) => iconButton( onPressed: () async { if (await HeaderControl.likeDanmaku( extra, @@ -2006,7 +2015,7 @@ class HeaderControlState extends State { ), ), if (item.content.selfSend) - IconButton( + iconButton( onPressed: () => HeaderControl.deleteDanmaku( extra.id, plPlayerController.cid!, @@ -2014,7 +2023,7 @@ class HeaderControlState extends State { icon: const Icon(Icons.delete_outline), ) else - IconButton( + iconButton( onPressed: () => HeaderControl.reportDanmaku( extra, context,