-
Notifications
You must be signed in to change notification settings - Fork 4
/
animated_theme_page.dart
45 lines (40 loc) · 1.16 KB
/
animated_theme_page.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import 'package:animations_app/widget/app_scaffold.dart';
import 'package:flutter/material.dart';
class AnimatedThemePage extends StatefulWidget {
const AnimatedThemePage({super.key});
static const routeName = 'animatedTheme';
@override
State<AnimatedThemePage> createState() => _AnimatedThemePageState();
}
class _AnimatedThemePageState extends State<AnimatedThemePage> {
var _isLightTheme = true;
@override
Widget build(BuildContext context) {
return AppScaffold(
title: 'AnimatedTheme',
floatingActionButton: FloatingActionButton(
onPressed: () {
setState(() {
_isLightTheme = !_isLightTheme;
});
},
child: const Icon(Icons.refresh),
),
child: Center(
child: AnimatedTheme(
data: _isLightTheme ? ThemeData.light() : ThemeData.dark(),
duration: const Duration(milliseconds: 500),
child: const Card(
child: Padding(
padding: EdgeInsets.all(16),
child: Text(
'hello',
style: TextStyle(fontSize: 24),
),
),
),
),
),
);
}
}