mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 02:39:19 +08:00
feat: enhance DashbotApplyCurlButton to highlight destructive actions with error color
This commit is contained in:
@@ -26,11 +26,18 @@ class DashbotApplyCurlButton extends ConsumerWidget with DashbotActionMixin {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final label = _labelForField(action.field, action.path);
|
||||
final isDestructive = action.field == 'apply_to_selected';
|
||||
return ElevatedButton(
|
||||
onPressed: () async {
|
||||
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,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user