Update linear_gradient.0.dart
Tweaking example so that it's more attractive to a design-orientated audience
diff --git a/examples/api/lib/painting/gradient/linear_gradient.0.dart b/examples/api/lib/painting/gradient/linear_gradient.0.dart
index 5662e6d..6d5f902 100644
--- a/examples/api/lib/painting/gradient/linear_gradient.0.dart
+++ b/examples/api/lib/painting/gradient/linear_gradient.0.dart
@@ -11,33 +11,41 @@
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
- static const String _title = 'Flutter Code Sample';
-
@override
Widget build(BuildContext context) {
- return const MaterialApp(
- title: _title,
- home: MyStatelessWidget(),
- );
+ return const MaterialApp(home: MoodyGradient());
}
}
-class MyStatelessWidget extends StatelessWidget {
- const MyStatelessWidget({Key? key}) : super(key: key);
+class MoodyGradient extends StatelessWidget {
+ const MoodyGradient({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
- return Container(
- decoration: const BoxDecoration(
- gradient: LinearGradient(
- begin: Alignment.topLeft,
- end:
- Alignment(0.8, 0.0), // 10% of the width, so there are ten blinds.
- colors: <Color>[
- Color(0xffee0000),
- Color(0xffeeee00)
- ], // red to yellow
- tileMode: TileMode.repeated, // repeats the gradient over the canvas
+ return Material(
+ child: Container(
+ decoration: const BoxDecoration(
+ gradient: LinearGradient(
+ begin: Alignment.topLeft,
+ end: Alignment(0.8, 1),
+ colors: <Color>[
+ Color(0xff1f005c),
+ Color(0xff5b0060),
+ Color(0xff870160),
+ Color(0xffac255e),
+ Color(0xffca485c),
+ Color(0xffe16b5c),
+ Color(0xfff39060),
+ Color(0xffffb56b),
+ ], // Gradient from https://learnui.design/tools/gradient-generator.html
+ tileMode: TileMode.mirror,
+ ),
+ ),
+ child: const Center(
+ child: Text(
+ 'From Night to Day',
+ style: TextStyle(fontSize: 24, color: Colors.white),
+ ),
),
),
);