class LayoutDemoextends StatelessWidget {
@override
Widgetbuild(BuildContext context) {
return new Scaffold(
appBar:new AppBar(
title: new Text ( 'LinearGradient linear gradient'),
),
body:new Center(
child:new DecoratedBox(
decoration:new BoxDecoration(
gradient:new LinearGradient(
begin: const FractionalOffset (0.5, 0.0), // starting offset
end: const FractionalOffset (1.0, 1.0), // Ending offset
// Gradient color datasets
colors: [
Colors.red,
Colors.green,
Colors.blue,
Colors.grey,
],
),
),
child:new Container(
width:280.0,
height:280.0,
child:new Center(
child:Text(
'A LinearGradient linear gradient'
style:TextStyle(
color: Colors.black,
fontSize:28.0,
),
),
),
),
),
),
);
}
}