ui cleanup

This commit is contained in:
Christien Rioux 2025-03-17 00:51:16 -04:00
parent d460a0388c
commit 77c68aa45f
57 changed files with 1158 additions and 914 deletions

View file

@ -22,39 +22,42 @@ class MenuItemWidget extends StatelessWidget {
this.footerButtonIconHoverColor,
this.footerButtonIconFocusColor,
this.footerCallback,
this.minHeight = 0,
super.key,
});
@override
Widget build(BuildContext context) => TextButton(
onPressed: callback,
style: TextButton.styleFrom(foregroundColor: foregroundColor).copyWith(
backgroundColor: WidgetStateProperty.resolveWith((states) {
if (states.contains(WidgetState.hovered)) {
return backgroundHoverColor;
}
if (states.contains(WidgetState.focused)) {
return backgroundFocusColor;
}
return backgroundColor;
}),
side: WidgetStateBorderSide.resolveWith((states) {
if (states.contains(WidgetState.hovered)) {
return borderColor != null
? BorderSide(width: 2, color: borderHoverColor!)
: null;
}
if (states.contains(WidgetState.focused)) {
return borderColor != null
? BorderSide(width: 2, color: borderFocusColor!)
: null;
}
onPressed: callback,
style: TextButton.styleFrom(foregroundColor: foregroundColor).copyWith(
backgroundColor: WidgetStateProperty.resolveWith((states) {
if (states.contains(WidgetState.hovered)) {
return backgroundHoverColor;
}
if (states.contains(WidgetState.focused)) {
return backgroundFocusColor;
}
return backgroundColor;
}),
side: WidgetStateBorderSide.resolveWith((states) {
if (states.contains(WidgetState.hovered)) {
return borderColor != null
? BorderSide(width: 2, color: borderColor!)
? BorderSide(width: 2, color: borderHoverColor!)
: null;
}),
shape: WidgetStateProperty.all(RoundedRectangleBorder(
borderRadius: BorderRadius.circular(borderRadius ?? 0)))),
}
if (states.contains(WidgetState.focused)) {
return borderColor != null
? BorderSide(width: 2, color: borderFocusColor!)
: null;
}
return borderColor != null
? BorderSide(width: 2, color: borderColor!)
: null;
}),
shape: WidgetStateProperty.all(RoundedRectangleBorder(
borderRadius: BorderRadius.circular(borderRadius ?? 0)))),
child: ConstrainedBox(
constraints: BoxConstraints(minHeight: minHeight),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
@ -81,7 +84,7 @@ class MenuItemWidget extends StatelessWidget {
onPressed: footerCallback),
],
).paddingAll(2),
);
));
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@ -106,7 +109,8 @@ class MenuItemWidget extends StatelessWidget {
..add(ColorProperty('borderColor', borderColor))
..add(DoubleProperty('borderRadius', borderRadius))
..add(ColorProperty('borderHoverColor', borderHoverColor))
..add(ColorProperty('borderFocusColor', borderFocusColor));
..add(ColorProperty('borderFocusColor', borderFocusColor))
..add(DoubleProperty('minHeight', minHeight));
}
////////////////////////////////////////////////////////////////////////////
@ -129,4 +133,5 @@ class MenuItemWidget extends StatelessWidget {
final Color? footerButtonIconColor;
final Color? footerButtonIconHoverColor;
final Color? footerButtonIconFocusColor;
final double minHeight;
}