mirror of
https://github.com/foss42/apidash.git
synced 2025-12-01 18:28:25 +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
|
@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,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user