2022-04-08 05:59:20 +00:00
|
|
|
import 'dart:ui';
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
extension CustomColorScheme on ColorScheme {
|
|
|
|
Color get defaultTextColor =>
|
|
|
|
brightness == Brightness.light ? Colors.black : Colors.white;
|
|
|
|
|
2022-05-05 07:02:00 +00:00
|
|
|
Color get inverseTextColor =>
|
|
|
|
brightness == Brightness.light ? Colors.white : Colors.black;
|
|
|
|
|
|
|
|
Color get inverseIconColor =>
|
|
|
|
brightness == Brightness.light ? Colors.white : Colors.black;
|
|
|
|
|
2022-04-08 05:59:20 +00:00
|
|
|
Color get boxSelectColor => brightness == Brightness.light
|
|
|
|
? Color.fromRGBO(67, 186, 108, 1)
|
|
|
|
: Color.fromRGBO(16, 32, 32, 1);
|
|
|
|
|
|
|
|
Color get boxUnSelectColor => brightness == Brightness.light
|
|
|
|
? Color.fromRGBO(240, 240, 240, 1)
|
|
|
|
: Color.fromRGBO(8, 18, 18, 0.4);
|
|
|
|
|
2022-04-22 11:32:20 +00:00
|
|
|
Color get dynamicFABBackgroundColor =>
|
2022-04-08 05:59:20 +00:00
|
|
|
brightness == Brightness.light ? Colors.black : Colors.grey[850];
|
|
|
|
|
2022-04-22 11:32:20 +00:00
|
|
|
Color get dynamicFABTextColor => Colors.white; //same for both themes
|
2022-04-08 05:59:20 +00:00
|
|
|
|
|
|
|
// todo: use brightness == Brightness.light for changing color for dark/light theme
|
|
|
|
ButtonStyle get optionalActionButtonStyle => buildElevatedButtonThemeData(
|
2022-04-21 09:43:22 +00:00
|
|
|
onPrimary: Color(0xFF777777),
|
|
|
|
primary: Color(0xFFF0F0F0),
|
|
|
|
elevation: 0)
|
|
|
|
.style;
|
2022-04-28 02:11:42 +00:00
|
|
|
|
|
|
|
Color get recoveryKeyBoxColor => brightness == Brightness.light
|
|
|
|
? Color.fromRGBO(49, 155, 86, 0.2)
|
|
|
|
: Color(0xFF1DB954);
|
2022-05-04 11:08:06 +00:00
|
|
|
|
|
|
|
Color get frostyBlurBackdropFilterColor =>
|
|
|
|
brightness == Brightness.light ? Colors.black : Colors.white;
|
|
|
|
|
|
|
|
Color get cancelSelectedButtonColor => brightness == Brightness.light
|
|
|
|
? Color.fromARGB(255, 225, 225, 225)
|
|
|
|
: Color.fromARGB(255, 30, 30, 30);
|
2022-04-08 05:59:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
OutlinedButtonThemeData buildOutlinedButtonThemeData(
|
|
|
|
{Color bgDisabled, Color bgEnabled, Color fgDisabled, Color fgEnabled}) {
|
|
|
|
return OutlinedButtonThemeData(
|
|
|
|
style: OutlinedButton.styleFrom(
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
padding: EdgeInsets.fromLTRB(50, 16, 50, 16),
|
|
|
|
textStyle: TextStyle(
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
fontFamily: 'Inter-SemiBold',
|
|
|
|
fontSize: 18,
|
|
|
|
),
|
|
|
|
).copyWith(
|
|
|
|
backgroundColor: MaterialStateProperty.resolveWith<Color>(
|
|
|
|
(Set<MaterialState> states) {
|
|
|
|
if (states.contains(MaterialState.disabled)) {
|
|
|
|
return bgDisabled;
|
|
|
|
}
|
|
|
|
return bgEnabled;
|
|
|
|
},
|
|
|
|
),
|
|
|
|
foregroundColor: MaterialStateProperty.resolveWith<Color>(
|
|
|
|
(Set<MaterialState> states) {
|
|
|
|
if (states.contains(MaterialState.disabled)) {
|
|
|
|
return fgDisabled;
|
|
|
|
}
|
|
|
|
return fgEnabled;
|
|
|
|
},
|
|
|
|
),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
ElevatedButtonThemeData buildElevatedButtonThemeData(
|
|
|
|
{@required Color onPrimary, // text button color
|
2022-04-21 09:43:22 +00:00
|
|
|
@required Color primary,
|
|
|
|
double elevation = 2 // background color of button
|
2022-04-08 05:59:20 +00:00
|
|
|
}) {
|
|
|
|
return ElevatedButtonThemeData(
|
|
|
|
style: ElevatedButton.styleFrom(
|
2022-04-21 09:43:22 +00:00
|
|
|
elevation: elevation,
|
2022-04-08 05:59:20 +00:00
|
|
|
onPrimary: onPrimary,
|
|
|
|
primary: primary,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
textStyle: TextStyle(
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
fontFamily: 'Inter-SemiBold',
|
|
|
|
fontSize: 18,
|
|
|
|
),
|
2022-04-21 09:43:22 +00:00
|
|
|
padding: EdgeInsets.symmetric(vertical: 18),
|
2022-04-08 05:59:20 +00:00
|
|
|
shape: const RoundedRectangleBorder(
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(8)),
|
|
|
|
),
|
|
|
|
));
|
|
|
|
}
|
2022-04-21 05:12:18 +00:00
|
|
|
|
|
|
|
TextStyle gradientButtonTextTheme() {
|
|
|
|
return TextStyle(
|
|
|
|
color: Colors.white,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
fontFamily: 'Inter-SemiBold',
|
|
|
|
fontSize: 18,
|
|
|
|
);
|
|
|
|
}
|