Replace Cancel by Reset in Send page

Both buttons take two lines
This commit is contained in:
Hanh 2022-12-12 17:51:26 +08:00
parent e903096fea
commit 1db3eb8acd
3 changed files with 10 additions and 17 deletions

View File

@ -443,27 +443,20 @@ GlobalKey<ScaffoldMessengerState>();
List<ElevatedButton> confirmButtons(BuildContext context,
VoidCallback? onPressed,
{String? okLabel, Icon? okIcon, cancelValue}) {
final s = S.of(context);
final navigator = Navigator.of(context);
return <ElevatedButton>[
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,
)
];

View File

@ -116,6 +116,7 @@ class SendState extends State<SendPage> {
@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,10 +205,9 @@ class SendState extends State<SendPage> {
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))
])
])))));
}

View File

@ -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"