feat: enhance DashbotApplyCurlButton to highlight destructive actions with error color

This commit is contained in:
Udhay-Adithya
2025-09-27 15:01:51 +05:30
parent 8cd9923690
commit 991b2c69f7

View File

@@ -26,11 +26,18 @@ class DashbotApplyCurlButton extends ConsumerWidget with DashbotActionMixin {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final label = _labelForField(action.field, action.path); final label = _labelForField(action.field, action.path);
final isDestructive = action.field == 'apply_to_selected';
return ElevatedButton( return ElevatedButton(
onPressed: () async { onPressed: () async {
await ref.read(chatViewmodelProvider.notifier).applyAutoFix(action); await ref.read(chatViewmodelProvider.notifier).applyAutoFix(action);
}, },
child: Text(label), child: Text(
label,
// Destructive action: highlight with error color
style: isDestructive
? TextStyle(color: Theme.of(context).colorScheme.error)
: null,
),
); );
} }
} }