| // Copyright 2014 The Flutter Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| // Flutter code sample for LinearGradient |
| |
| import 'package:flutter/material.dart'; |
| |
| void main() => runApp(const MyApp()); |
| |
| class MyApp extends StatelessWidget { |
| const MyApp({Key? key}) : super(key: key); |
| |
| @override |
| Widget build(BuildContext context) { |
| return const MaterialApp(home: MoodyGradient()); |
| } |
| } |
| |
| class MoodyGradient extends StatelessWidget { |
| const MoodyGradient({Key? key}) : super(key: key); |
| |
| @override |
| Widget build(BuildContext context) { |
| return Material( |
| child: Container( |
| decoration: const BoxDecoration( |
| gradient: LinearGradient( |
| begin: Alignment.centerLeft, |
| end: Alignment.centerRight, |
| colors: <Color>[ |
| Color(0xff2c3e50), |
| Color(0xff3498db) |
| ], // gradient from https://uigradients.com/#BetweenNightandDay |
| ), |
| ), |
| child: const Center( |
| child: Text( |
| 'Between Night and Day', |
| style: TextStyle(fontSize: 18.0, color: Colors.white), |
| ), |
| ), |
| ), |
| ); |
| } |
| } |