Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'dart:math';
- import 'package:flutter/material.dart';
- void main() {
- runApp(MyApp());
- }
- class MyApp extends StatefulWidget {
- @override
- _MyAppState createState() => _MyAppState();
- }
- class _MyAppState extends State<MyApp> {
- Random random = Random();
- @override
- Widget build(BuildContext context) {
- return MaterialApp(
- home: Scaffold(
- appBar: AppBar(
- title: Text("Flexible Layout"),
- ),
- body: Column(
- children: <Widget>[
- Flexible(
- child: Row(
- children: <Widget>[
- Flexible(
- flex: random.nextInt(2),
- child: GestureDetector(
- onTap: () {
- setState(() {});
- },
- child: AnimatedContainer(
- margin: EdgeInsets.all(5),
- color: Color.fromARGB(255, random.nextInt(256),
- random.nextInt(256), random.nextInt(256)),
- duration: Duration(seconds: 1),
- ),
- )),
- Flexible(
- flex: random.nextInt(2),
- child: GestureDetector(
- onTap: () {
- setState(() {});
- },
- child: AnimatedContainer(
- margin: EdgeInsets.all(5),
- color: Color.fromARGB(255, random.nextInt(256),
- random.nextInt(256), random.nextInt(256)),
- duration: Duration(seconds: 1),
- ),
- )),
- Flexible(
- flex: random.nextInt(2),
- child: GestureDetector(
- onTap: () {
- setState(() {});
- },
- child: AnimatedContainer(
- margin: EdgeInsets.all(5),
- color: Color.fromARGB(255, random.nextInt(256),
- random.nextInt(256), random.nextInt(256)),
- duration: Duration(seconds: 1),
- ),
- ))
- ],
- ),
- ),
- Flexible(
- flex: random.nextInt(2),
- child: GestureDetector(
- onTap: () {
- setState(() {});
- },
- child: AnimatedContainer(
- margin: EdgeInsets.all(5),
- color: Color.fromARGB(255, random.nextInt(256),
- random.nextInt(256), random.nextInt(256)),
- duration: Duration(seconds: 1),
- ),
- )),
- Flexible(
- flex: random.nextInt(2),
- child: GestureDetector(
- onTap: () {
- setState(() {});
- },
- child: AnimatedContainer(
- margin: EdgeInsets.all(5),
- color: Color.fromARGB(255, random.nextInt(256),
- random.nextInt(256), random.nextInt(256)),
- duration: Duration(seconds: 1),
- ),
- ))
- ],
- ),
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement