| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- import 'package:flutter/material.dart';
- class Demo3 extends StatefulWidget {
- const Demo3({Key? key}) : super(key: key);
- @override
- State<Demo3> createState() => _Demo3State();
- }
- class _Demo3State extends State<Demo3> with SingleTickerProviderStateMixin {
- late AnimationController _controller;
- late Animation _size;
- @override
- void initState() {
- _controller =
- AnimationController(duration: const Duration(seconds: 10), vsync: this);
- // ..addListener(() {
- // setState(() {});
- // });
- // _controller = AnimationController(vsync: this,duration: const Duration(seconds: 2));
- _controller.addListener(() {
- setState(() {
-
- });
- });
- _size = Tween(begin: 100.0, end: 200.0).animate(
- CurvedAnimation(parent: _controller, curve: const Interval(0.2, 0.23)));
- _controller.forward();
- super.initState();
- }
- @override
- void dispose() {
- _controller.dispose();
- super.dispose();
- }
- @override
- Widget build(BuildContext context) {
- return Container(
- color: Colors.white,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- width: _size.value,
- height: _size.value,
- color: Colors.orange,
- )
- ],
- ),
- );
- }
- }
|