RadialGradient Example in Flutter

This Article is posted by seven.srikanth at 9/21/2019 6:11:02 AM




In this article, I'm going to share an example of RadialGradient in Flutter. 

Here is how the final output is going to look.



Here is code from main.dart file.

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  double padValue = 0;
  @override
  Widget build(BuildContext context) {

    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text("Container Example"),
        ),
        body: Container(
          margin: EdgeInsets.all(100.0),
          decoration: BoxDecoration(
            gradient: RadialGradient(
              tileMode: TileMode.clamp,
              radius: 1.0,
              colors: [Colors.orange, Colors.red, Colors.green]
            ),
            shape: BoxShape.rectangle,
            borderRadius: BorderRadius.all(
              Radius.circular(25.0)
            )
          ),
        )
      ),
    );
  }
}

Thanks,
Srikanth



Tags: RadialGradient








0 Comments
Login to comment.
Recent Comments

Be the first to Comment. You can ask a Query or Share your toughts or Just say thanks.


© 2018 - Fluttercentral | Email to me - seven.srikanth@gmail.com