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

View File

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

View File

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

View File

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