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("Latihan Animated Container"),
- ),
- body: Center(
- child: GestureDetector(
- onTap: () {
- setState(() {});
- },
- child: AnimatedContainer(
- color: Color.fromARGB(255, random.nextInt(256),
- random.nextInt(256), random.nextInt(256)),
- duration: Duration(seconds: 1),
- width: 50.0 + random.nextInt(101),
- height: 50.00 + random.nextInt(101),
- ),
- ),
- ),
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement