Reapply "Fix lint warnings"

This reverts commit 8aa83934ee.
This commit is contained in:
Ming Ming 2024-09-27 21:12:21 +08:00
parent 3537981be1
commit f8f73150cf
4 changed files with 23 additions and 23 deletions

View file

@ -69,8 +69,8 @@ class DarkModeSwitchTheme extends StatelessWidget {
return Theme( return Theme(
data: theme.copyWith( data: theme.copyWith(
switchTheme: SwitchThemeData( switchTheme: SwitchThemeData(
trackColor: MaterialStateProperty.all(theme.colorScheme.surface), trackColor: WidgetStateProperty.all(theme.colorScheme.surface),
thumbColor: MaterialStateProperty.all(Colors.black87), thumbColor: WidgetStateProperty.all(Colors.black87),
), ),
colorScheme: theme.colorScheme.copyWith( colorScheme: theme.colorScheme.copyWith(
outline: Colors.transparent, outline: Colors.transparent,
@ -165,32 +165,32 @@ ThemeData _applyColorScheme(ColorScheme colorScheme) {
// remove after checkbox supports m3 // remove after checkbox supports m3
// see: https://m3.material.io/components/checkbox/specs // see: https://m3.material.io/components/checkbox/specs
checkboxTheme: CheckboxThemeData( checkboxTheme: CheckboxThemeData(
fillColor: MaterialStateProperty.resolveWith((states) { fillColor: WidgetStateProperty.resolveWith((states) {
if (states.contains(MaterialState.disabled)) { if (states.contains(WidgetState.disabled)) {
return Colors.transparent; return Colors.transparent;
} else { } else {
if (states.contains(MaterialState.selected)) { if (states.contains(WidgetState.selected)) {
return colorScheme.secondary; return colorScheme.secondary;
} else { } else {
return Colors.transparent; return Colors.transparent;
} }
} }
}), }),
checkColor: MaterialStateProperty.all(colorScheme.onPrimary), checkColor: WidgetStateProperty.all(colorScheme.onPrimary),
), ),
// remove after checkbox supports m3 // remove after checkbox supports m3
// see: https://m3.material.io/components/switch/specs // see: https://m3.material.io/components/switch/specs
// the color here is slightly modified to work better with the M2 switch // the color here is slightly modified to work better with the M2 switch
switchTheme: SwitchThemeData( switchTheme: SwitchThemeData(
trackColor: MaterialStateProperty.resolveWith((states) { trackColor: WidgetStateProperty.resolveWith((states) {
if (states.contains(MaterialState.disabled)) { if (states.contains(WidgetState.disabled)) {
if (states.contains(MaterialState.selected)) { if (states.contains(WidgetState.selected)) {
return colorScheme.onSurface.withOpacity(.12); return colorScheme.onSurface.withOpacity(.12);
} else { } else {
return colorScheme.surfaceVariant.withOpacity(.12); return colorScheme.surfaceVariant.withOpacity(.12);
} }
} else { } else {
if (states.contains(MaterialState.selected)) { if (states.contains(WidgetState.selected)) {
// return colorScheme.primary; // return colorScheme.primary;
return colorScheme.secondary; return colorScheme.secondary;
} else { } else {
@ -198,16 +198,16 @@ ThemeData _applyColorScheme(ColorScheme colorScheme) {
} }
} }
}), }),
thumbColor: MaterialStateProperty.resolveWith((states) { thumbColor: WidgetStateProperty.resolveWith((states) {
if (states.contains(MaterialState.disabled)) { if (states.contains(WidgetState.disabled)) {
if (states.contains(MaterialState.selected)) { if (states.contains(WidgetState.selected)) {
// return colorScheme.surface; // return colorScheme.surface;
return colorScheme.onSurface.withOpacity(.38); return colorScheme.onSurface.withOpacity(.38);
} else { } else {
return colorScheme.onSurface.withOpacity(.38); return colorScheme.onSurface.withOpacity(.38);
} }
} else { } else {
if (states.contains(MaterialState.selected)) { if (states.contains(WidgetState.selected)) {
// return colorScheme.onPrimary; // return colorScheme.onPrimary;
return colorScheme.onSecondary; return colorScheme.onSecondary;
} else { } else {
@ -232,17 +232,17 @@ ThemeData _applyColorScheme(ColorScheme colorScheme) {
elevatedButtonTheme: ElevatedButtonThemeData( elevatedButtonTheme: ElevatedButtonThemeData(
style: ButtonStyle( style: ButtonStyle(
backgroundColor: backgroundColor:
MaterialStateProperty.all(colorScheme.secondaryContainer), WidgetStateProperty.all(colorScheme.secondaryContainer),
foregroundColor: MaterialStateProperty.all(colorScheme.secondary), foregroundColor: WidgetStateProperty.all(colorScheme.secondary),
overlayColor: overlayColor:
MaterialStateProperty.all(colorScheme.secondary.withOpacity(.1)), WidgetStateProperty.all(colorScheme.secondary.withOpacity(.1)),
), ),
), ),
textButtonTheme: TextButtonThemeData( textButtonTheme: TextButtonThemeData(
style: ButtonStyle( style: ButtonStyle(
foregroundColor: MaterialStateProperty.all(colorScheme.secondary), foregroundColor: WidgetStateProperty.all(colorScheme.secondary),
overlayColor: overlayColor:
MaterialStateProperty.all(colorScheme.secondary.withOpacity(.1)), WidgetStateProperty.all(colorScheme.secondary.withOpacity(.1)),
), ),
), ),
textSelectionTheme: TextSelectionThemeData( textSelectionTheme: TextSelectionThemeData(

View file

@ -278,7 +278,7 @@ class _ChangelogBanner extends StatelessWidget {
child: TextButtonTheme( child: TextButtonTheme(
data: TextButtonThemeData( data: TextButtonThemeData(
style: ButtonStyle( style: ButtonStyle(
foregroundColor: MaterialStateProperty.all( foregroundColor: WidgetStateProperty.all(
Theme.of(context).colorScheme.primary), Theme.of(context).colorScheme.primary),
), ),
), ),

View file

@ -152,7 +152,7 @@ class DirPickerState extends State<DirPicker> {
: Icons.radio_button_checked; : Icons.radio_button_checked;
iconColor = CheckboxTheme.of(context) iconColor = CheckboxTheme.of(context)
.fillColor! .fillColor!
.resolve({MaterialState.selected}); .resolve({WidgetState.selected});
break; break;
case _PickState.childPicked: case _PickState.childPicked:
@ -161,7 +161,7 @@ class DirPickerState extends State<DirPicker> {
: Icons.remove_circle_outline; : Icons.remove_circle_outline;
iconColor = CheckboxTheme.of(context) iconColor = CheckboxTheme.of(context)
.fillColor! .fillColor!
.resolve({MaterialState.selected}); .resolve({WidgetState.selected});
break; break;
case _PickState.notPicked: case _PickState.notPicked:

View file

@ -44,7 +44,7 @@ class _SignInState extends State<SignIn> {
), ),
textButtonTheme: TextButtonThemeData( textButtonTheme: TextButtonThemeData(
style: ButtonStyle( style: ButtonStyle(
foregroundColor: MaterialStateProperty.all(Colors.white), foregroundColor: WidgetStateProperty.all(Colors.white),
), ),
), ),
), ),