diff --git a/lib/common/skeleton/dynamic_card.dart b/lib/common/skeleton/dynamic_card.dart index 063e8c468..dad22498d 100644 --- a/lib/common/skeleton/dynamic_card.dart +++ b/lib/common/skeleton/dynamic_card.dart @@ -9,6 +9,13 @@ class DynamicCardSkeleton extends StatelessWidget { Widget build(BuildContext context) { final ThemeData theme = Theme.of(context); final color = theme.colorScheme.onInverseSurface; + final buttonStyle = TextButton.styleFrom( + tapTargetSize: .padded, + padding: const .symmetric(horizontal: 15), + foregroundColor: theme.colorScheme.outline.withValues( + alpha: 0.2, + ), + ); return Skeleton( child: Container( padding: const EdgeInsets.only(left: 12, right: 12, top: 12), @@ -86,29 +93,19 @@ class DynamicCardSkeleton extends StatelessWidget { if (GlobalData().dynamicsWaterfallFlow) const Spacer(), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - for (var i = 0; i < 3; i++) - TextButton.icon( - onPressed: () {}, - icon: const Icon( - Icons.radio_button_unchecked_outlined, - size: 20, - ), - style: TextButton.styleFrom( - padding: const EdgeInsets.fromLTRB(15, 0, 15, 0), - foregroundColor: theme.colorScheme.outline.withValues( - alpha: 0.2, + children: const ['转发', '评论', '点赞'] + .map( + (e) => TextButton.icon( + onPressed: () {}, + icon: const Icon( + Icons.radio_button_unchecked_outlined, + size: 20, ), + style: buttonStyle, + label: Text(e), ), - label: Text( - i == 0 - ? '转发' - : i == 1 - ? '评论' - : '点赞', - ), - ), - ], + ) + .toList(), ), ], ), diff --git a/lib/common/widgets/custom_toast.dart b/lib/common/widgets/custom_toast.dart index 5659afa80..30d0e84b5 100644 --- a/lib/common/widgets/custom_toast.dart +++ b/lib/common/widgets/custom_toast.dart @@ -50,6 +50,7 @@ class LoadingWidget extends StatelessWidget { borderRadius: const BorderRadius.all(Radius.circular(15)), ), child: Column( + spacing: 20, mainAxisSize: MainAxisSize.min, children: [ //loading animation @@ -59,10 +60,7 @@ class LoadingWidget extends StatelessWidget { ), //msg - Container( - margin: const EdgeInsets.only(top: 20), - child: Text(msg, style: TextStyle(color: onSurfaceVariant)), - ), + Text(msg, style: TextStyle(color: onSurfaceVariant)), ], ), ); diff --git a/lib/common/widgets/custom_tooltip.dart b/lib/common/widgets/custom_tooltip.dart index 49b258ae2..cbf7cf678 100644 --- a/lib/common/widgets/custom_tooltip.dart +++ b/lib/common/widgets/custom_tooltip.dart @@ -13,34 +13,28 @@ class CustomTooltip extends StatefulWidget { this.type = TooltipType.top, required this.overlayWidget, required this.child, - this.indicator, + required this.indicator, }); final TooltipType type; final Widget child; - final Widget Function() overlayWidget; - final Widget Function()? indicator; - - static final List _openedTooltips = - []; + final ValueGetter overlayWidget; + final ValueGetter indicator; @override - State createState() => CustomTooltipState(); + State createState() => _CustomTooltipState(); } -class CustomTooltipState extends State - with SingleTickerProviderStateMixin { +class _CustomTooltipState extends State { final OverlayPortalController _overlayController = OverlayPortalController(); LongPressGestureRecognizer? _longPressRecognizer; void _scheduleShowTooltip() { _overlayController.show(); - CustomTooltip._openedTooltips.add(this); } void _scheduleDismissTooltip() { - CustomTooltip._openedTooltips.remove(this); _overlayController.hide(); } @@ -80,7 +74,6 @@ class CustomTooltipState extends State @protected @override void dispose() { - CustomTooltip._openedTooltips.remove(this); _longPressRecognizer?.onLongPressCancel = null; _longPressRecognizer?.dispose(); super.dispose(); @@ -112,6 +105,8 @@ class CustomTooltipState extends State } } +enum _ChildType { overlay, indicator } + class _CustomTooltipOverlay extends StatelessWidget { const _CustomTooltipOverlay({ required this.verticalOffset, @@ -120,7 +115,7 @@ class _CustomTooltipOverlay extends StatelessWidget { required this.target, required this.onDismiss, required this.overlayWidget, - this.indicator, + required this.indicator, }); final double verticalOffset; @@ -128,8 +123,8 @@ class _CustomTooltipOverlay extends StatelessWidget { final TooltipType type; final Offset target; final VoidCallback onDismiss; - final Widget Function() overlayWidget; - final Widget Function()? indicator; + final ValueGetter overlayWidget; + final ValueGetter indicator; @override Widget build(BuildContext context) { @@ -138,19 +133,18 @@ class _CustomTooltipOverlay extends StatelessWidget { type: type, target: target, verticalOffset: verticalOffset, - horizontslOffset: horizontalOffset, + horizontalOffset: horizontalOffset, preferBelow: false, ), children: [ LayoutId( - id: 'overlay', + id: _ChildType.overlay, child: overlayWidget(), ), - if (indicator != null) - LayoutId( - id: 'indicator', - child: indicator!(), - ), + LayoutId( + id: _ChildType.indicator, + child: indicator(), + ), ], ); if (PlatformUtils.isMobile) { @@ -169,7 +163,7 @@ class _CustomMultiTooltipPositionDelegate extends MultiChildLayoutDelegate { required this.type, required this.target, required this.verticalOffset, - required this.horizontslOffset, + required this.horizontalOffset, required this.preferBelow, }); @@ -179,7 +173,7 @@ class _CustomMultiTooltipPositionDelegate extends MultiChildLayoutDelegate { final double verticalOffset; - final double horizontslOffset; + final double horizontalOffset; final bool preferBelow; @@ -188,13 +182,16 @@ class _CustomMultiTooltipPositionDelegate extends MultiChildLayoutDelegate { switch (type) { case TooltipType.top: Size? indicatorSize; - if (hasChild('indicator')) { - indicatorSize = layoutChild('indicator', BoxConstraints.loose(size)); + if (hasChild(_ChildType.indicator)) { + indicatorSize = layoutChild( + _ChildType.indicator, + BoxConstraints.loose(size), + ); } - if (hasChild('overlay')) { + if (hasChild(_ChildType.overlay)) { final overlaySize = layoutChild( - 'overlay', + _ChildType.overlay, BoxConstraints.loose(size), ); Offset offset = positionDependentBox( @@ -203,30 +200,33 @@ class _CustomMultiTooltipPositionDelegate extends MultiChildLayoutDelegate { childSize: overlaySize, target: target, verticalOffset: verticalOffset, - horizontslOffset: horizontslOffset, + horizontalOffset: horizontalOffset, preferBelow: preferBelow, ); if (indicatorSize != null) { offset = Offset(offset.dx, offset.dy - indicatorSize.height + 1); positionChild( - 'indicator', + _ChildType.indicator, Offset( target.dx - indicatorSize.width / 2, offset.dy + overlaySize.height - 1, ), ); } - positionChild('overlay', offset); + positionChild(_ChildType.overlay, offset); } case TooltipType.right: Size? indicatorSize; - if (hasChild('indicator')) { - indicatorSize = layoutChild('indicator', BoxConstraints.loose(size)); + if (hasChild(_ChildType.indicator)) { + indicatorSize = layoutChild( + _ChildType.indicator, + BoxConstraints.loose(size), + ); } - if (hasChild('overlay')) { + if (hasChild(_ChildType.overlay)) { final overlaySize = layoutChild( - 'overlay', + _ChildType.overlay, BoxConstraints.loose(size), ); Offset offset = positionDependentBox( @@ -235,20 +235,20 @@ class _CustomMultiTooltipPositionDelegate extends MultiChildLayoutDelegate { childSize: overlaySize, target: target, verticalOffset: verticalOffset, - horizontslOffset: horizontslOffset, + horizontalOffset: horizontalOffset, preferBelow: preferBelow, ); if (indicatorSize != null) { offset = Offset(offset.dx + indicatorSize.height - 1, offset.dy); positionChild( - 'indicator', + _ChildType.indicator, Offset( offset.dx - indicatorSize.width + 1, target.dy - indicatorSize.height / 2, ), ); } - positionChild('overlay', offset); + positionChild(_ChildType.overlay, offset); } } } @@ -302,7 +302,7 @@ Offset positionDependentBox({ required Offset target, required bool preferBelow, double verticalOffset = 0.0, - double horizontslOffset = 0.0, + double horizontalOffset = 0.0, double margin = 10.0, }) { switch (type) { @@ -335,7 +335,7 @@ Offset positionDependentBox({ case TooltipType.right: final double dy = math.max(margin, target.dy - childSize.height / 2); final double dx = math.min( - target.dx + horizontslOffset, + target.dx + horizontalOffset, size.width - childSize.width - margin, ); return Offset(dx, dy); diff --git a/lib/common/widgets/flutter/refresh_indicator.dart b/lib/common/widgets/flutter/refresh_indicator.dart index 7c1838450..db7fcd516 100644 --- a/lib/common/widgets/flutter/refresh_indicator.dart +++ b/lib/common/widgets/flutter/refresh_indicator.dart @@ -743,7 +743,7 @@ class RefreshIndicatorState extends State } case _IndicatorType.noSpinner: - return Container(); + return const SizedBox.shrink(); } }, ), diff --git a/lib/common/widgets/loading_widget.dart b/lib/common/widgets/loading_widget.dart index b2751017f..4605eec53 100644 --- a/lib/common/widgets/loading_widget.dart +++ b/lib/common/widgets/loading_widget.dart @@ -26,6 +26,7 @@ class LoadingWidget extends StatelessWidget { borderRadius: const BorderRadius.all(Radius.circular(15)), ), child: Column( + spacing: 20, mainAxisSize: MainAxisSize.min, children: [ //loading animation @@ -43,10 +44,7 @@ class LoadingWidget extends StatelessWidget { 0, ), //msg - Padding( - padding: const EdgeInsets.only(top: 20), - child: Text(msg, style: TextStyle(color: onSurfaceVariant)), - ), + Text(msg, style: TextStyle(color: onSurfaceVariant)), ], ), ); diff --git a/lib/common/widgets/pendant_avatar.dart b/lib/common/widgets/pendant_avatar.dart index fd065381e..93101c27f 100644 --- a/lib/common/widgets/pendant_avatar.dart +++ b/lib/common/widgets/pendant_avatar.dart @@ -83,8 +83,9 @@ class PendantAvatar extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ Icon( + size: 16, + applyTextScaling: true, Icons.equalizer_rounded, - size: MediaQuery.textScalerOf(context).scale(16), color: colorScheme.onSecondaryContainer, ), Text( diff --git a/lib/pages/article/view.dart b/lib/pages/article/view.dart index 28dab1066..1095fbfa2 100644 --- a/lib/pages/article/view.dart +++ b/lib/pages/article/view.dart @@ -502,6 +502,7 @@ class _ArticlePageState extends CommonDynPageState { late final primary = theme.colorScheme.primary; late final outline = theme.colorScheme.outline; late final btnStyle = TextButton.styleFrom( + tapTargetSize: .padded, padding: const EdgeInsets.symmetric(horizontal: 15), foregroundColor: outline, ); diff --git a/lib/pages/audio/view.dart b/lib/pages/audio/view.dart index 4b0d43985..7052a0a32 100644 --- a/lib/pages/audio/view.dart +++ b/lib/pages/audio/view.dart @@ -313,9 +313,7 @@ class _AudioPageState extends State { children: [ if (isCurr) ...[ WidgetSpan( - alignment: - PlaceholderAlignment - .bottom, + alignment: .bottom, child: Image.asset( 'assets/images/live.gif', width: 16, @@ -357,8 +355,7 @@ class _AudioPageState extends State { children: [ if (isCurr) ...[ WidgetSpan( - alignment: - PlaceholderAlignment.bottom, + alignment: .bottom, child: Image.asset( 'assets/images/live.gif', width: 16, diff --git a/lib/pages/common/dyn/common_dyn_page.dart b/lib/pages/common/dyn/common_dyn_page.dart index 80990114f..990b78af6 100644 --- a/lib/pages/common/dyn/common_dyn_page.dart +++ b/lib/pages/common/dyn/common_dyn_page.dart @@ -285,10 +285,7 @@ abstract class CommonDynPageState extends State builder: (context) => Align( alignment: Alignment.topRight, child: Container( - margin: const EdgeInsets.only( - top: 56, - right: 16, - ), + margin: const EdgeInsets.only(top: 56, right: 16), width: maxWidth / 4, height: 32, child: Builder( diff --git a/lib/pages/common/search/common_search_page.dart b/lib/pages/common/search/common_search_page.dart index aa465b323..946e994fe 100644 --- a/lib/pages/common/search/common_search_page.dart +++ b/lib/pages/common/search/common_search_page.dart @@ -68,6 +68,7 @@ abstract class CommonSearchPageState textAlignVertical: TextAlignVertical.center, decoration: InputDecoration( hintText: '搜索', + visualDensity: .standard, border: InputBorder.none, suffixIcon: IconButton( tooltip: '清空', diff --git a/lib/pages/dynamics/widgets/action_panel.dart b/lib/pages/dynamics/widgets/action_panel.dart index 8cad2382d..d0df95245 100644 --- a/lib/pages/dynamics/widgets/action_panel.dart +++ b/lib/pages/dynamics/widgets/action_panel.dart @@ -24,6 +24,7 @@ class ActionPanel extends StatelessWidget { final comment = moduleStat.comment!; final like = moduleStat.like!; final btnStyle = TextButton.styleFrom( + tapTargetSize: .padded, padding: const EdgeInsets.symmetric(horizontal: 15), foregroundColor: outline, ); diff --git a/lib/pages/dynamics/widgets/author_panel.dart b/lib/pages/dynamics/widgets/author_panel.dart index ea8e7c831..ff98fd688 100644 --- a/lib/pages/dynamics/widgets/author_panel.dart +++ b/lib/pages/dynamics/widgets/author_panel.dart @@ -83,9 +83,7 @@ class AuthorPanel extends StatelessWidget { onTap: moduleAuthor.type == 'AUTHOR_TYPE_NORMAL' ? () { feedBack(); - Get.toNamed( - '/member?mid=${moduleAuthor.mid}', - ); + Get.toNamed('/member?mid=${moduleAuthor.mid}'); } : null, child: Row( @@ -150,8 +148,8 @@ class AuthorPanel extends StatelessWidget { color: theme.colorScheme.primary, ), strutStyle: const StrutStyle( - leading: 0, height: 1, + leading: 0, fontSize: 12, ), ), diff --git a/lib/pages/dynamics_create/view.dart b/lib/pages/dynamics_create/view.dart index e863221ea..30a3d5153 100644 --- a/lib/pages/dynamics_create/view.dart +++ b/lib/pages/dynamics_create/view.dart @@ -145,6 +145,7 @@ class _CreateDynPanelState extends CommonRichTextPubPageState { TextSpan( children: [ WidgetSpan( + alignment: .middle, child: Padding( padding: const EdgeInsets.only(right: 5), child: Icon( @@ -191,6 +192,7 @@ class _CreateDynPanelState extends CommonRichTextPubPageState { decoration: InputDecoration( hintText: '标题,选填20字', isDense: true, + visualDensity: .standard, contentPadding: EdgeInsets.zero, border: const OutlineInputBorder( gapPadding: 0, @@ -216,7 +218,7 @@ class _CreateDynPanelState extends CommonRichTextPubPageState { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Obx(() => _buildPubtimeWidget), + Obx(() => _buildPubTimeWidget), Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, @@ -453,7 +455,7 @@ class _CreateDynPanelState extends CommonRichTextPubPageState { ); } - Widget get _buildPubtimeWidget => _publishTime.value == null + Widget get _buildPubTimeWidget => _publishTime.value == null ? FilledButton.tonal( style: FilledButton.styleFrom( padding: const EdgeInsets.symmetric( @@ -684,6 +686,7 @@ class _CreateDynPanelState extends CommonRichTextPubPageState { onSubmitted: onSubmitted, decoration: InputDecoration( hintText: '说点什么吧', + visualDensity: .standard, hintStyle: TextStyle(color: theme.colorScheme.outline), border: const OutlineInputBorder( borderSide: BorderSide.none, diff --git a/lib/pages/dynamics_create_vote/view.dart b/lib/pages/dynamics_create_vote/view.dart index 09d898244..0f3df8527 100644 --- a/lib/pages/dynamics_create_vote/view.dart +++ b/lib/pages/dynamics_create_vote/view.dart @@ -143,6 +143,7 @@ class _CreateVotePageState extends State { top: 4, bottom: 4, ), + visualDensity: .standard, tapTargetSize: MaterialTapTargetSize.shrinkWrap, foregroundColor: theme.colorScheme.onSurfaceVariant, backgroundColor: theme.colorScheme.onInverseSurface, @@ -370,7 +371,12 @@ class _CreateVotePageState extends State { ..updateCanCreate(), child: Text( '${const ['文字', '图片'][index]}投票', - strutStyle: const StrutStyle(forceStrutHeight: true), + style: const TextStyle(fontSize: 14, height: 1), + strutStyle: const StrutStyle( + height: 1, + leading: 0, + fontSize: 14, + ), ), ); if (isEnable) { diff --git a/lib/pages/dynamics_detail/view.dart b/lib/pages/dynamics_detail/view.dart index b5bf173fa..1b673f1a9 100644 --- a/lib/pages/dynamics_detail/view.dart +++ b/lib/pages/dynamics_detail/view.dart @@ -210,6 +210,7 @@ class _DynamicDetailPageState extends CommonDynPageState { final primary = theme.colorScheme.primary; final outline = theme.colorScheme.outline; final btnStyle = TextButton.styleFrom( + tapTargetSize: .padded, padding: const EdgeInsets.symmetric(horizontal: 15), foregroundColor: outline, ); diff --git a/lib/pages/dynamics_mention/view.dart b/lib/pages/dynamics_mention/view.dart index 9f6ed5fcf..ea0fff170 100644 --- a/lib/pages/dynamics_mention/view.dart +++ b/lib/pages/dynamics_mention/view.dart @@ -109,6 +109,7 @@ class _DynMentionPanelState controller: _controller.controller, onChanged: ctr!.add, decoration: InputDecoration( + visualDensity: .standard, border: const OutlineInputBorder( gapPadding: 0, borderSide: BorderSide.none, diff --git a/lib/pages/dynamics_select_topic/view.dart b/lib/pages/dynamics_select_topic/view.dart index 606360e59..a1c875ab7 100644 --- a/lib/pages/dynamics_select_topic/view.dart +++ b/lib/pages/dynamics_select_topic/view.dart @@ -104,6 +104,7 @@ class _SelectTopicPanelState controller: _controller.controller, onChanged: ctr!.add, decoration: InputDecoration( + visualDensity: .standard, border: const OutlineInputBorder( gapPadding: 0, borderSide: BorderSide.none, diff --git a/lib/pages/later/view.dart b/lib/pages/later/view.dart index edbdf4ad6..88d4a56af 100644 --- a/lib/pages/later/view.dart +++ b/lib/pages/later/view.dart @@ -244,14 +244,19 @@ class _LaterPageState extends State vertical: 6, ), child: Text.rich( + style: TextStyle(fontSize: 14, height: 1, color: color), + strutStyle: const StrutStyle( + leading: 0, + height: 1, + fontSize: 14, + ), TextSpan( children: [ - TextSpan( - text: value ? '最早添加' : '最近添加', - ), + TextSpan(text: value ? '最早添加' : '最近添加'), WidgetSpan( + alignment: .middle, child: Icon( - size: 16, + size: 14, MdiIcons.unfoldMoreHorizontal, color: color, ), @@ -287,14 +292,19 @@ class _LaterPageState extends State vertical: 6, ), child: Text.rich( + style: TextStyle(fontSize: 14, height: 1, color: color), + strutStyle: const StrutStyle( + leading: 0, + height: 1, + fontSize: 14, + ), TextSpan( children: [ - const TextSpan( - text: '清空', - ), + const TextSpan(text: '清空'), WidgetSpan( + alignment: .middle, child: Icon( - size: 16, + size: 14, MdiIcons.unfoldMoreHorizontal, color: color, ), diff --git a/lib/pages/live_room/send_danmaku/view.dart b/lib/pages/live_room/send_danmaku/view.dart index 4938717b2..b313c283a 100644 --- a/lib/pages/live_room/send_danmaku/view.dart +++ b/lib/pages/live_room/send_danmaku/view.dart @@ -87,7 +87,7 @@ class _ReplyPageState extends CommonRichTextPubPageState { List buildInputView(ThemeData theme) { return [ - Container( + Padding( padding: const EdgeInsets.only( top: 12, right: 15, diff --git a/lib/pages/live_search/view.dart b/lib/pages/live_search/view.dart index 8a196b0ca..52e9c43e7 100644 --- a/lib/pages/live_search/view.dart +++ b/lib/pages/live_search/view.dart @@ -41,6 +41,7 @@ class _LiveSearchPageState extends State { textAlignVertical: TextAlignVertical.center, decoration: InputDecoration( hintText: '搜索房间或主播', + visualDensity: .standard, border: InputBorder.none, suffixIcon: IconButton( tooltip: '清空', diff --git a/lib/pages/member/widget/user_info_card.dart b/lib/pages/member/widget/user_info_card.dart index da04591a8..e0e9077ca 100644 --- a/lib/pages/member/widget/user_info_card.dart +++ b/lib/pages/member/widget/user_info_card.dart @@ -195,14 +195,14 @@ class UserInfoCard extends StatelessWidget { ), ), ), - if (card.nameplate?.imageSmall?.isNotEmpty == true) - CachedNetworkImage( - imageUrl: ImageUtils.thumbnailUrl(card.nameplate!.imageSmall!), - height: 20, - placeholder: (context, url) { - return const SizedBox.shrink(); - }, - ), + // if (card.nameplate?.imageSmall?.isNotEmpty == true) + // CachedNetworkImage( + // imageUrl: ImageUtils.thumbnailUrl(card.nameplate!.imageSmall!), + // height: 20, + // placeholder: (context, url) { + // return const SizedBox.shrink(); + // }, + // ), ], ), ), @@ -389,8 +389,8 @@ class UserInfoCard extends StatelessWidget { width: 1.0, color: colorScheme.outline.withValues(alpha: 0.3), ), + tapTargetSize: .padded, padding: EdgeInsets.zero, - tapTargetSize: MaterialTapTargetSize.shrinkWrap, visualDensity: VisualDensity.compact, ), ), @@ -401,6 +401,7 @@ class UserInfoCard extends StatelessWidget { backgroundColor: relation != 0 ? colorScheme.onInverseSurface : null, + tapTargetSize: .padded, visualDensity: const VisualDensity(vertical: -1.8), ), child: Text.rich( diff --git a/lib/pages/member_search/view.dart b/lib/pages/member_search/view.dart index 7ef42b087..c3467e4c4 100644 --- a/lib/pages/member_search/view.dart +++ b/lib/pages/member_search/view.dart @@ -41,6 +41,7 @@ class _MemberSearchPageState extends State { textAlignVertical: TextAlignVertical.center, decoration: InputDecoration( hintText: '搜索', + visualDensity: .standard, border: InputBorder.none, suffixIcon: IconButton( tooltip: '清空', diff --git a/lib/pages/mine/widgets/item.dart b/lib/pages/mine/widgets/item.dart index e7ad75c2c..356e5115c 100644 --- a/lib/pages/mine/widgets/item.dart +++ b/lib/pages/mine/widgets/item.dart @@ -19,60 +19,57 @@ class FavFolderItem extends StatelessWidget { @override Widget build(BuildContext context) { final theme = Theme.of(context); - return Container( - margin: EdgeInsets.zero, - child: GestureDetector( - onTap: () { - Get.toNamed( - '/favDetail', - arguments: item, - parameters: { - 'mediaId': item.id.toString(), - 'heroTag': heroTag, - }, - )?.whenComplete(onPop); - }, - behavior: HitTestBehavior.opaque, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - DecoratedBox( - decoration: BoxDecoration( - borderRadius: const BorderRadius.all(Radius.circular(12)), - boxShadow: [ - BoxShadow( - color: theme.colorScheme.onInverseSurface.withValues( - alpha: 0.4, - ), - offset: const Offset(4, -12), - blurRadius: 0.0, - spreadRadius: 0.0, + return GestureDetector( + onTap: () { + Get.toNamed( + '/favDetail', + arguments: item, + parameters: { + 'mediaId': item.id.toString(), + 'heroTag': heroTag, + }, + )?.whenComplete(onPop); + }, + behavior: HitTestBehavior.opaque, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + DecoratedBox( + decoration: BoxDecoration( + borderRadius: const BorderRadius.all(Radius.circular(12)), + boxShadow: [ + BoxShadow( + color: theme.colorScheme.onInverseSurface.withValues( + alpha: 0.4, ), - ], - ), - child: Hero( - tag: heroTag, - child: NetworkImgLayer( - src: item.cover, - width: 180, - height: 110, + offset: const Offset(4, -12), + blurRadius: 0.0, + spreadRadius: 0.0, ), + ], + ), + child: Hero( + tag: heroTag, + child: NetworkImgLayer( + src: item.cover, + width: 180, + height: 110, ), ), - const SizedBox(height: 8), - Text( - ' ${item.title}', - overflow: TextOverflow.fade, - maxLines: 1, + ), + const SizedBox(height: 8), + Text( + ' ${item.title}', + overflow: TextOverflow.fade, + maxLines: 1, + ), + Text( + ' 共${item.mediaCount}条视频 · ${FavUtils.isPublicFavText(item.attr)}', + style: theme.textTheme.labelSmall!.copyWith( + color: theme.colorScheme.outline, ), - Text( - ' 共${item.mediaCount}条视频 · ${FavUtils.isPublicFavText(item.attr)}', - style: theme.textTheme.labelSmall!.copyWith( - color: theme.colorScheme.outline, - ), - ), - ], - ), + ), + ], ), ); } diff --git a/lib/pages/music/view.dart b/lib/pages/music/view.dart index 3744a6173..67e38b4d5 100644 --- a/lib/pages/music/view.dart +++ b/lib/pages/music/view.dart @@ -222,6 +222,7 @@ class _MusicDetailPageState extends CommonDynPageState { color: color, ), style: TextButton.styleFrom( + tapTargetSize: .padded, padding: const EdgeInsets.symmetric(horizontal: 15), foregroundColor: outline, ), diff --git a/lib/pages/pgc_index/view.dart b/lib/pages/pgc_index/view.dart index 15fdc6224..d571f21f6 100644 --- a/lib/pages/pgc_index/view.dart +++ b/lib/pages/pgc_index/view.dart @@ -204,8 +204,7 @@ class _PgcIndexPageState extends State GestureDetector( behavior: HitTestBehavior.opaque, onTap: () => _ctr.isExpand.value = !_ctr.isExpand.value, - child: Container( - alignment: Alignment.center, + child: Center( child: Row( mainAxisSize: MainAxisSize.min, children: [ diff --git a/lib/pages/rcmd/controller.dart b/lib/pages/rcmd/controller.dart index aa2e4e784..72c1e5539 100644 --- a/lib/pages/rcmd/controller.dart +++ b/lib/pages/rcmd/controller.dart @@ -32,8 +32,8 @@ class RcmdController extends CommonListController { if (savedRcmdTip) { lastRefreshAt = dataList.length; } - if (currentList.length > 500) { - currentList.removeRange(50, currentList.length); + if (currentList.length > 200) { + currentList.length = 50; } dataList.addAll(currentList); } diff --git a/lib/pages/search/view.dart b/lib/pages/search/view.dart index 25204c2ae..8c3417baf 100644 --- a/lib/pages/search/view.dart +++ b/lib/pages/search/view.dart @@ -73,6 +73,7 @@ class _SearchPageState extends State { textInputAction: TextInputAction.search, onChanged: _searchController.onChange, decoration: InputDecoration( + visualDensity: .standard, hintText: _searchController.hintText ?? '搜索', border: InputBorder.none, ), diff --git a/lib/pages/setting/models/extra_settings.dart b/lib/pages/setting/models/extra_settings.dart index 7e6ae0648..d91b2f90c 100644 --- a/lib/pages/setting/models/extra_settings.dart +++ b/lib/pages/setting/models/extra_settings.dart @@ -144,24 +144,26 @@ List get extraSettings => [ initialValue: pgcSkipType, child: Padding( padding: const EdgeInsets.symmetric(vertical: 8), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - pgcSkipType.title, - style: TextStyle(fontSize: 14, height: 1, color: color), - strutStyle: const StrutStyle( - leading: 0, - height: 1, - fontSize: 14, + child: Text.rich( + style: TextStyle(fontSize: 14, height: 1, color: color), + strutStyle: const StrutStyle( + leading: 0, + height: 1, + fontSize: 14, + ), + TextSpan( + children: [ + TextSpan(text: pgcSkipType.title), + WidgetSpan( + alignment: .middle, + child: Icon( + MdiIcons.unfoldMoreHorizontal, + size: 14, + color: color, + ), ), - ), - Icon( - MdiIcons.unfoldMoreHorizontal, - size: MediaQuery.textScalerOf(context).scale(14), - color: color, - ), - ], + ], + ), ), ), onSelected: (value) async { diff --git a/lib/pages/setting/pages/color_select.dart b/lib/pages/setting/pages/color_select.dart index 9388a6b1c..31e43f085 100644 --- a/lib/pages/setting/pages/color_select.dart +++ b/lib/pages/setting/pages/color_select.dart @@ -37,15 +37,6 @@ class Item { bool isExpanded; } -List generateItems(int count) { - return List.generate(count, (int index) { - return Item( - headerValue: 'Panel $index', - expandedValue: 'This is item number $index', - ); - }); -} - class _ColorSelectPageState extends State { final ctr = Get.put(ColorSelectController()); FlexSchemeVariant _dynamicSchemeVariant = diff --git a/lib/pages/setting/pages/font_size_select.dart b/lib/pages/setting/pages/font_size_select.dart index a24456f67..418748c54 100644 --- a/lib/pages/setting/pages/font_size_select.dart +++ b/lib/pages/setting/pages/font_size_select.dart @@ -1,4 +1,3 @@ -import 'package:PiliPlus/common/widgets/view_safe_area.dart'; import 'package:PiliPlus/utils/extension/num_ext.dart'; import 'package:PiliPlus/utils/storage.dart'; import 'package:PiliPlus/utils/storage_key.dart'; @@ -44,7 +43,7 @@ class _FontSizeSelectPageState extends State { const SizedBox(width: 12), ], ), - body: ViewSafeArea( + body: SafeArea( child: Column( children: [ Expanded( diff --git a/lib/pages/setting/view.dart b/lib/pages/setting/view.dart index b9be692aa..15d2cf47e 100644 --- a/lib/pages/setting/view.dart +++ b/lib/pages/setting/view.dart @@ -290,20 +290,25 @@ class _SettingPageState extends State { onTap: () => Get.toNamed('/settingsSearch'), borderRadius: const BorderRadius.all(Radius.circular(50)), child: Ink( - padding: const EdgeInsets.symmetric(vertical: 6), + padding: const EdgeInsets.symmetric(vertical: 8), decoration: BoxDecoration( borderRadius: const BorderRadius.all(Radius.circular(50)), color: theme.colorScheme.onInverseSurface, ), - child: Center( + child: const Center( child: Row( mainAxisSize: MainAxisSize.min, children: [ Icon( - size: MediaQuery.textScalerOf(context).scale(18), + size: 18, + applyTextScaling: true, Icons.search, ), - const Text(' 搜索'), + Text( + ' 搜索', + style: TextStyle(height: 1), + strutStyle: StrutStyle(height: 1, leading: 0), + ), ], ), ), diff --git a/lib/pages/settings_search/view.dart b/lib/pages/settings_search/view.dart index 487b8fb35..5b399c991 100644 --- a/lib/pages/settings_search/view.dart +++ b/lib/pages/settings_search/view.dart @@ -83,6 +83,7 @@ class _SettingsSearchPageState decoration: const InputDecoration( isDense: true, hintText: '搜索', + visualDensity: .standard, border: InputBorder.none, ), ), diff --git a/lib/pages/share/view.dart b/lib/pages/share/view.dart index 195dbbefb..001e0151b 100644 --- a/lib/pages/share/view.dart +++ b/lib/pages/share/view.dart @@ -230,6 +230,7 @@ class _SharePanelState extends State { textInputAction: TextInputAction.newline, decoration: InputDecoration( hintText: '说说你的想法吧...', + visualDensity: .standard, hintStyle: const TextStyle(fontSize: 14), border: const OutlineInputBorder( borderSide: BorderSide.none, @@ -237,9 +238,9 @@ class _SharePanelState extends State { ), filled: true, isDense: true, - contentPadding: const EdgeInsets.symmetric( - horizontal: 16, - vertical: 8, + contentPadding: const .symmetric( + horizontal: 12, + vertical: 6, ), fillColor: theme.colorScheme.onInverseSurface, ), diff --git a/lib/pages/sponsor_block/view.dart b/lib/pages/sponsor_block/view.dart index 71a8034c2..eaddbbac8 100644 --- a/lib/pages/sponsor_block/view.dart +++ b/lib/pages/sponsor_block/view.dart @@ -597,32 +597,38 @@ class _SponsorBlockPageState extends State { .toList(), child: Padding( padding: const EdgeInsets.symmetric(vertical: 8), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - item.second.title, - style: TextStyle( - height: 1, - fontSize: 14, - color: isDisable - ? theme.colorScheme.outline.withValues( - alpha: 0.7, - ) - : theme.colorScheme.secondary, + child: Text.rich( + style: TextStyle( + height: 1, + fontSize: 14, + color: isDisable + ? theme.colorScheme.outline.withValues( + alpha: 0.7, + ) + : theme.colorScheme.secondary, + ), + strutStyle: const StrutStyle( + height: 1, + leading: 0, + fontSize: 14, + ), + TextSpan( + children: [ + TextSpan(text: item.second.title), + WidgetSpan( + alignment: .middle, + child: Icon( + size: 14, + MdiIcons.unfoldMoreHorizontal, + color: isDisable + ? theme.colorScheme.outline.withValues( + alpha: 0.7, + ) + : theme.colorScheme.secondary, + ), ), - strutStyle: const StrutStyle(height: 1, leading: 0), - ), - Icon( - MdiIcons.unfoldMoreHorizontal, - size: MediaQuery.textScalerOf(context).scale(14), - color: isDisable - ? theme.colorScheme.outline.withValues( - alpha: 0.7, - ) - : theme.colorScheme.secondary, - ), - ], + ], + ), ), ), ); diff --git a/lib/pages/video/introduction/pgc/controller.dart b/lib/pages/video/introduction/pgc/controller.dart index 13d409f7d..656766433 100644 --- a/lib/pages/video/introduction/pgc/controller.dart +++ b/lib/pages/video/introduction/pgc/controller.dart @@ -80,12 +80,12 @@ class PgcIntroController extends CommonIntroController { if (result case Success(:final response)) { final hasLike = response.like == 1; final hasFav = response.favorite == 1; - late final stat = pgcItem.stat!; + late final stat = pgcItem.stat; if (hasLike) { - stat.like = max(1, stat.like); + stat?.like = max(1, stat.like); } if (hasFav) { - stat.favorite = max(1, stat.favorite); + stat?.favorite = max(1, stat.favorite); } this.hasLike.value = hasLike; coinNum.value = response.coinNumber!; @@ -106,7 +106,7 @@ class PgcIntroController extends CommonIntroController { var result = await VideoHttp.likeVideo(bvid: bvid, type: newVal); if (result case Success(:final response)) { SmartDialog.showToast(newVal ? response : '取消赞'); - pgcItem.stat!.like += newVal ? 1 : -1; + pgcItem.stat?.like += newVal ? 1 : -1; hasLike.value = newVal; } else { result.toast(); @@ -429,18 +429,18 @@ class PgcIntroController extends CommonIntroController { } var result = await VideoHttp.pgcTriple(epId: epId!, seasonId: seasonId); if (result case Success(:final response)) { - late final stat = pgcItem.stat!; + late final stat = pgcItem.stat; if (response.like == 1 && !hasLike.value) { - stat.like++; + stat?.like++; hasLike.value = true; } if (response.coin == 1 && !hasCoin) { - stat.coin += 2; + stat?.coin += 2; coinNum.value = 2; GlobalData().afterCoin(2); } if (response.favorite == 1 && !hasFav.value) { - stat.favorite++; + stat?.favorite++; hasFav.value = true; } if (!hasCoin) { diff --git a/lib/pages/video/introduction/ugc/controller.dart b/lib/pages/video/introduction/ugc/controller.dart index 21e4b2d43..8ea16b43a 100644 --- a/lib/pages/video/introduction/ugc/controller.dart +++ b/lib/pages/video/introduction/ugc/controller.dart @@ -164,12 +164,12 @@ class UgcIntroController extends CommonIntroController with ReloadMixin { Future queryAllStatus() async { var result = await VideoHttp.videoRelation(bvid: bvid); if (result case Success(:var response)) { - late final stat = videoDetail.value.stat!; + late final stat = videoDetail.value.stat; if (response.like!) { - stat.like = max(1, stat.like); + stat?.like = max(1, stat.like); } if (response.favorite!) { - stat.favorite = max(1, stat.favorite); + stat?.favorite = max(1, stat.favorite); } hasLike.value = response.like!; hasDislike.value = response.dislike!; @@ -193,18 +193,18 @@ class UgcIntroController extends CommonIntroController with ReloadMixin { } var result = await VideoHttp.ugcTriple(bvid: bvid); if (result case Success(:final response)) { - late final stat = videoDetail.value.stat!; + late final stat = videoDetail.value.stat; if (response.like == true && !hasLike.value) { - stat.like++; + stat?.like++; hasLike.value = true; } if (response.coin == true && !hasCoin) { - stat.coin += 2; + stat?.coin += 2; coinNum.value = 2; GlobalData().afterCoin(2); } if (response.fav == true && !hasFav.value) { - stat.favorite++; + stat?.favorite++; hasFav.value = true; } hasDislike.value = false; @@ -232,7 +232,7 @@ class UgcIntroController extends CommonIntroController with ReloadMixin { var result = await VideoHttp.likeVideo(bvid: bvid, type: newVal); if (result case Success(:final response)) { SmartDialog.showToast(newVal ? response : '取消赞'); - videoDetail.value.stat!.like += newVal ? 1 : -1; + videoDetail.value.stat?.like += newVal ? 1 : -1; hasLike.value = newVal; if (newVal) { hasDislike.value = false; @@ -256,7 +256,7 @@ class UgcIntroController extends CommonIntroController with ReloadMixin { SmartDialog.showToast('点踩成功'); hasDislike.value = true; if (hasLike.value) { - videoDetail.value.stat!.like--; + videoDetail.value.stat?.like--; hasLike.value = false; } } else { diff --git a/lib/pages/video/introduction/ugc/view.dart b/lib/pages/video/introduction/ugc/view.dart index 0ed87bf6c..7262f71ea 100644 --- a/lib/pages/video/introduction/ugc/view.dart +++ b/lib/pages/video/introduction/ugc/view.dart @@ -209,13 +209,15 @@ class _UgcIntroPanelState extends State { children: [ WidgetSpan( alignment: PlaceholderAlignment.middle, - child: Icon( - size: 13, - Icons.error_outline, - color: theme.colorScheme.outline, + child: Padding( + padding: const .only(right: 2), + child: Icon( + size: 13, + Icons.error_outline, + color: theme.colorScheme.outline, + ), ), ), - const WidgetSpan(child: SizedBox(width: 2)), TextSpan( text: '${videoDetail.argueInfo!.argueMsg}', ), diff --git a/lib/pages/video/post_panel/popup_menu_text.dart b/lib/pages/video/post_panel/popup_menu_text.dart index 0d18d9d49..a3ce706ff 100644 --- a/lib/pages/video/post_panel/popup_menu_text.dart +++ b/lib/pages/video/post_panel/popup_menu_text.dart @@ -36,27 +36,30 @@ class PopupMenuText extends StatelessWidget { } }, itemBuilder: itemBuilder, - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - getSelectTitle(select), - style: TextStyle( - height: 1, - fontSize: 14, - color: secondary, + child: Text.rich( + style: TextStyle( + height: 1, + fontSize: 14, + color: secondary, + ), + strutStyle: const StrutStyle( + height: 1, + leading: 0, + fontSize: 14, + ), + TextSpan( + children: [ + TextSpan(text: getSelectTitle(select)), + WidgetSpan( + alignment: .middle, + child: Icon( + size: 14, + MdiIcons.unfoldMoreHorizontal, + color: secondary, + ), ), - strutStyle: const StrutStyle( - height: 1, - leading: 0, - ), - ), - Icon( - MdiIcons.unfoldMoreHorizontal, - size: MediaQuery.textScalerOf(context).scale(14), - color: secondary, - ), - ], + ], + ), ), ), ], diff --git a/lib/pages/video/reply_search_item/view.dart b/lib/pages/video/reply_search_item/view.dart index 5e1aa30e5..b514601d2 100644 --- a/lib/pages/video/reply_search_item/view.dart +++ b/lib/pages/video/reply_search_item/view.dart @@ -48,6 +48,7 @@ class _ReplySearchPageState extends State { textAlignVertical: TextAlignVertical.center, decoration: InputDecoration( hintText: '搜索', + visualDensity: .standard, border: InputBorder.none, suffixIcon: IconButton( tooltip: '清空', diff --git a/lib/pages/video/widgets/header_control.dart b/lib/pages/video/widgets/header_control.dart index 0890d94c0..3fc7cd271 100644 --- a/lib/pages/video/widgets/header_control.dart +++ b/lib/pages/video/widgets/header_control.dart @@ -1100,33 +1100,36 @@ class HeaderControlState extends State plPlayerController.superResolutionType.value, child: Padding( padding: const EdgeInsets.all(4), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - widget - .controller - .superResolutionType - .value - .title, - strutStyle: const StrutStyle( - leading: 0, - height: 1, + child: Text.rich( + style: TextStyle( + height: 1, + fontSize: 14, + color: theme.colorScheme.secondary, + ), + strutStyle: const StrutStyle( + leading: 0, + height: 1, + fontSize: 14, + ), + TextSpan( + children: [ + TextSpan( + text: widget + .controller + .superResolutionType + .value + .title, ), - style: TextStyle( - height: 1, - fontSize: 14, - color: theme.colorScheme.secondary, + WidgetSpan( + alignment: .middle, + child: Icon( + MdiIcons.unfoldMoreHorizontal, + size: 14, + color: theme.colorScheme.secondary, + ), ), - ), - Icon( - MdiIcons.unfoldMoreHorizontal, - size: MediaQuery.textScalerOf( - context, - ).scale(14), - color: theme.colorScheme.secondary, - ), - ], + ], + ), ), ), onSelected: (value) { diff --git a/lib/pages/whisper_block/view.dart b/lib/pages/whisper_block/view.dart index 920f0045c..ca86e90e5 100644 --- a/lib/pages/whisper_block/view.dart +++ b/lib/pages/whisper_block/view.dart @@ -196,9 +196,10 @@ class _WhisperBlockPageState extends State { decoration: InputDecoration( isDense: true, hintText: '请输入', + visualDensity: .standard, hintStyle: const TextStyle(fontSize: 14), contentPadding: const EdgeInsets.symmetric( - horizontal: 14, + horizontal: 12, vertical: 6, ), border: const OutlineInputBorder(