Skip to content

Instantly share code, notes, and snippets.

@uttaravadina
Forked from braulio94/main.dart
Created October 21, 2020 09:42
Show Gist options
  • Select an option

  • Save uttaravadina/4237604579d5005486b635a61c59951d to your computer and use it in GitHub Desktop.

Select an option

Save uttaravadina/4237604579d5005486b635a61c59951d to your computer and use it in GitHub Desktop.
Flutter - Making a gradeint app body background using decoration
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