Last active
September 1, 2019 03:33
-
-
Save kherel/1048888bf4da291b4d79596c2828d131 to your computer and use it in GitHub Desktop.
For DolDurma
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter/physics.dart'; | |
import 'dart:math'; | |
void main() => runApp(new MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: "Spring Box", | |
theme: ThemeData(), | |
home: Scaffold( | |
body: HomePage(), | |
backgroundColor: Color(0xFFe8e8e8), | |
), | |
); | |
} | |
} | |
class HomePage extends StatefulWidget { | |
@override | |
_HomePageState createState() => _HomePageState(); | |
} | |
class _HomePageState extends State<HomePage> { | |
var _isExpanded = false; | |
_toggleExpanded() { | |
setState(() { | |
_isExpanded = !_isExpanded; | |
}); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return Row( | |
mainAxisAlignment: MainAxisAlignment.end, | |
children: <Widget>[ | |
GestureDetector( | |
onTap: _toggleExpanded, | |
child: AnimatedContainer( | |
curve: _isExpanded ? Curves.elasticOut : Curves.elasticIn, | |
duration: Duration(milliseconds: 800), | |
width: _isExpanded ? 300 : 80, | |
color: Color(0xFF404bc4), | |
), | |
) | |
], | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment