Implementation
ButtonBuilder get buttonBuilder =>
_buttonBuilder ??
(
context, {
required onPressed,
required text,
buttonType = ButtonType.tertiary,
}) {
var theme = Theme.of(context);
switch (buttonType) {
case ButtonType.primary:
return ElevatedButton(
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all(theme.colorScheme.primary),
foregroundColor: MaterialStateProperty.all(Colors.black),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
side: BorderSide(color: theme.colorScheme.primary),
),
),
),
onPressed: onPressed,
child: Text(text),
);
case ButtonType.secondary:
return ElevatedButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.white),
foregroundColor: MaterialStateProperty.all(Colors.black),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
side: BorderSide(color: theme.colorScheme.primary),
),
),
),
onPressed: onPressed,
child: Text(text),
);
case ButtonType.tertiary:
return ElevatedButton(
style: ButtonStyle(
shadowColor: MaterialStateProperty.all(Colors.transparent),
backgroundColor: MaterialStateProperty.all(Colors.white),
foregroundColor: MaterialStateProperty.all(Colors.black),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
side: const BorderSide(color: Colors.white),
),
),
),
onPressed: onPressed,
child: Text(text),
);
}
};