diff --git a/lib/Screens/SplashScreen.dart b/lib/Screens/SplashScreen.dart index 7603e07..9623246 100644 --- a/lib/Screens/SplashScreen.dart +++ b/lib/Screens/SplashScreen.dart @@ -4,6 +4,8 @@ import 'package:lottie/lottie.dart'; import 'package:get/get.dart'; class SplashScreen extends StatefulWidget { + const SplashScreen({super.key}); + @override _SplashScreenState createState() => _SplashScreenState(); } @@ -16,7 +18,7 @@ class _SplashScreenState extends State { // Delay the navigation to the HomeScreen after 2 seconds Future.delayed(const Duration(seconds: 2), () { // Use Get.off to replace the current screen with MyHomePage - Get.off(() => MyHomePage()); + Get.off(() => const MyHomePage()); }); } diff --git a/lib/Screens/animated_dialog.dart b/lib/Screens/animated_dialog.dart index 81a9194..30dcf1b 100644 --- a/lib/Screens/animated_dialog.dart +++ b/lib/Screens/animated_dialog.dart @@ -43,7 +43,7 @@ class _AnimatedDialogState extends State { width: 300, padding: const EdgeInsets.all(20), color: Colors.white, - child: Column( + child: const Column( mainAxisSize: MainAxisSize.min, children: [ Text('Hello!!'), @@ -67,15 +67,15 @@ class _AnimatedDialogState extends State { backgroundColor: Colors.cyan, shape: OutlineInputBorder( borderRadius: BorderRadius.circular(16.0)), - title: Text('Animated Dialog Example'), - content: Text('Github: Imsurajr'), + title: const Text('Animated Dialog Example'), + content: const Text('Github: Imsurajr'), ), ); }, - transitionDuration: Duration(milliseconds: 300), + transitionDuration: const Duration(milliseconds: 300), ); }, - child: Text('Show Dialog'), + child: const Text('Show Dialog'), ), ), ); diff --git a/lib/Screens/bounce_animation.dart b/lib/Screens/bounce_animation.dart index f8214b4..a86fb2d 100644 --- a/lib/Screens/bounce_animation.dart +++ b/lib/Screens/bounce_animation.dart @@ -49,10 +49,6 @@ class _BounceState extends State { children: [ // bounceInOut TweenAnimationBuilder( - child: const CircleAvatar( - radius: 60, - backgroundColor: Colors.greenAccent, - ), duration: const Duration(milliseconds: 6000), curve: Curves.bounceInOut, tween: Tween(begin: 1.0, end: 0.0), @@ -66,6 +62,10 @@ class _BounceState extends State { child: child, ); }, + child: const CircleAvatar( + radius: 60, + backgroundColor: Colors.greenAccent, + ), ), const SizedBox(height: 20,), @@ -73,10 +73,6 @@ class _BounceState extends State { TweenAnimationBuilder( - child: const CircleAvatar( - radius: 60, - backgroundColor: Colors.redAccent, - ), duration: const Duration(milliseconds: 6000), curve: Curves.bounceOut, tween: Tween(begin: 1.0, end: 0.0), @@ -89,14 +85,14 @@ class _BounceState extends State { child: child, ); }, + child: const CircleAvatar( + radius: 60, + backgroundColor: Colors.redAccent, + ), ), const SizedBox(height: 20,), TweenAnimationBuilder( - child: const CircleAvatar( - radius: 60, - backgroundColor: Colors.yellowAccent, - ), duration: const Duration(milliseconds: 6000), curve: Curves.bounceIn, tween: Tween(begin: 1.0, end: 0.0), @@ -110,6 +106,10 @@ class _BounceState extends State { child: child, ); }, + child: const CircleAvatar( + radius: 60, + backgroundColor: Colors.yellowAccent, + ), ), const SizedBox(height: 20,), diff --git a/lib/Screens/colorize_text.dart b/lib/Screens/colorize_text.dart index a01f7d6..8d78ed5 100644 --- a/lib/Screens/colorize_text.dart +++ b/lib/Screens/colorize_text.dart @@ -66,4 +66,4 @@ class _colorize_text extends State { ), ); } -} +} \ No newline at end of file diff --git a/lib/Screens/explicit_animation.dart b/lib/Screens/explicit_animation.dart index 45c0031..7828076 100644 --- a/lib/Screens/explicit_animation.dart +++ b/lib/Screens/explicit_animation.dart @@ -67,7 +67,7 @@ class _ExplicitAnimationsState extends State }, - icon: Icon(Icons.refresh_rounded)) + icon: const Icon(Icons.refresh_rounded)) ], backgroundColor: mainpagecolor, title: const Text('explicit animation'), diff --git a/lib/Screens/flip_counter.dart b/lib/Screens/flip_counter.dart index aa488e8..1d876f5 100644 --- a/lib/Screens/flip_counter.dart +++ b/lib/Screens/flip_counter.dart @@ -7,6 +7,8 @@ import '../controllers/drawercontroller.dart'; class flip extends StatefulWidget { + const flip({super.key}); + @override _flipState createState() => _flipState(); } diff --git a/lib/Screens/hero_animation/details_page.dart b/lib/Screens/hero_animation/details_page.dart index 68b5b2c..f209c7b 100644 --- a/lib/Screens/hero_animation/details_page.dart +++ b/lib/Screens/hero_animation/details_page.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; class DetailPage extends StatelessWidget { final int index; - const DetailPage({required this.index}); + const DetailPage({super.key, required this.index}); @override Widget build(BuildContext context) { diff --git a/lib/Screens/hero_animation/master_page.dart b/lib/Screens/hero_animation/master_page.dart index 93cc950..00851d5 100644 --- a/lib/Screens/hero_animation/master_page.dart +++ b/lib/Screens/hero_animation/master_page.dart @@ -1,8 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_animations/Screens/hero_animation/details_page.dart'; import 'package:flutter_animations/widgets/customAppBar.dart'; -import '../../controllers/drawercontroller.dart'; -import '../../helpers/colors.dart'; class HeroAnimation extends StatelessWidget { const HeroAnimation({super.key}); @@ -11,7 +9,7 @@ class HeroAnimation extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( - appBar: CustomAppBar( title: 'Hero-animation',), + appBar: const CustomAppBar( title: 'Hero-animation',), body: ListView.builder(itemBuilder: (context, index) { return ListTile( diff --git a/lib/Screens/homepage.dart b/lib/Screens/homepage.dart index e1f2d37..908db2d 100644 --- a/lib/Screens/homepage.dart +++ b/lib/Screens/homepage.dart @@ -6,6 +6,8 @@ import '../controllers/drawercontroller.dart'; import 'menuscreen.dart'; class MyHomePage extends GetView { + const MyHomePage({super.key}); + @override Widget build(BuildContext context) { return GetBuilder( diff --git a/lib/Screens/iiiidk.dart b/lib/Screens/iiiidk.dart new file mode 100644 index 0000000..986a26a --- /dev/null +++ b/lib/Screens/iiiidk.dart @@ -0,0 +1,100 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_animations/helpers/colors.dart'; +import '../controllers/drawercontroller.dart'; + +class IdK extends StatefulWidget { + const IdK({super.key}); + + @override + State createState() => _IdK(); +} + +// The State class is responsible for two things: holding some data you can +// update and building the UI using that data. +class _IdK extends State with SingleTickerProviderStateMixin { + late AnimationController _controller; + late Animation _scaleAnimation; + late Animation _slideAnimation; + bool _visible = true; + + @override + void initState() { + super.initState(); + _controller = AnimationController( + duration: const Duration(milliseconds: 500), + vsync: this, + ); + + _scaleAnimation = Tween(begin: 0.0, end: 1.0).animate( + CurvedAnimation( + parent: _controller, + curve: Curves.easeIn, + ), + ); + + _slideAnimation = Tween(begin: const Offset(0, 1), end: Offset.zero).animate( + CurvedAnimation( + parent: _controller, + curve: Curves.easeInOut, + ), + ); + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + void toggleVisibility() { + setState(() { + _visible = !_visible; + if (_visible) { + _controller.reverse(); + } else { + _controller.forward(); + } + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: mainpagecolor, + appBar: AppBar( + backgroundColor: mainpagecolor, + title: const Text('hello'), + leading: IconButton( + icon: const Icon(Icons.menu), // You can use any icon you prefer + onPressed: () { + MyDrawerController.to.toggleDrawer(); + MyDrawerController.to.update(); + }, + hoverColor: Colors.white, + ), + elevation: 0, + ), + body: Center( + child: SlideTransition( + position: _slideAnimation, + child: ScaleTransition( + scale: _scaleAnimation, + child: Container( + width: 200, + height: 200, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20.0), + color: Colors.blue, + ), + ), + ), + ), + ), + floatingActionButton: FloatingActionButton( + onPressed: toggleVisibility, + tooltip: 'Toggle Scale & Slide', + child: const Icon(Icons.flip), + ), + ); + } +} diff --git a/lib/Screens/loading_animation.dart b/lib/Screens/loading_animation.dart index 7bc2be5..4dbfc36 100644 --- a/lib/Screens/loading_animation.dart +++ b/lib/Screens/loading_animation.dart @@ -29,7 +29,7 @@ class _loadingAnimation extends State { ), elevation: 0, ), - body: Center( + body: const Center( child: RadialProgressAnimation( progress: 0.86, color: Colors.orange, diff --git a/lib/Screens/menuscreen.dart b/lib/Screens/menuscreen.dart index 226b912..6353794 100644 --- a/lib/Screens/menuscreen.dart +++ b/lib/Screens/menuscreen.dart @@ -1,4 +1,3 @@ -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_animations/helpers/colors.dart'; @@ -9,7 +8,7 @@ import '../controllers/drawercontroller.dart'; class MenuScreen extends GetView { final Function(int) onMenuItemClicked; - MenuScreen({required this.onMenuItemClicked}); + MenuScreen({super.key, required this.onMenuItemClicked}); // Menu items for illustration final List menuItems = [ diff --git a/lib/Screens/water_drop_effect.dart b/lib/Screens/water_drop_effect.dart index ea8a39b..a40e3ae 100644 --- a/lib/Screens/water_drop_effect.dart +++ b/lib/Screens/water_drop_effect.dart @@ -11,9 +11,9 @@ class WaterDropEffect extends StatelessWidget { backgroundColor: mainpagecolor, appBar: AppBar( backgroundColor: mainpagecolor, - title: Text('Water Drop Effect'), + title: const Text('Water Drop Effect'), leading: IconButton( - icon: Icon(Icons.menu), // You can use any icon you prefer + icon: const Icon(Icons.menu), // You can use any icon you prefer onPressed:() { MyDrawerController.to.toggleDrawer(); MyDrawerController.to.update(); @@ -117,7 +117,7 @@ class WaterDropEffect extends StatelessWidget { BoxShadow( color: Colors.white, blurRadius: 5, - offset: const Offset(5, 6), + offset: Offset(5, 6), ), ], ), diff --git a/lib/Text/move_udlr_screen.dart b/lib/Text/move_udlr_screen.dart index c8987dd..31e8b79 100644 --- a/lib/Text/move_udlr_screen.dart +++ b/lib/Text/move_udlr_screen.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; class AnimatedTextWidget2 extends StatefulWidget { final String animationType; - AnimatedTextWidget2({required this.animationType}); + const AnimatedTextWidget2({super.key, required this.animationType}); @override _AnimatedTextWidgetState2 createState() => _AnimatedTextWidgetState2(); diff --git a/lib/Text/tex_screen.dart b/lib/Text/tex_screen.dart index 326ea73..aa23721 100644 --- a/lib/Text/tex_screen.dart +++ b/lib/Text/tex_screen.dart @@ -5,6 +5,8 @@ import 'package:flutter_animations/helpers/colors.dart'; import 'package:flutter_animations/widgets/customAppBar.dart'; class AnimatedTextWidget extends StatefulWidget { + const AnimatedTextWidget({super.key}); + @override _AnimatedTextWidgetState createState() => _AnimatedTextWidgetState(); } @@ -52,7 +54,7 @@ class _AnimatedTextWidgetState extends State context, MaterialPageRoute( builder: (context) => - AnimatedTextWidget2( + const AnimatedTextWidget2( animationType: 'up'))); }, child: const Text('UP')), @@ -65,7 +67,7 @@ class _AnimatedTextWidgetState extends State context, MaterialPageRoute( builder: (context) => - AnimatedTextWidget2( + const AnimatedTextWidget2( animationType: 'down'))); }, child: const Text('Down')), @@ -79,7 +81,7 @@ class _AnimatedTextWidgetState extends State context, MaterialPageRoute( builder: (context) => - AnimatedTextWidget2( + const AnimatedTextWidget2( animationType: 'right'))); }, child: const Text('Right')), @@ -92,7 +94,7 @@ class _AnimatedTextWidgetState extends State context, MaterialPageRoute( builder: (context) => - AnimatedTextWidget2( + const AnimatedTextWidget2( animationType: 'left'))); }, child: const Text('left')), diff --git a/lib/controllers/drawercontroller.dart b/lib/controllers/drawercontroller.dart index 907f83a..645498e 100644 --- a/lib/controllers/drawercontroller.dart +++ b/lib/controllers/drawercontroller.dart @@ -13,6 +13,7 @@ import 'package:flutter_animations/Screens/water_drop_effect.dart'; import 'package:flutter_animations/Text/tex_screen.dart'; import 'package:flutter_animations/screens/bounce_animation.dart'; import 'package:flutter_zoom_drawer/flutter_zoom_drawer.dart'; +import 'package:flutter_animations/Screens/iiiidk.dart'; import 'package:get/get.dart'; import '../Screens/animated_dialog.dart'; @@ -27,20 +28,20 @@ class MyDrawerController extends GetxController { // Add your screens here final mainScreen1 = const MainScreen(); final mainScreen2 = const fade_in_fade_out(); - final mainScreen3 = AnimatedTextWidget(); + final mainScreen3 = const AnimatedTextWidget(); final mainScreen4 = const WaterDropEffect(); final mainScreen5 = const RipplesAnimation(); - final mainScreen6 = Bounce(); - final mainScreen7 = ExplicitAnimations(); - final mainScreen8 = AnimatedDialog(); - final mainScreen9 = flip(); - final mainScreen10 = loadingAnimation(); - final mainScreen11 = HeroAnimation(); - final mainScreen12 = colorize_text(); - final mainScreen13 = text_interpolation(); - final mainScreen14= TweenAnimation(); + final mainScreen6 = const Bounce(); + final mainScreen7 = const ExplicitAnimations(); + final mainScreen8 = const AnimatedDialog(); + final mainScreen9 = const flip(); + final mainScreen10 = const loadingAnimation(); + final mainScreen11 = const HeroAnimation(); + final mainScreen12 = const colorize_text(); + final mainScreen13 = const text_interpolation(); + final mainScreen14= const TweenAnimation(); final mainScreen15=const StaggeredAnimation(); - + final mainScreen16= const IdK(); // Getter to get the current main screen based on the selectedMenuItem Widget get currentMainScreen { switch (selectedMenuItem.value) { @@ -71,9 +72,11 @@ class MyDrawerController extends GetxController { case 12: return mainScreen13; case 13: - return mainScreen14; + return mainScreen14; case 14: - return mainScreen15; + return mainScreen15; + case 15: + return mainScreen16; default: return mainScreen1; // Default to mainScreen1 if the selection is not recognized diff --git a/lib/main.dart b/lib/main.dart index 85b81f7..48df0d4 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -26,9 +26,9 @@ class MyApp extends StatelessWidget { ), routes: { '/fade_in': (context) => const fade_in_fade_out(), - '/homepage': (context) => MyHomePage(), - '/text_animat': (context) => AnimatedTextWidget(), + '/homepage': (context) => const MyHomePage(), + '/text_animat': (context) => const AnimatedTextWidget(), }, - home: SplashScreen()); + home: const SplashScreen()); } } diff --git a/lib/widgets/customAppBar.dart b/lib/widgets/customAppBar.dart index a8b7916..ff9afb7 100644 --- a/lib/widgets/customAppBar.dart +++ b/lib/widgets/customAppBar.dart @@ -1,7 +1,5 @@ import 'package:flutter/material.dart'; import 'package:flutter_animations/helpers/colors.dart'; - - import '../controllers/drawercontroller.dart'; class CustomAppBar extends StatelessWidget implements PreferredSizeWidget { diff --git a/pubspec.yaml b/pubspec.yaml index 73d44fb..53eae2a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -37,6 +37,8 @@ dependencies: lottie: ^2.6.0 vector_math: ^2.1.4 + flutter_zoom_drawer: any + get: any dev_dependencies: flutter_launcher_icons: "^0.13.1" @@ -48,8 +50,7 @@ dev_dependencies: flutter_lints: ^2.0.0 flutter_test: sdk: flutter - flutter_zoom_drawer: ^3.1.1 - get: ^4.6.6 + flutter_icons: android: "launcher_icon"