From 1db3eb8acd00402afbdd69c41dcb8120faad3653 Mon Sep 17 00:00:00 2001 From: Hanh Date: Mon, 12 Dec 2022 17:51:26 +0800 Subject: [PATCH] Replace Cancel by Reset in Send page Both buttons take two lines --- lib/main.dart | 15 ++++----------- lib/send.dart | 10 +++++----- pubspec.yaml | 2 +- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 40d1de4..eb66721 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -443,27 +443,20 @@ GlobalKey(); List confirmButtons(BuildContext context, VoidCallback? onPressed, {String? okLabel, Icon? okIcon, cancelValue}) { + final s = S.of(context); final navigator = Navigator.of(context); return [ ElevatedButton.icon( icon: Icon(Icons.cancel), - label: Text(S - .of(context) - .cancel), + label: Text(s.cancel), onPressed: () { cancelValue != null ? navigator.pop(cancelValue) : navigator.pop(); }, style: ElevatedButton.styleFrom( - backgroundColor: Theme - .of(context) - .buttonTheme - .colorScheme! - .secondary)), + backgroundColor: Theme.of(context).colorScheme.secondary)), ElevatedButton.icon( icon: okIcon ?? Icon(Icons.done), - label: Text(okLabel ?? S - .of(context) - .ok), + label: Text(okLabel ?? s.ok), onPressed: onPressed, ) ]; diff --git a/lib/send.dart b/lib/send.dart index 6f03b2f..5c90636 100644 --- a/lib/send.dart +++ b/lib/send.dart @@ -116,6 +116,7 @@ class SendState extends State { @override Widget build(BuildContext context) { final s = S.of(context); + final t = Theme.of(context); final simpleMode = settings.simpleMode; if (!_memoInitialized) { _memoController.text = settings.memoSignature ?? s.sendFrom(APP_NAME); @@ -204,11 +205,10 @@ class SendState extends State { Padding(padding: EdgeInsets.all(8)), ButtonBar( children: [ - ElevatedButton.icon(onPressed: clear, icon: Icon(Icons.clear), label: Text(s.reset)), - ...confirmButtons(context, _onSend, - okLabel: widget.isMulti ? s.add : s.send, - okIcon: Icon(MdiIcons.send))]) - ]))))); + ElevatedButton.icon(onPressed: clear, icon: Icon(Icons.clear), label: Text(s.reset), style: ElevatedButton.styleFrom(backgroundColor: t.colorScheme.secondary)), + ElevatedButton.icon(onPressed: _onSend, icon: Icon(MdiIcons.send), label: Text(widget.isMulti ? s.add : s.send)) + ]) + ]))))); } Suggestion? getSuggestion(String v) { diff --git a/pubspec.yaml b/pubspec.yaml index 99d17fd..b9cb09f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.2.17+323 +version: 1.2.17+324 environment: sdk: ">=2.12.0 <3.0.0"