double _size = 0;
Color _color = Colors.white;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.refresh),
onPressed: () {
Timer.periodic(Duration(milliseconds: 10), (timer) {
if (timer.tick > 100) timer.cancel();
if (timer.tick == 1) _color = Colors.blue;
setState(() => _size += 20);
});
},
),
body: Stack(
children: [
AnimatedContainer(
duration: Duration(seconds: 5),
width: _size,
height: _size,
alignment: Alignment.center,
decoration: BoxDecoration(color: _color, shape: BoxShape.circle),
),
Placeholder(),
],
),
);
}
Токовый выход:
Ожидаемый выход:
Кто-нибудь может сказать мне, как это сделать, я новичок во Flutter. Возможно, мой подход неверен, следует ли использовать свойство backgroundColor
из Scaffold
или что-то еще?