withBackgroundGradient method

Widget withBackgroundGradient(
  1. List<Color> colors, {
  2. Alignment begin = Alignment.topLeft,
  3. Alignment end = Alignment.bottomRight,
})

Applies a gradient as the widget's background.

Implementation

Widget withBackgroundGradient(List<Color> colors, {Alignment begin = Alignment.topLeft, Alignment end = Alignment.bottomRight}) {
  return Container(
    decoration: BoxDecoration(
      gradient: LinearGradient(
        colors: colors,
        begin: begin,
        end: end,
      ),
    ),
    child: this,
  );
}