Skip to content

Commit

Permalink
action_sheet: Put a height constraint on cancel button
Browse files Browse the repository at this point in the history
With a small font size, the button can be shorter than the Figma design.

See:
  https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=3479-26262&node-type=symbol&t=hGZtzX2QTLse81un-0

Signed-off-by: Zixuan James Li <[email protected]>
  • Loading branch information
PIG208 committed Dec 4, 2024
1 parent e40b39d commit c9b66c4
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions lib/widgets/action_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -167,23 +167,24 @@ class ActionSheetCancelButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
final designVariables = DesignVariables.of(context);
return TextButton(
style: TextButton.styleFrom(
padding: const EdgeInsets.all(10),
foregroundColor: designVariables.contextMenuCancelText,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(7)),
splashFactory: NoSplash.splashFactory,
).copyWith(backgroundColor: WidgetStateColor.fromMap({
WidgetState.pressed: designVariables.contextMenuCancelPressedBg,
~WidgetState.pressed: designVariables.contextMenuCancelBg,
})),
onPressed: () {
Navigator.pop(context);
},
child: Text(ZulipLocalizations.of(context).dialogCancel,
style: const TextStyle(fontSize: 20, height: 24 / 20)
.merge(weightVariableTextStyle(context, wght: 600))),
);
return ConstrainedBox(
constraints: const BoxConstraints(minHeight: 44),
child: TextButton(
style: TextButton.styleFrom(
padding: const EdgeInsets.all(10),
foregroundColor: designVariables.contextMenuCancelText,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(7)),
splashFactory: NoSplash.splashFactory,
).copyWith(backgroundColor: WidgetStateColor.fromMap({
WidgetState.pressed: designVariables.contextMenuCancelPressedBg,
~WidgetState.pressed: designVariables.contextMenuCancelBg,
})),
onPressed: () {
Navigator.pop(context);
},
child: Text(ZulipLocalizations.of(context).dialogCancel,
style: const TextStyle(fontSize: 20, height: 24 / 20)
.merge(weightVariableTextStyle(context, wght: 600)))));
}
}

Expand Down

0 comments on commit c9b66c4

Please sign in to comment.