Flutter Gradient Or LinearGradient


import 'package:flutter/material.dart';

void main() => runApp(
      MaterialApp(
        title: 'Flight Mock Mock UP',
        debugShowCheckedModeBanner: false,
        home: HomeScreen(),
      ),
    );

Color firstColor = Color(0xFF000000);
Color secondColor = Color(0xFFEF772C);
Color thirdColor = Color(0xFFCCFFDD);

class HomeScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          HomeScreenTopPart(),
        ],
      ),
    );
  }
}

class HomeScreenTopPart extends StatefulWidget {
  @override
  _HomeScreenTopPartState createState() => _HomeScreenTopPartState();
}

class _HomeScreenTopPartState extends State<HomeScreenTopPart> {
  @override
  Widget build(BuildContext context) {
    return Stack(
      children: [
        Container(
          height: 400.0,
          // color: Colors.orange,
          decoration: BoxDecoration(
            gradient: LinearGradient(
              colors: [
                firstColor,
                secondColor,
                thirdColor,
              ],
            ),
          ),
        ),
      ],
    );
  }
}
Output:


Share on Google Plus

About Ram Pukar

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment

0 comments:

Post a Comment