-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanimatedphysicalmodel.dart
54 lines (51 loc) · 1.6 KB
/
animatedphysicalmodel.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
46
47
48
49
50
51
52
53
54
import 'package:flutter/material.dart';
import 'package:widgetssamples/utils/app_theme.dart';
class AnimatedPhysicalModelWidget extends StatefulWidget {
const AnimatedPhysicalModelWidget({super.key});
@override
State<AnimatedPhysicalModelWidget> createState() =>
_AnimatedPhysicalModelWidgetState();
}
class _AnimatedPhysicalModelWidgetState
extends State<AnimatedPhysicalModelWidget> {
bool _isFlat = true;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("AnimatedPhysicalModel"),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
AnimatedPhysicalModel(
shape: BoxShape.rectangle,
elevation: _isFlat ? 0 : 6.0,
color: ThemeConfig.darkBG,
shadowColor: Colors.white,
duration: const Duration(milliseconds: 500),
curve: Curves.fastOutSlowIn,
child: const SizedBox(
width: 120,
height: 120,
child: Icon(Icons.android_outlined),
),
),
const SizedBox(
height: 20,
),
ElevatedButton(
onPressed: () {
setState(() {
_isFlat = !_isFlat;
});
},
child: const Text('Click'),
)
],
),
));
}
}