Skip to content

Instantly share code, notes, and snippets.

@ibhavikmakwana
Last active May 28, 2018 06:41
Show Gist options
  • Save ibhavikmakwana/1d98b4ed6c231ed5b959ece2d226b18c to your computer and use it in GitHub Desktop.
Save ibhavikmakwana/1d98b4ed6c231ed5b959ece2d226b18c to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'AnimatedSize',
theme: new ThemeData(
primarySwatch: Colors.blue,
),
home: new MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => new _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
double _height = 80.0;
double _width = 80.0;
var _color = Colors.blue;
bool _resized = false;
@override
Widget build(BuildContext context) {
return new Scaffold(
body: new Center(
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new AnimatedSize(
duration: null,
vsync: null,
child: new Container(
width: _width,
height: _height,
color: _color,
),
),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment