@@ -10,7 +10,6 @@ import 'package:provider/provider.dart';
10
10
import 'widgets/animated_box/animated_boxes.dart' ;
11
11
import 'widgets/animated_box/provider.dart' ;
12
12
import 'widgets/code_block.dart' ;
13
- import 'widgets/cubic_curve_input_widget.dart' ;
14
13
15
14
class HomePage extends StatefulWidget {
16
15
const HomePage ({super .key});
@@ -27,34 +26,21 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
27
26
late String selectedCategory;
28
27
late CurveModel selectedCurve;
29
28
30
- late List <TextEditingController > customCubicControllers;
31
-
32
29
late int animationTime;
33
30
34
31
@override
35
32
void initState () {
36
33
super .initState ();
37
34
38
- customCubicControllers = List .generate (4 , (index) {
39
- final value = switch (index) {
40
- 0 => "0.5" ,
41
- 1 => "0" ,
42
- 2 => "0.75" ,
43
- 3 => "1" ,
44
- int () => throw UnimplementedError (),
45
- };
46
-
47
- return TextEditingController (text: value);
48
- });
49
-
50
35
selectedCategory = CurveModel .list.keys.first;
51
36
selectedCurve = CurveModel .list.values.first.first;
52
37
53
38
animationTime = 2 ;
54
39
55
40
playPauseController = AnimationController (
56
41
vsync: this ,
57
- duration: Duration (milliseconds: 250 ),
42
+ duration: 100. ms,
43
+ reverseDuration: 100. ms,
58
44
)..forward ();
59
45
60
46
controller = AnimationController (
@@ -70,10 +56,6 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
70
56
71
57
@override
72
58
void dispose () {
73
- for (final controller in customCubicControllers) {
74
- controller.dispose ();
75
- }
76
-
77
59
playPauseController.dispose ();
78
60
controller.dispose ();
79
61
super .dispose ();
@@ -207,11 +189,11 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
207
189
Flexible (
208
190
flex: 2 ,
209
191
child: DropdownMenuWidget <CurveModel >(
210
- title: "Type " ,
192
+ title: "Curve " ,
211
193
value: selectedCurve,
212
194
items: CurveModel .list[selectedCategory]! .toList (),
213
195
onChanged: (value) => updateCurve (value! ),
214
- childBuilder : (context, value, textStyle) {
196
+ builder : (context, value, textStyle) {
215
197
return Text (value.name.toString (), style: textStyle);
216
198
},
217
199
),
@@ -224,24 +206,6 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
224
206
animationTime: animationTime,
225
207
onChanged: updateAnimationTime,
226
208
),
227
-
228
- // TODO : TextField have some issues with current flutter version, waiting it to be fixed
229
- Visibility (
230
- visible: false ,
231
- child: AnimatedSize (
232
- curve: Curves .fastOutSlowIn,
233
- duration: 200. ms,
234
- reverseDuration: 200. ms,
235
- child: (selectedCurve.isCustom)
236
- ? CubicCurveInputWidget (
237
- controllers: customCubicControllers,
238
- onApply: (curve) {
239
- updateCurve (selectedCurve.copyWith (curve: curve));
240
- },
241
- )
242
- : const SizedBox .shrink (),
243
- ),
244
- )
245
209
],
246
210
),
247
211
);
0 commit comments