1// Copyright 2014 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5import 'package:flutter/material.dart';
6
7/// Flutter code sample for [LinearGradient].
8
9void main() => runApp(const LinearGradientExampleApp());
10
11class LinearGradientExampleApp extends StatelessWidget {
12 const LinearGradientExampleApp({super.key});
13
14 @override
15 Widget build(BuildContext context) {
16 return const MaterialApp(home: MoodyGradient());
17 }
18}
19
20class MoodyGradient extends StatelessWidget {
21 const MoodyGradient({super.key});
22
23 @override
24 Widget build(BuildContext context) {
25 return Material(
26 child: Container(
27 decoration: const BoxDecoration(
28 gradient: LinearGradient(
29 begin: Alignment.topLeft,
30 end: Alignment(0.8, 1),
31 colors: <Color>[
32 Color(0xff1f005c),
33 Color(0xff5b0060),
34 Color(0xff870160),
35 Color(0xffac255e),
36 Color(0xffca485c),
37 Color(0xffe16b5c),
38 Color(0xfff39060),
39 Color(0xffffb56b),
40 ], // Gradient from https://learnui.design/tools/gradient-generator.html
41 tileMode: TileMode.mirror,
42 ),
43 ),
44 child: const Center(
45 child: Text('From Night to Day', style: TextStyle(fontSize: 24, color: Colors.white)),
46 ),
47 ),
48 );
49 }
50}
51