Last active
June 15, 2021 18:07
-
-
Save braulio94/3ccbeb8c1bb25c33bf5bf16396a00a04 to your computer and use it in GitHub Desktop.
Flutter - Making a gradeint app body background using decoration
This file contains 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'; | |
// | |
// Created by Braulio Cassule | |
// 30 December 2017 | |
// | |
void main() => runApp(new MyApp()); | |
class MyApp extends StatelessWidget { | |
/// | |
/// * I would suggest heading on to | |
/// * https://material.io/guidelines/style/color.html#color-color-palette | |
/// * to choose your colors | |
/// | |
Color gradientStart = Colors.deepPurple[700]; //Change start gradient color here | |
Color gradientEnd = Colors.purple[500]; //Change end gradient color here | |
@override | |
Widget build(BuildContext context) { | |
return new MaterialApp( | |
home: new Scaffold( | |
appBar: new AppBar( | |
title: new Text('Gradient Decoration'), | |
), | |
body: new Container( | |
decoration: new BoxDecoration( | |
gradient: new LinearGradient(colors: [gradientStart, gradientEnd], | |
begin: const FractionalOffset(0.5, 0.0), | |
end: const FractionalOffset(0.0, 0.5), | |
stops: [0.0,1.0], | |
tileMode: TileMode.clamp | |
), | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The Result should look something like this