Closed animator closed 7 months ago
Hi @animator
I have implemented this functionality (have attached a demo video of it).
Below is the implementation of the ClearResponseButton
. Unlike all the other buttons, it extends ConsumerWidget instead of Stateless/Stateful Widget. Before I open a PR, I wanted to confirm whether this is allowed or not.
Thanks in advance
class ClearResponseButton extends ConsumerWidget {
const ClearResponseButton({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
var sm = ScaffoldMessenger.of(context);
return SizedBox(
child: TextButton(
style: TextButton.styleFrom(minimumSize: const Size(40, 40)),
onPressed: () {
final selectedId = ref.watch(selectedIdStateProvider);
ref
.read(collectionStateNotifierProvider.notifier)
.clearResponse(selectedId!);
sm.hideCurrentSnackBar();
sm.showSnackBar(
SnackBar(
content: const Text('Response cleared'),
action: SnackBarAction(
label: 'Undo',
onPressed: () {},
),
),
);
},
child: const Icon(
Icons.delete,
size: 20,
),
),
);
}
}
https://github.com/foss42/apidash/assets/59914433/63de8050-1c73-478a-b97a-8580e9aa97c8
@mdmohsin7 Please open a PR for review.
Tell us about the task you want to perform and are unable to do so because the feature is not available There should be a small recycle bin or clear button in the response section to clear the current response.