From f108929dcefc0701fe651a5add22fec78cd8e17e Mon Sep 17 00:00:00 2001 From: stopflock Date: Thu, 13 Nov 2025 20:17:29 -0600 Subject: [PATCH] Always show add/cycle/delete direction buttons --- lib/widgets/add_node_sheet.dart | 64 +++++++++++++++++++------------- lib/widgets/edit_node_sheet.dart | 64 +++++++++++++++++++------------- 2 files changed, 78 insertions(+), 50 deletions(-) diff --git a/lib/widgets/add_node_sheet.dart b/lib/widgets/add_node_sheet.dart index 2dec3e2..14dc735 100644 --- a/lib/widgets/add_node_sheet.dart +++ b/lib/widgets/add_node_sheet.dart @@ -67,34 +67,48 @@ class AddNodeSheet extends StatelessWidget { onChanged: requiresDirection ? (v) => appState.updateSession(directionDeg: v) : null, ), ), - // Buttons on the right (only show if direction is required) - if (requiresDirection) ...[ - const SizedBox(width: 8), - // Remove button - IconButton( - icon: const Icon(Icons.remove, size: 20), - onPressed: session.directions.length > 1 ? () => appState.removeDirection() : null, - tooltip: 'Remove current direction', - padding: EdgeInsets.zero, - constraints: const BoxConstraints(minWidth: kDirectionButtonMinWidth, minHeight: kDirectionButtonMinHeight), + // Direction control buttons - always show but grey out when direction not required + const SizedBox(width: 8), + // Remove button + IconButton( + icon: Icon( + Icons.remove, + size: 20, + color: requiresDirection ? null : Theme.of(context).disabledColor, ), - // Add button - IconButton( - icon: const Icon(Icons.add, size: 20), - onPressed: () => appState.addDirection(), - tooltip: 'Add new direction', - padding: EdgeInsets.zero, - constraints: const BoxConstraints(minWidth: kDirectionButtonMinWidth, minHeight: kDirectionButtonMinHeight), + onPressed: requiresDirection && session.directions.length > 1 + ? () => appState.removeDirection() + : null, + tooltip: requiresDirection ? 'Remove current direction' : 'Direction not required for this profile', + padding: EdgeInsets.zero, + constraints: const BoxConstraints(minWidth: kDirectionButtonMinWidth, minHeight: kDirectionButtonMinHeight), + ), + // Add button + IconButton( + icon: Icon( + Icons.add, + size: 20, + color: requiresDirection ? null : Theme.of(context).disabledColor, ), - // Cycle button - IconButton( - icon: const Icon(Icons.repeat, size: 20), - onPressed: session.directions.length > 1 ? () => appState.cycleDirection() : null, - tooltip: 'Cycle through directions', - padding: EdgeInsets.zero, - constraints: const BoxConstraints(minWidth: kDirectionButtonMinWidth, minHeight: kDirectionButtonMinHeight), + onPressed: requiresDirection ? () => appState.addDirection() : null, + tooltip: requiresDirection ? 'Add new direction' : 'Direction not required for this profile', + padding: EdgeInsets.zero, + constraints: const BoxConstraints(minWidth: kDirectionButtonMinWidth, minHeight: kDirectionButtonMinHeight), + ), + // Cycle button + IconButton( + icon: Icon( + Icons.repeat, + size: 20, + color: requiresDirection ? null : Theme.of(context).disabledColor, ), - ], + onPressed: requiresDirection && session.directions.length > 1 + ? () => appState.cycleDirection() + : null, + tooltip: requiresDirection ? 'Cycle through directions' : 'Direction not required for this profile', + padding: EdgeInsets.zero, + constraints: const BoxConstraints(minWidth: kDirectionButtonMinWidth, minHeight: kDirectionButtonMinHeight), + ), ], ), ), diff --git a/lib/widgets/edit_node_sheet.dart b/lib/widgets/edit_node_sheet.dart index da349ea..cd949c3 100644 --- a/lib/widgets/edit_node_sheet.dart +++ b/lib/widgets/edit_node_sheet.dart @@ -68,34 +68,48 @@ class EditNodeSheet extends StatelessWidget { onChanged: requiresDirection ? (v) => appState.updateEditSession(directionDeg: v) : null, ), ), - // Buttons on the right (only show if direction is required) - if (requiresDirection) ...[ - const SizedBox(width: 8), - // Remove button - IconButton( - icon: const Icon(Icons.remove, size: 20), - onPressed: session.directions.length > 1 ? () => appState.removeDirection() : null, - tooltip: 'Remove current direction', - padding: EdgeInsets.zero, - constraints: const BoxConstraints(minWidth: kDirectionButtonMinWidth, minHeight: kDirectionButtonMinHeight), + // Direction control buttons - always show but grey out when direction not required + const SizedBox(width: 8), + // Remove button + IconButton( + icon: Icon( + Icons.remove, + size: 20, + color: requiresDirection ? null : Theme.of(context).disabledColor, ), - // Add button - IconButton( - icon: const Icon(Icons.add, size: 20), - onPressed: () => appState.addDirection(), - tooltip: 'Add new direction', - padding: EdgeInsets.zero, - constraints: const BoxConstraints(minWidth: kDirectionButtonMinWidth, minHeight: kDirectionButtonMinHeight), + onPressed: requiresDirection && session.directions.length > 1 + ? () => appState.removeDirection() + : null, + tooltip: requiresDirection ? 'Remove current direction' : 'Direction not required for this profile', + padding: EdgeInsets.zero, + constraints: const BoxConstraints(minWidth: kDirectionButtonMinWidth, minHeight: kDirectionButtonMinHeight), + ), + // Add button + IconButton( + icon: Icon( + Icons.add, + size: 20, + color: requiresDirection ? null : Theme.of(context).disabledColor, ), - // Cycle button - IconButton( - icon: const Icon(Icons.repeat, size: 20), - onPressed: session.directions.length > 1 ? () => appState.cycleDirection() : null, - tooltip: 'Cycle through directions', - padding: EdgeInsets.zero, - constraints: const BoxConstraints(minWidth: kDirectionButtonMinWidth, minHeight: kDirectionButtonMinHeight), + onPressed: requiresDirection ? () => appState.addDirection() : null, + tooltip: requiresDirection ? 'Add new direction' : 'Direction not required for this profile', + padding: EdgeInsets.zero, + constraints: const BoxConstraints(minWidth: kDirectionButtonMinWidth, minHeight: kDirectionButtonMinHeight), + ), + // Cycle button + IconButton( + icon: Icon( + Icons.repeat, + size: 20, + color: requiresDirection ? null : Theme.of(context).disabledColor, ), - ], + onPressed: requiresDirection && session.directions.length > 1 + ? () => appState.cycleDirection() + : null, + tooltip: requiresDirection ? 'Cycle through directions' : 'Direction not required for this profile', + padding: EdgeInsets.zero, + constraints: const BoxConstraints(minWidth: kDirectionButtonMinWidth, minHeight: kDirectionButtonMinHeight), + ), ], ), ),