fix combox theme

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2023-03-01 19:31:52 +08:00
parent 556daeea71
commit 6267d56b45
2 changed files with 15 additions and 3 deletions

View File

@ -109,27 +109,32 @@ class IconFont {
class ColorThemeExtension extends ThemeExtension<ColorThemeExtension> { class ColorThemeExtension extends ThemeExtension<ColorThemeExtension> {
const ColorThemeExtension({ const ColorThemeExtension({
required this.border, required this.border,
required this.border2,
required this.highlight, required this.highlight,
}); });
final Color? border; final Color? border;
final Color? border2;
final Color? highlight; final Color? highlight;
static const light = ColorThemeExtension( static const light = ColorThemeExtension(
border: Color(0xFFCCCCCC), border: Color(0xFFCCCCCC),
border2: Color(0xFFBBBBBB),
highlight: Color(0xFFE5E5E5), highlight: Color(0xFFE5E5E5),
); );
static const dark = ColorThemeExtension( static const dark = ColorThemeExtension(
border: Color(0xFF555555), border: Color(0xFF555555),
border2: Color(0xFFE5E5E5),
highlight: Color(0xFF3F3F3F), highlight: Color(0xFF3F3F3F),
); );
@override @override
ThemeExtension<ColorThemeExtension> copyWith( ThemeExtension<ColorThemeExtension> copyWith(
{Color? border, Color? highlight}) { {Color? border, Color? border2, Color? highlight}) {
return ColorThemeExtension( return ColorThemeExtension(
border: border ?? this.border, border: border ?? this.border,
border2: border2 ?? this.border2,
highlight: highlight ?? this.highlight, highlight: highlight ?? this.highlight,
); );
} }
@ -142,6 +147,7 @@ class ColorThemeExtension extends ThemeExtension<ColorThemeExtension> {
} }
return ColorThemeExtension( return ColorThemeExtension(
border: Color.lerp(border, other.border, t), border: Color.lerp(border, other.border, t),
border2: Color.lerp(border2, other.border2, t),
highlight: Color.lerp(highlight, other.highlight, t), highlight: Color.lerp(highlight, other.highlight, t),
); );
} }

View File

@ -1738,7 +1738,10 @@ class _ComboBox extends StatelessWidget {
return Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
color: _disabledTextColor(context, enabled) ?? MyTheme.border)), color: enabled
? MyTheme.color(context).border2 ?? MyTheme.border
: MyTheme.border,
)),
height: 30, height: 30,
child: Obx(() => DropdownButton<String>( child: Obx(() => DropdownButton<String>(
isExpanded: true, isExpanded: true,
@ -1747,7 +1750,10 @@ class _ComboBox extends StatelessWidget {
underline: Container( underline: Container(
height: 25, height: 25,
), ),
style: TextStyle(color: _disabledTextColor(context, enabled)), style: TextStyle(
color: enabled
? Theme.of(context).textTheme.titleMedium?.color
: _disabledTextColor(context, enabled)),
icon: const Icon( icon: const Icon(
Icons.expand_more_sharp, Icons.expand_more_sharp,
size: 20, size: 20,