prefere MaterialStatePropertyAll to MaterialStateProperty.all and other fixes

This commit is contained in:
NicKoehler 2023-03-01 16:35:51 +01:00
parent fd8829f08e
commit 55831948f8
No known key found for this signature in database
GPG Key ID: BAE01394EB51AC58
4 changed files with 82 additions and 62 deletions

View File

@ -209,7 +209,7 @@ class MyTheme {
? TextButtonThemeData( ? TextButtonThemeData(
style: ButtonStyle( style: ButtonStyle(
splashFactory: NoSplash.splashFactory, splashFactory: NoSplash.splashFactory,
shape: MaterialStateProperty.all<RoundedRectangleBorder>( shape: MaterialStatePropertyAll<RoundedRectangleBorder>(
RoundedRectangleBorder( RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18.0), borderRadius: BorderRadius.circular(18.0),
), ),
@ -219,10 +219,10 @@ class MyTheme {
: null, : null,
elevatedButtonTheme: ElevatedButtonThemeData( elevatedButtonTheme: ElevatedButtonThemeData(
style: ButtonStyle( style: ButtonStyle(
backgroundColor: MaterialStateProperty.all( backgroundColor: MaterialStatePropertyAll(
MyTheme.accent, MyTheme.accent,
), ),
shape: MaterialStateProperty.all<RoundedRectangleBorder>( shape: MaterialStatePropertyAll<RoundedRectangleBorder>(
RoundedRectangleBorder( RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(8.0),
), ),
@ -231,11 +231,11 @@ class MyTheme {
), ),
outlinedButtonTheme: OutlinedButtonThemeData( outlinedButtonTheme: OutlinedButtonThemeData(
style: ButtonStyle( style: ButtonStyle(
backgroundColor: MaterialStateProperty.all( backgroundColor: MaterialStatePropertyAll(
Color(0xFFEEEEEE), Color(0xFFEEEEEE),
), ),
foregroundColor: MaterialStateProperty.all(Colors.black87), foregroundColor: MaterialStatePropertyAll(Colors.black87),
shape: MaterialStateProperty.all<RoundedRectangleBorder>( shape: MaterialStatePropertyAll<RoundedRectangleBorder>(
RoundedRectangleBorder( RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(8.0),
), ),
@ -313,7 +313,7 @@ class MyTheme {
? TextButtonThemeData( ? TextButtonThemeData(
style: ButtonStyle( style: ButtonStyle(
splashFactory: NoSplash.splashFactory, splashFactory: NoSplash.splashFactory,
shape: MaterialStateProperty.all<RoundedRectangleBorder>( shape: MaterialStatePropertyAll<RoundedRectangleBorder>(
RoundedRectangleBorder( RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18.0), borderRadius: BorderRadius.circular(18.0),
), ),
@ -323,10 +323,10 @@ class MyTheme {
: null, : null,
elevatedButtonTheme: ElevatedButtonThemeData( elevatedButtonTheme: ElevatedButtonThemeData(
style: ButtonStyle( style: ButtonStyle(
backgroundColor: MaterialStateProperty.all( backgroundColor: MaterialStatePropertyAll(
MyTheme.accent, MyTheme.accent,
), ),
shape: MaterialStateProperty.all<RoundedRectangleBorder>( shape: MaterialStatePropertyAll<RoundedRectangleBorder>(
RoundedRectangleBorder( RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(8.0),
), ),
@ -341,8 +341,8 @@ class MyTheme {
side: MaterialStatePropertyAll( side: MaterialStatePropertyAll(
BorderSide(color: Colors.white12, width: 0.5), BorderSide(color: Colors.white12, width: 0.5),
), ),
foregroundColor: MaterialStateProperty.all(Colors.white70), foregroundColor: MaterialStatePropertyAll(Colors.white70),
shape: MaterialStateProperty.all<RoundedRectangleBorder>( shape: MaterialStatePropertyAll<RoundedRectangleBorder>(
RoundedRectangleBorder( RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(8.0),
), ),

View File

@ -411,17 +411,18 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
borderRadius: BorderRadius.all(Radius.circular(10)), borderRadius: BorderRadius.all(Radius.circular(10)),
), ),
child: SingleChildScrollView( child: SingleChildScrollView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
child: Theme( child: Theme(
data: themeData(), data: themeData(),
child: MenuBar( child: MenuBar(
children: [ children: [
SizedBox(width: _MenubarTheme.buttonHMargin), SizedBox(width: _MenubarTheme.buttonHMargin),
...menubarItems, ...menubarItems,
SizedBox(width: _MenubarTheme.buttonHMargin) SizedBox(width: _MenubarTheme.buttonHMargin)
], ],
), ),
)), ),
),
), ),
_buildDraggableShowHide(context), _buildDraggableShowHide(context),
], ],
@ -431,10 +432,13 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
ThemeData themeData() { ThemeData themeData() {
return Theme.of(context).copyWith( return Theme.of(context).copyWith(
menuButtonTheme: MenuButtonThemeData( menuButtonTheme: MenuButtonThemeData(
style: ButtonStyle( style: ButtonStyle(
minimumSize: MaterialStatePropertyAll(Size(64, 36)), minimumSize: MaterialStatePropertyAll(Size(64, 36)),
textStyle: MaterialStatePropertyAll( textStyle: MaterialStatePropertyAll(
TextStyle(fontWeight: FontWeight.normal)))), TextStyle(fontWeight: FontWeight.normal),
),
),
),
dividerTheme: DividerThemeData(space: 4), dividerTheme: DividerThemeData(space: 4),
); );
} }
@ -662,37 +666,38 @@ class _ControlMenu extends StatelessWidget {
Text(translate('OS Password')).paddingOnly(left: 10), Text(translate('OS Password')).paddingOnly(left: 10),
], ],
), ),
content: Column(mainAxisSize: MainAxisSize.min, children: [ content: Column(
PasswordWidget(controller: controller), mainAxisSize: MainAxisSize.min,
CheckboxListTile( children: [
contentPadding: const EdgeInsets.all(0), PasswordWidget(controller: controller),
dense: true, CheckboxListTile(
controlAffinity: ListTileControlAffinity.leading, contentPadding: const EdgeInsets.all(0),
title: Text( dense: true,
translate('Auto Login'), controlAffinity: ListTileControlAffinity.leading,
title: Text(
translate('Auto Login'),
),
value: autoLogin,
onChanged: (v) {
if (v == null) return;
setState(() => autoLogin = v);
},
), ),
value: autoLogin, ],
onChanged: (v) { ),
if (v == null) return; actions: [
setState(() => autoLogin = v); dialogButton(
}, "Cancel",
icon: Icon(Icons.close_rounded),
onPressed: close,
isOutline: true,
), ),
Row( dialogButton(
mainAxisAlignment: MainAxisAlignment.spaceBetween, "OK",
children: [ icon: Icon(Icons.done_rounded),
ElevatedButton.icon( onPressed: submit,
icon: Icon(Icons.close_rounded), ),
label: Text(translate("Cancel")), ],
onPressed: close,
),
ElevatedButton.icon(
icon: Icon(Icons.done_rounded),
label: Text(translate("Ok")),
onPressed: submit,
),
],
).paddingOnly(top: 20)
]),
onSubmit: submit, onSubmit: submit,
onCancel: close, onCancel: close,
); );

View File

@ -427,7 +427,7 @@ class ConnectionManager extends StatelessWidget {
? ElevatedButton.icon( ? ElevatedButton.icon(
style: ButtonStyle( style: ButtonStyle(
backgroundColor: backgroundColor:
MaterialStateProperty.all(Colors.red)), MaterialStatePropertyAll(Colors.red)),
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
onPressed: () { onPressed: () {
bind.cmCloseConnection(connId: client.id); bind.cmCloseConnection(connId: client.id);

View File

@ -708,9 +708,10 @@ class FileModel extends ChangeNotifier {
return CustomAlertDialog( return CustomAlertDialog(
title: Row( title: Row(
children: [ children: [
const Icon(Icons.warning, color: Colors.red), const Icon(Icons.warning_rounded, color: Colors.red),
const SizedBox(width: 20), Text(title).paddingOnly(
Text(title) left: 10,
),
], ],
), ),
contentBoxConstraints: contentBoxConstraints:
@ -740,9 +741,23 @@ class FileModel extends ChangeNotifier {
: const SizedBox.shrink() : const SizedBox.shrink()
]), ]),
actions: [ actions: [
dialogButton("Cancel", onPressed: cancel, isOutline: true), dialogButton(
dialogButton("Skip", onPressed: () => close(null), isOutline: true), "Cancel",
dialogButton("OK", onPressed: submit), icon: Icon(Icons.close_rounded),
onPressed: cancel,
isOutline: true,
),
dialogButton(
"Skip",
icon: Icon(Icons.navigate_next_rounded),
onPressed: () => close(null),
isOutline: true,
),
dialogButton(
"OK",
icon: Icon(Icons.done_rounded),
onPressed: submit,
),
], ],
onSubmit: submit, onSubmit: submit,
onCancel: cancel, onCancel: cancel,