Skip to content

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

fix(ui): unify action button heights

Predidit2624e0c0f4a0
diff --git a/lib/bean/widget/state_presentation.dart b/lib/bean/widget/state_presentation.dart
index 89b58d23..9e7b823a 100644
--- a/lib/bean/widget/state_presentation.dart
+++ b/lib/bean/widget/state_presentation.dart
@@ -70,9 +70,8 @@ class StateActionButton extends StatelessWidget {
final String? reserveText;
final bool _tonal;
- @override
- Widget build(BuildContext context) {
- final style = ButtonStyle(
+ static ButtonStyle styleOf(BuildContext context) {
+ return ButtonStyle(
minimumSize: const WidgetStatePropertyAll(Size(64, 48)),
padding: const WidgetStatePropertyAll(
EdgeInsets.symmetric(horizontal: 24, vertical: 12)),
@@ -84,11 +83,15 @@ class StateActionButton extends StatelessWidget {
? Duration.zero
: const Duration(milliseconds: 200),
);
+ }
+
+ @override
+ Widget build(BuildContext context) {
final button = _tonal ? FilledButton.tonalIcon : FilledButton.icon;
final label = Text(text, textAlign: TextAlign.center);
return button(
onPressed: onPressed,
- style: style,
+ style: styleOf(context),
icon: icon == null ? null : Icon(icon, size: 20),
label: reserveText == null
? label
diff --git a/lib/pages/my/my_space_view.dart b/lib/pages/my/my_space_view.dart
index 89f0edc2..a38b0952 100644
--- a/lib/pages/my/my_space_view.dart
+++ b/lib/pages/my/my_space_view.dart
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
+import 'package:kazumi/bean/widget/state_presentation.dart';
import 'package:kazumi/modules/my/watch_stats.dart';
import 'package:material_new_shapes/material_new_shapes.dart';
@@ -478,21 +479,17 @@ class MySettingsButton extends StatelessWidget {
final colors = Theme.of(context).colorScheme;
return Tooltip(
message: '全部设置',
- child: _ExpressiveAction(
- color: colors.surfaceContainerHigh,
- foreground: colors.onSurface,
- onTap: onTap,
- child: const Padding(
- padding: EdgeInsets.symmetric(horizontal: 18, vertical: 14),
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Icon(Icons.tune_rounded, size: 20),
- SizedBox(width: 8),
- Text('设置'),
- ],
+ child: FilledButton.tonalIcon(
+ style: StateActionButton.styleOf(context).copyWith(
+ backgroundColor: WidgetStatePropertyAll(colors.surfaceContainerHigh),
+ foregroundColor: WidgetStatePropertyAll(colors.onSurface),
+ padding: const WidgetStatePropertyAll(
+ EdgeInsets.symmetric(horizontal: 18, vertical: 12),
),
),
+ onPressed: onTap,
+ icon: const Icon(Icons.tune_rounded, size: 20),
+ label: const Text('设置'),
),
);
}
diff --git a/lib/pages/timeline/timeline_options.dart b/lib/pages/timeline/timeline_options.dart
index 8c08a24d..a63ddb77 100644
--- a/lib/pages/timeline/timeline_options.dart
+++ b/lib/pages/timeline/timeline_options.dart
@@ -28,16 +28,18 @@ class _TimelineOptionsButton extends StatelessWidget {
final scaler = MediaQuery.textScalerOf(context);
final compact =
availableWidth < scaler.scale(16) * 22 || scaler.scale(14) > 28;
- const style = ButtonStyle(
- minimumSize: WidgetStatePropertyAll(Size(48, 48)),
- visualDensity: VisualDensity.standard,
+ final style = StateActionButton.styleOf(context).copyWith(
+ minimumSize: const WidgetStatePropertyAll(Size(48, 48)),
+ padding: const WidgetStatePropertyAll(
+ EdgeInsets.symmetric(horizontal: 16, vertical: 12),
+ ),
);
final summary = '${sort.label},'
'${filterCount > 0 ? '已启用 $filterCount 项筛选' : '未启用筛选'}';
final icon = Badge(
isLabelVisible: filterCount > 0,
label: Text('$filterCount'),
- child: const Icon(Icons.tune_rounded),
+ child: const Icon(Icons.tune_rounded, size: 20),
);
return Semantics(
label: _timelineOptionsTitle,
@@ -48,17 +50,13 @@ class _TimelineOptionsButton extends StatelessWidget {
child: Tooltip(
message: '$_timelineOptionsTitle:$summary',
child: compact
- ? IconButton.filledTonal(
+ ? FilledButton.tonal(
style: style,
onPressed: onPressed,
- icon: icon,
+ child: icon,
)
: FilledButton.tonalIcon(
- style: style.copyWith(
- padding: const WidgetStatePropertyAll(
- EdgeInsets.symmetric(horizontal: 16),
- ),
- ),
+ style: style,
onPressed: onPressed,
icon: icon,
label: Text(sort.label, maxLines: 1),