textOnColor static method

Widget textOnColor(
  1. BuildContext context, {
  2. required String text,
  3. TextStyle? style,
  4. Color? backgroundColor,
  5. TextAlign? textAlign,
})

Implementation

static Widget textOnColor(BuildContext context, {required String text, TextStyle? style, Color? backgroundColor, TextAlign? textAlign})
{
  return Container(
    decoration: BoxDecoration(
        color: backgroundColor ?? Colors.grey.shade200,
        borderRadius: BorderRadius.circular(6)
    ),
    padding: const EdgeInsets.all(10),
    child: Text(
      text,
      style: style ?? Theme.of(context).textTheme.titleMedium!.copyWith(color: Colors.black87),
      textAlign: textAlign,
    ),
  );
}