Skip to content

Instantly share code, notes, and snippets.

@kmvignesh
Created August 16, 2020 16:21
Show Gist options
  • Select an option

  • Save kmvignesh/96303fbfc7e5f95c73b8c0c61b727fc7 to your computer and use it in GitHub Desktop.

Select an option

Save kmvignesh/96303fbfc7e5f95c73b8c0c61b727fc7 to your computer and use it in GitHub Desktop.
Flutter Container - CodeAndroid
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Container"),
),
body: Center(
child: Container(
color:Colors.green,
padding: EdgeInsets.all(10),
margin: EdgeInsets.all(10),
constraints: BoxConstraints(
minHeight: 100,
maxHeight: 200,
minWidth: 100,
maxWidth: 300
),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.green,
border: Border.all(width: 10, color: Colors.red),
// gradient: RadialGradient(
// colors: [Colors.green,Colors.teal,Colors.yellow]
// )
image: DecorationImage(
image: NetworkImage(
"http://codeandroid.in/img/code_android_logo_grey_text.png")),
// borderRadius: BorderRadius.all(Radius.circular(10)),
boxShadow: [
BoxShadow(
color: Colors.black38,
blurRadius: 4,
spreadRadius: 4,
offset: Offset(4,4))
],
),
child: Container(
color: Colors.yellow,
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment