Bladeren bron

switch icon on bottomActionBar on expansion & collapse

ashilkn 2 jaren geleden
bovenliggende
commit
30ec182f0e
1 gewijzigde bestanden met toevoegingen van 23 en 6 verwijderingen
  1. 23 6
      lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart

+ 23 - 6
lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart

@@ -55,14 +55,31 @@ class _BottomActionBarWidgetState extends State<BottomActionBarWidget> {
   }
   }
 
 
   List<Widget> _iconButtons() {
   List<Widget> _iconButtons() {
+    final isExpanded = _expandableController.expanded;
     final iconButtons = <Widget?>[
     final iconButtons = <Widget?>[
       ...?widget.iconButtons,
       ...?widget.iconButtons,
-      IconButtonWidget(
-        onTap: () {
-          _expandableController.value = !_expandableController.value;
-        },
-        icon: Icons.more_horiz_outlined,
-        iconButtonType: IconButtonType.primary,
+      AnimatedSwitcher(
+        duration: const Duration(milliseconds: 200),
+        switchInCurve: Curves.easeInOutExpo,
+        child: isExpanded
+            ? IconButtonWidget(
+                key: ValueKey<bool>(isExpanded),
+                onTap: () {
+                  _expandableController.value = false;
+                  setState(() {});
+                },
+                icon: Icons.expand_more_outlined,
+                iconButtonType: IconButtonType.primary,
+              )
+            : IconButtonWidget(
+                key: ValueKey<bool>(isExpanded),
+                onTap: () {
+                  _expandableController.value = true;
+                  setState(() {});
+                },
+                icon: Icons.more_horiz_outlined,
+                iconButtonType: IconButtonType.primary,
+              ),
       ),
       ),
     ];
     ];
     iconButtons.removeWhere((element) => element == null);
     iconButtons.removeWhere((element) => element == null);