fix(ui): make mobile task creation button compact

This commit is contained in:
Levi committed 2026-09-12 17:28:42 +08:00
1 parent 1fc0ff6738
commit 75462fe2be
3 files changed
+17 -6

No files matched your search

@@ -827,7 +827,8 @@ class _MobileTasksHeader extends StatelessWidget {
child: TaskCreateButton(
key: const ValueKey('tasks-mobile-create-button'),
onPressed: onAddTask,
minHeight: 44,
minHeight: 34,
compact: true,
),
),
const SizedBox(width: 8),
@@ -1,3 +1,4 @@
import 'package:shadcn_flutter/shadcn_flutter.dart' as shad;
import 'package:flutter/material.dart' show Icons;
import 'package:flutter/widgets.dart';
@@ -7,10 +8,11 @@ import '../../../../shared/widgets/app_primary_button.dart';
/// Shared creation action for task headers and empty-list guidance.
class TaskCreateButton extends StatelessWidget {
const TaskCreateButton({super.key, required this.onPressed, this.minHeight = 0});
const TaskCreateButton({super.key, required this.onPressed, this.minHeight = 0, this.compact = false});
final VoidCallback onPressed;
final double minHeight;
final bool compact;
@override
Widget build(BuildContext context) {
@@ -18,12 +20,20 @@ class TaskCreateButton extends StatelessWidget {
constraints: BoxConstraints(minHeight: minHeight),
child: AppPrimaryButton(
onPressed: onPressed,
size: compact ? shad.ButtonSize.small : shad.ButtonSize.normal,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(Icons.add),
const SizedBox(width: AppDesignTokens.space8),
Flexible(child: Text(context.l10n.create, maxLines: 1, overflow: TextOverflow.ellipsis)),
Icon(Icons.add, size: compact ? 16 : null),
SizedBox(width: compact ? AppDesignTokens.space4 : AppDesignTokens.space8),
Flexible(
child: Text(
context.l10n.create,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: compact ? const TextStyle(fontSize: 13) : null,
),
),
],
),
),
+1 -1
View File
@@ -440,7 +440,7 @@ void main() {
expect(find.text('Failed 0'), findsOneWidget);
expect(find.text('Create Task'), findsNWidgets(2));
final headerCreate = find.byKey(const ValueKey('tasks-mobile-create-button'));
expect(tester.getSize(headerCreate).height, greaterThanOrEqualTo(44));
expect(tester.getSize(headerCreate).height, 34);
expect(tester.getBottomLeft(headerCreate).dy, lessThan(tester.getTopLeft(find.text('Downloading 0')).dy));
for (final size in [const Size(320, 568), const Size(768, 1024)]) {
tester.view.physicalSize = size;