mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-13 20:03:46 +00:00
fix(ui): make mobile task creation button compact
This commit is contained in:
1 parent
1fc0ff6738
commit
75462fe2be
3 files changed
+17
-6
No files matched your search
@@ -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,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user