feat(ui_kit): use MultiColor in button style

This commit is contained in:
2023-02-14 11:55:34 +01:00
parent 442baa6882
commit 9e1b76e07b
3 changed files with 107 additions and 29 deletions
@@ -40,20 +40,17 @@ class FlatButton extends FlatButtonComponent with $FlatButtonCWMixin {
@override
Widget build(BuildContext context) => Material(
color: const Color(0x00000000),
child: Ink(
decoration: BoxDecoration(
color: style?.backgroundColor ??
Theme.of(context).buttonTheme.colorScheme?.onPrimary,
gradient: LinearGradient(
colors: (style?.borderColors != null &&
style!.borderColors!.length >= 2)
? style!.borderColors!
: [
// TODO(hpcl): change this
Theme.of(context).cardColor,
Theme.of(context).cardColor
],
),
color: (style != null)
? style!.backgroundColors?.color
: Theme.of(context).buttonTheme.colorScheme?.onPrimary,
gradient: (style?.backgroundColors?.isGradient ?? false)
? LinearGradient(
colors: style!.backgroundColors!.colors,
)
: null,
boxShadow: [
if (style?.shadow != null) ...[style!.shadow!]
],
@@ -42,23 +42,20 @@ class OutlinedButton extends OutlinedButtonComponent
@override
Widget build(BuildContext context) => Material(
color: const Color(0x00000000),
child: Ink(
decoration: BoxDecoration(
color: style?.backgroundColor ??
Theme.of(context).buttonTheme.colorScheme?.onPrimary,
border: GradientBoxBorder(
gradient: LinearGradient(
colors: (style?.borderColors != null &&
style!.borderColors!.length >= 2)
? style!.borderColors!
: [
// TODO(hpcl): change this
Theme.of(context).cardColor,
Theme.of(context).cardColor
],
),
width: style?.stroke ?? 2,
),
color: (style != null)
? style!.backgroundColors?.color
: Theme.of(context).buttonTheme.colorScheme?.onPrimary,
border: (style?.borderColors?.isGradient ?? false)
? GradientBoxBorder(
gradient: LinearGradient(
colors: style!.borderColors!.colors,
),
width: style?.stroke ?? 2,
)
: null,
boxShadow: [
if (style?.shadow != null) ...[style!.shadow!]
],