Implement collapsible sidebar with badge-only view

Add collapsible sidebar functionality for both deliveries and routes pages:

- DeliveryListItem: Add isCollapsed parameter to show badge-only view when sidebar is collapsed
- RouteListItem: Add isCollapsed parameter with same badge-only behavior
- MapSidebarLayout: Add sidebarBuilder function to pass collapsed state to child widgets
- CollapsibleRoutesSidebar: Pass collapsed state to RouteListItem components
- UnifiedDeliveryListView: Add isCollapsed parameter and pass to DeliveryListItem

Collapsed sidebar:
- Width: 80px (accommodates 60px badge with 10px margins)
- Shows only status-colored order number badges
- Badges remain centered and aligned during animations
- Removed horizontal slide animation in collapsed view to prevent misalignment
- Maintains scale and fade animations for smooth entrance

Expanded sidebar:
- Width: 420px (original full layout)
- Shows badge, vertical accent bar, and delivery/route details
- Full animations including horizontal slide

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jean-Philippe Brule
2025-11-17 11:00:48 -05:00
parent 98ce195bbb
commit 65f0f4451b
33 changed files with 373 additions and 29 deletions
+7 -2
View File
@@ -95,7 +95,7 @@ class _DeliveriesPageState extends ConsumerState<DeliveriesPage> {
? _handleDeliveryAction(context, _selectedDelivery!, action, token)
: null,
),
sidebarWidget: UnifiedDeliveryListView(
sidebarBuilder: (isCollapsed) => UnifiedDeliveryListView(
deliveries: deliveries,
selectedDelivery: _selectedDelivery,
scrollController: _listScrollController,
@@ -108,6 +108,7 @@ class _DeliveriesPageState extends ConsumerState<DeliveriesPage> {
_handleDeliveryAction(context, delivery, action, token);
_autoScrollToFirstPending(deliveries);
},
isCollapsed: isCollapsed,
),
);
},
@@ -127,7 +128,7 @@ class _DeliveriesPageState extends ConsumerState<DeliveriesPage> {
? _handleDeliveryAction(context, _selectedDelivery!, action, token)
: null,
),
sidebarWidget: UnifiedDeliveryListView(
sidebarBuilder: (isCollapsed) => UnifiedDeliveryListView(
deliveries: deliveries,
selectedDelivery: _selectedDelivery,
scrollController: _listScrollController,
@@ -140,6 +141,7 @@ class _DeliveriesPageState extends ConsumerState<DeliveriesPage> {
_handleDeliveryAction(context, delivery, action, token);
_autoScrollToFirstPending(deliveries);
},
isCollapsed: isCollapsed,
),
),
);
@@ -246,6 +248,7 @@ class UnifiedDeliveryListView extends StatelessWidget {
final ScrollController scrollController;
final ValueChanged<Delivery> onDeliverySelected;
final Function(Delivery, String) onItemAction;
final bool isCollapsed;
const UnifiedDeliveryListView({
super.key,
@@ -254,6 +257,7 @@ class UnifiedDeliveryListView extends StatelessWidget {
required this.scrollController,
required this.onDeliverySelected,
required this.onItemAction,
this.isCollapsed = false,
});
@override
@@ -282,6 +286,7 @@ class UnifiedDeliveryListView extends StatelessWidget {
onCall: () => onItemAction(delivery, 'call'),
onAction: (action) => onItemAction(delivery, action),
animationIndex: index,
isCollapsed: isCollapsed,
);
},
),