textOnColor static method
Implementation
static Widget textOnColor(BuildContext context, {required String text, bool expanded = false, TextStyle? style, Color? backgroundColor, TextAlign? textAlign, double horizontalGap = 10, double verticalGap = 10})
{
Widget c = Container(
decoration: BoxDecoration(
color: backgroundColor ?? Colors.grey.shade200,
borderRadius: BorderRadius.circular(6)
),
padding: EdgeInsets.symmetric(horizontal: horizontalGap, vertical: verticalGap),
child: Text(
text,
style: style ?? Theme.of(context).textTheme.titleMedium!.copyWith(color: Colors.black87),
textAlign: textAlign,
),
);
if (expanded) {
return Row(children: [c.expanded()]);
}
else {
return c;
}
}