Created
January 12, 2020 12:12
-
-
Save t-artikov/ca37cbc0053cab2e9f4d050c85a42d93 to your computer and use it in GitHub Desktop.
Flutter gradient
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: MyHomePage(), | |
); | |
} | |
} | |
class MyHomePage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
backgroundColor: Colors.white, | |
appBar: AppBar( | |
title: Text("Gradient"), | |
), | |
body: Center( | |
child: Container( | |
width: double.infinity, | |
height: 100, | |
decoration: BoxDecoration( | |
gradient: LinearGradient( | |
stops: [0, 0.5, 1], | |
colors: [ | |
Color.fromARGB(255, 255, 0, 0), | |
Colors.transparent, | |
Color.fromARGB(255, 0, 0, 255), | |
], | |
), | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment