Skip to content

Instantly share code, notes, and snippets.

@t-artikov
Created January 12, 2020 12:12
Show Gist options
  • Save t-artikov/ca37cbc0053cab2e9f4d050c85a42d93 to your computer and use it in GitHub Desktop.
Save t-artikov/ca37cbc0053cab2e9f4d050c85a42d93 to your computer and use it in GitHub Desktop.
Flutter gradient
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