@@ -10,7 +10,6 @@ import 'package:provider/provider.dart';
1010import 'widgets/animated_box/animated_boxes.dart' ;
1111import 'widgets/animated_box/provider.dart' ;
1212import 'widgets/code_block.dart' ;
13- import 'widgets/cubic_curve_input_widget.dart' ;
1413
1514class HomePage extends StatefulWidget {
1615 const HomePage ({super .key});
@@ -27,34 +26,21 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
2726 late String selectedCategory;
2827 late CurveModel selectedCurve;
2928
30- late List <TextEditingController > customCubicControllers;
31-
3229 late int animationTime;
3330
3431 @override
3532 void initState () {
3633 super .initState ();
3734
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-
5035 selectedCategory = CurveModel .list.keys.first;
5136 selectedCurve = CurveModel .list.values.first.first;
5237
5338 animationTime = 2 ;
5439
5540 playPauseController = AnimationController (
5641 vsync: this ,
57- duration: Duration (milliseconds: 250 ),
42+ duration: 100. ms,
43+ reverseDuration: 100. ms,
5844 )..forward ();
5945
6046 controller = AnimationController (
@@ -70,10 +56,6 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
7056
7157 @override
7258 void dispose () {
73- for (final controller in customCubicControllers) {
74- controller.dispose ();
75- }
76-
7759 playPauseController.dispose ();
7860 controller.dispose ();
7961 super .dispose ();
@@ -207,11 +189,11 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
207189 Flexible (
208190 flex: 2 ,
209191 child: DropdownMenuWidget <CurveModel >(
210- title: "Type " ,
192+ title: "Curve " ,
211193 value: selectedCurve,
212194 items: CurveModel .list[selectedCategory]! .toList (),
213195 onChanged: (value) => updateCurve (value! ),
214- childBuilder : (context, value, textStyle) {
196+ builder : (context, value, textStyle) {
215197 return Text (value.name.toString (), style: textStyle);
216198 },
217199 ),
@@ -224,24 +206,6 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
224206 animationTime: animationTime,
225207 onChanged: updateAnimationTime,
226208 ),
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- )
245209 ],
246210 ),
247211 );
0 commit comments