Page Install. Reset styles for buttons.

This commit is contained in:
grummbeer 2023-06-05 16:56:30 +02:00
parent a029bd9a92
commit d90201f874

View File

@ -70,6 +70,12 @@ class _InstallPageBodyState extends State<_InstallPageBody>
final RxBool showProgress = false.obs; final RxBool showProgress = false.obs;
final RxBool btnEnabled = true.obs; final RxBool btnEnabled = true.obs;
// todo move to theme.
final buttonStyle = OutlinedButton.styleFrom(
textStyle: TextStyle(fontSize: 14, fontWeight: FontWeight.normal),
padding: EdgeInsets.symmetric(vertical: 15, horizontal: 12),
);
@override @override
void initState() { void initState() {
windowManager.addListener(this); windowManager.addListener(this);
@ -94,14 +100,7 @@ class _InstallPageBodyState extends State<_InstallPageBody>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final double em = 13; final double em = 13;
final btnFontSize = 0.9 * em;
final double button_radius = 6;
final isDarkTheme = MyTheme.currentThemeMode() == ThemeMode.dark; final isDarkTheme = MyTheme.currentThemeMode() == ThemeMode.dark;
final buttonStyle = OutlinedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(button_radius)),
));
final textColor = isDarkTheme ? null : Colors.black87;
final dividerColor = isDarkTheme ? Colors.white70 : Colors.black87; final dividerColor = isDarkTheme ? Colors.white70 : Colors.black87;
return Scaffold( return Scaffold(
backgroundColor: null, backgroundColor: null,
@ -130,12 +129,14 @@ class _InstallPageBodyState extends State<_InstallPageBody>
), ),
).marginOnly(right: 10), ).marginOnly(right: 10),
), ),
Obx(() => OutlinedButton( Obx(
() => OutlinedButton.icon(
icon: Icon(Icons.folder_outlined, size: 16),
onPressed: btnEnabled.value ? selectInstallPath : null, onPressed: btnEnabled.value ? selectInstallPath : null,
style: buttonStyle, style: buttonStyle,
child: Text(translate('Change Path'), label: Text(translate('Change Path')),
style: TextStyle( ),
color: textColor, fontSize: btnFontSize)))) )
], ],
).marginSymmetric(vertical: 2 * em), ).marginSymmetric(vertical: 2 * em),
InkWell( InkWell(
@ -217,38 +218,35 @@ class _InstallPageBodyState extends State<_InstallPageBody>
offstage: !showProgress.value, offstage: !showProgress.value,
child: LinearProgressIndicator(), child: LinearProgressIndicator(),
))), ))),
Obx(() => OutlinedButton( Obx(
onPressed: btnEnabled.value () => OutlinedButton.icon(
? () => windowManager.close() icon: Icon(Icons.close_rounded, size: 16),
: null, label: Text(translate('Cancel')),
onPressed:
btnEnabled.value ? () => windowManager.close() : null,
style: buttonStyle, style: buttonStyle,
child: Text(translate('Cancel'), ).marginOnly(right: 10),
style: TextStyle( ),
color: textColor, fontSize: btnFontSize))) Obx(
.marginSymmetric(horizontal: 2 * em)), () => ElevatedButton.icon(
Obx(() => ElevatedButton( icon: Icon(Icons.done_rounded, size: 16),
label: Text(translate('Accept and Install')),
onPressed: btnEnabled.value ? install : null, onPressed: btnEnabled.value ? install : null,
style: ElevatedButton.styleFrom( style: buttonStyle,
primary: MyTheme.button, ),
shape: RoundedRectangleBorder( ),
borderRadius: BorderRadius.all(
Radius.circular(button_radius)),
)),
child: Text(
translate('Accept and Install'),
style: TextStyle(fontSize: btnFontSize),
))),
Offstage( Offstage(
offstage: bind.installShowRunWithoutInstall(), offstage: bind.installShowRunWithoutInstall(),
child: Obx(() => OutlinedButton( child: Obx(
() => OutlinedButton.icon(
icon: Icon(Icons.screen_share_outlined, size: 16),
label: Text(translate('Run without install')),
onPressed: btnEnabled.value onPressed: btnEnabled.value
? () => bind.installRunWithoutInstall() ? () => bind.installRunWithoutInstall()
: null, : null,
style: buttonStyle, style: buttonStyle,
child: Text(translate('Run without install'), ).marginOnly(left: 10),
style: TextStyle( ),
color: textColor, fontSize: btnFontSize)))
.marginOnly(left: 2 * em)),
), ),
], ],
) )
@ -271,21 +269,21 @@ class _InstallPageBodyState extends State<_InstallPageBody>
if (driverCert.isTrue) { if (driverCert.isTrue) {
final tag = 'install-info-install-cert-confirm'; final tag = 'install-info-install-cert-confirm';
final btns = [ final btns = [
dialogButton( OutlinedButton.icon(
'Cancel', icon: Icon(Icons.close_rounded, size: 16),
icon: Icon(Icons.close_rounded), label: Text(translate('Cancel')),
onPressed: () => gFFI.dialogManager.dismissByTag(tag), onPressed: () => gFFI.dialogManager.dismissByTag(tag),
isOutline: true, style: buttonStyle,
), ),
dialogButton( ElevatedButton.icon(
'OK', icon: Icon(Icons.done_rounded, size: 16),
icon: Icon(Icons.done_rounded), label: Text(translate('OK')),
onPressed: () { onPressed: () {
gFFI.dialogManager.dismissByTag(tag); gFFI.dialogManager.dismissByTag(tag);
do_install(); do_install();
}, },
isOutline: false, style: buttonStyle,
), )
]; ];
gFFI.dialogManager.show( gFFI.dialogManager.show(
(setState, close, context) => CustomAlertDialog( (setState, close, context) => CustomAlertDialog(