dev1abhi / Flutter-Animations

We are trying to make a flutter app, which has example of every flutter animation available. Currently has 11+ unique animations.
MIT License
12 stars 15 forks source link

bounce animations #18

Closed habeebputhiyakath closed 1 year ago

habeebputhiyakath commented 1 year ago

bounce animations TweenAnimationBuilder Building simple animations with the Tween class

pr-explainer-bot[bot] commented 1 year ago

Pull Request Review

Changes

  1. Added 'import' statement for 'bounce_animation.dart' in 'drawercontroller.dart' file.
  2. Added 'final mainScreen5 = Bounce();' in 'MyDrawerController' class in 'drawercontroller.dart' file.
  3. Added 'case 4' in the switch statement of 'currentMainScreen' getter in 'MyDrawerController' class in 'drawercontroller.dart' file.
  4. Added 'bounce animation' to the menuItems list in menuscreen.dart.
  5. Added const keyword to the Text and SizedBox widgets in menuscreen.dart.
  6. Added const keyword to the Duration parameter in move_udlr_screen.dart.
  7. Added const keyword to the Offset parameters in move_udlr_screen.dart.
  8. Added const keyword to the Text widget in move_udlr_screen.dart.
  9. Added const keyword to the Icon widget in customAppBar.dart.
  10. Added const keyword to the Size.fromHeight method in customAppBar.dart.
  11. Line 17: Changed the duration of the AnimationController from Duration(seconds: 6) to const Duration(seconds: 6).

Suggestions

  1. In 'bounce_animation.dart' file, line 19: Instead of using 'super.key', it should be 'key' in the constructor of the 'Bounce' class.
  2. In 'bounce_animation.dart' file, line 29: Instead of using 'appBar:' as a separate line, it should be on the same line as 'Scaffold'.
  3. In 'bounce_animation.dart' file, line 34: Instead of using 'onPressed: () { setState(() { ... }); }', it can be simplified to 'onPressed: () => setState(() { ... })'.
  4. In 'bounce_animation.dart' file, line 43: Instead of using 'onPressed:() { ... }', it can be simplified to 'onPressed: MyDrawerController.to.toggleDrawer'.
  5. In 'bounce_animation.dart' file, line 45: Instead of using 'onPressed:() { ... }', it can be simplified to 'onPressed: MyDrawerController.to.update'.
  6. In 'bounce_animation.dart' file, line 47: Instead of using 'hoverColor: Colors.white', it should be 'splashColor: Colors.white'.
  7. In 'bounce_animation.dart' file, line 56: Instead of using 'child: Column(...)', it should be 'child: Column(...)', to maintain consistency with the previous widgets.
  8. In menuscreen.dart, consider using a ListView.separated instead of a ListView.builder to separate the list items with dividers.
  9. In move_udlr_screen.dart, consider using a switch statement instead of multiple if-else statements to handle different animation types.
  10. In menuscreen.dart, there are potential bugs in the Text widget where the style property is not using const.
  11. In move_udlr_screen.dart, there are potential bugs in the initState method where the duration parameter is not using const.
  12. Line 26: Instead of using CustomAppBar(title: "Text Animation"), you can use const CustomAppBar(title: "Text Animation") to improve performance by making it a compile-time constant.
  13. Line 40: Instead of using Text('Flutter', style: TextStyle(fontSize: 24)), you can use const Text('Flutter', style: TextStyle(fontSize: 24)) to improve performance by making it a compile-time constant.
  14. Line 55: Instead of using Text('UP'), you can use const Text('UP') to improve performance by making it a compile-time constant.
  15. Line 68: Instead of using Text('Down'), you can use const Text('Down') to improve performance by making it a compile-time constant.
  16. Line 82: Instead of using Text('Right'), you can use const Text('Right') to improve performance by making it a compile-time constant.
  17. Line 95: Instead of using Text('left'), you can use const Text('left') to improve performance by making it a compile-time constant.

Bugs

  1. In 'bounce_animation.dart' file, line 19: The constructor of the 'Bounce' class is missing the 'key' parameter.
  2. In 'bounce_animation.dart' file, line 34: The 'setState' method is missing the closing parenthesis.
  3. In 'bounce_animation.dart' file, line 43: The 'onPressed' callback is missing the closing parenthesis.
  4. In 'bounce_animation.dart' file, line 45: The 'onPressed' callback is missing the closing parenthesis.
  5. In 'bounce_animation.dart' file, line 47: The 'onPressed' callback is missing the closing parenthesis.
  6. In menuscreen.dart, there are potential bugs in the Text widget where the style property is not using const.
  7. In move_udlr_screen.dart, there are potential bugs in the initState method where the duration parameter is not using const.

Improvements

  1. In menuscreen.dart, the code for creating the ListView.builder can be refactored for better readability and performance:
    Expanded(
    child: ListView.separated(
    itemCount: menuItems.length,
    separatorBuilder: (context, index) => const Divider(),
    itemBuilder: (context, index) {
      return ListTile(
        title: Text(
          menuItems[index],
          style: const TextStyle(
            fontWeight: FontWeight.bold,
            fontSize: 18,
          ),
        ),
      );
    },
    ),
    ),
  2. Line 17: The duration of the AnimationController can be extracted into a constant variable for better readability and reusability. For example:
    const Duration animationDuration = const Duration(seconds: 6);
    _controller = AnimationController(vsync: this, duration: animationDuration);

Rating

Overall Rating: 7.5/10 Criteria: Readability, Performance, Security Explanation: The code has good readability with the use of const and proper indentation. Performance seems fine, but there could be some potential optimizations in the move_udlr_screen.dart file. Security-wise, there are no major concerns in the provided code.

Greetings! Here's the summary of the previous results for the Pull Request review. Please take a look and let me know if you have any questions or need further clarification.