Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- void main() => runApp(MyApp());
- class MyApp extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return MaterialApp(
- title: 'Teste Animação',
- home: Animacao(),
- );
- }
- }
- class Animacao extends StatefulWidget {
- @override
- _AnimacaoState createState() => _AnimacaoState();
- }
- class _AnimacaoState extends State<Animacao> {
- double containerHeight = 150;
- double containerWidth = 150;
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- title: Text('Example'),
- ),
- body: Center(
- child: GestureDetector(
- onTap: () {
- setState((){
- containerHeight = containerHeight == 150 ? 250 : 150;
- containerWidth = containerWidth == 150 ? 250 : 150;
- });
- },
- child: Container(
- color: Colors.blue,
- height: containerHeight,
- width: containerWidth,
- ),
- ),
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment