reorganize and rename widgets
This commit is contained in:
parent
05d25869ef
commit
d5f29dc344
1 changed files with 568 additions and 547 deletions
35
lib/widgets/common/error_dialog.dart
Normal file
35
lib/widgets/common/error_dialog.dart
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import "package:material_ui/material_ui.dart";
|
||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||
import "package:flutter_riverpod/misc.dart";
|
||||
|
||||
final class const ErrorDialog(
|
||||
final Object error,
|
||||
final StackTrace? stackTrace, {
|
||||
final ProviderOrFamily? provider,
|
||||
super.key,
|
||||
}) extends ConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
return AlertDialog(
|
||||
title: Text("An Error Occurred"),
|
||||
content: SingleChildScrollView(
|
||||
child: SelectableText(
|
||||
"$error${stackTrace == null ? "" : "\n\n$stackTrace"}",
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
if (provider != null)
|
||||
TextButton(
|
||||
onPressed: () => ref.invalidate(provider!),
|
||||
child: const Text("Try Again"),
|
||||
),
|
||||
if (Navigator.of(context).canPop())
|
||||
TextButton(
|
||||
onPressed: () =>
|
||||
Navigator.of(context).popUntil((route) => route.isFirst),
|
||||
child: const Text("Go Back"),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue