Wednesday, August 19, 2020

Gradient

Gradient
...................................................................................................................................................................................................................................................
Example :#1 [LinearGradient]

import 'package:flutter/material.dart';
void main()=>runApp(MaterialApp(home: MyApp()));

class MyApp extends StatefulWidget{
@override
MyAppState createState()=>MyAppState();
}
class MyAppState extends State<MyApp>{
@override
Widget build(BuildContext context){
return Scaffold(
body:
Stack(
fit: StackFit.
expand,
children: <Widget>[
Container(
decoration:
BoxDecoration(
gradient:
LinearGradient(
colors: [Colors.
orange, Colors.red],
begin: Alignment.
centerLeft,
end: Alignment.
centerRight

)
),
)
],
),
);
}
}

...................................................................................................................................................................................................................................................
Example :#2[RadialGradient]

import 'package:flutter/material.dart';
void main()=>runApp(MaterialApp(home: MyApp()));

class MyApp extends StatefulWidget{
@override
MyAppState createState()=>MyAppState();
}
class MyAppState extends State<MyApp>{
@override
Widget build(BuildContext context){
return Scaffold(
body: Stack(
fit: StackFit.expand,
children: <Widget>[
Container(
decoration: BoxDecoration(
gradient: RadialGradient(
colors: [Colors.orange, Colors.deepOrange],
radius: 1.0
)
),
)
],
),
);
}
}

...................................................................................................................................................................................................................................................
Example :#3


...................................................................................................................................................................................................................................................
Example :#4

No comments:

Post a Comment