Line data Source code
1 : import 'package:flutter/material.dart'; 2 : import 'package:flutter_svg/svg.dart'; 3 : 4 : class TtLoadingLogo extends StatefulWidget { 5 : final Duration duration; 6 : final double minScale; 7 : final double maxScale; 8 : 9 6 : const TtLoadingLogo({ 10 : super.key, 11 : 12 : this.duration = const Duration(milliseconds: 800), 13 : this.minScale = 0.8, 14 : this.maxScale = 1.2, 15 : }); 16 : 17 7 : @override 18 7 : TtLoadingLogoState createState() => TtLoadingLogoState(); 19 : } 20 : 21 : class TtLoadingLogoState extends State<TtLoadingLogo> 22 : with SingleTickerProviderStateMixin { 23 : late AnimationController _controller; 24 : late Animation<double> _animation; 25 : 26 7 : @override 27 : void initState() { 28 7 : super.initState(); 29 28 : _controller = AnimationController(vsync: this, duration: widget.duration) 30 7 : ..repeat(reverse: true); 31 : 32 14 : _animation = Tween<double>( 33 14 : begin: widget.minScale, 34 14 : end: widget.maxScale, 35 21 : ).animate(CurvedAnimation(parent: _controller, curve: Curves.easeInOut)); 36 : } 37 : 38 7 : @override 39 : void dispose() { 40 14 : _controller.dispose(); 41 7 : super.dispose(); 42 : } 43 : 44 7 : @override 45 : Widget build(BuildContext context) { 46 7 : return Center( 47 7 : child: ScaleTransition( 48 7 : scale: _animation, 49 7 : child: SvgPicture.asset('assets/images/tt_ico.svg', height: 80), 50 : ), 51 : ); 52 : } 53 : }