-
Notifications
You must be signed in to change notification settings - Fork 459
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add errorBuilder route to NotFoundScreen (#149)
* Add errorBuilder route to NotFoundScreen * Add rewrites rule to `firebase.json`
- Loading branch information
Showing
7 changed files
with
207 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
import 'package:go_router/go_router.dart'; | ||
import 'package:starter_architecture_flutter_firebase/src/common_widgets/primary_button.dart'; | ||
import 'package:starter_architecture_flutter_firebase/src/constants/app_sizes.dart'; | ||
import 'package:starter_architecture_flutter_firebase/src/features/authentication/data/firebase_auth_repository.dart'; | ||
import 'package:starter_architecture_flutter_firebase/src/routing/app_router.dart'; | ||
|
||
/// Placeholder widget showing a message and CTA to go back to the home screen. | ||
class EmptyPlaceholderWidget extends ConsumerWidget { | ||
const EmptyPlaceholderWidget({super.key, required this.message}); | ||
final String message; | ||
|
||
@override | ||
Widget build(BuildContext context, WidgetRef ref) { | ||
return Padding( | ||
padding: const EdgeInsets.all(Sizes.p16), | ||
child: Center( | ||
child: Column( | ||
mainAxisSize: MainAxisSize.min, | ||
crossAxisAlignment: CrossAxisAlignment.center, | ||
children: [ | ||
Text( | ||
message, | ||
style: Theme.of(context).textTheme.headlineMedium, | ||
textAlign: TextAlign.center, | ||
), | ||
gapH32, | ||
PrimaryButton( | ||
onPressed: () { | ||
final isLoggedIn = | ||
ref.watch(authRepositoryProvider).currentUser != null; | ||
context.goNamed( | ||
isLoggedIn ? AppRoute.jobs.name : AppRoute.signIn.name); | ||
}, | ||
text: 'Go Home', | ||
) | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
// import 'package:ecommerce_app/src/localization/string_hardcoded.dart'; | ||
// import 'package:ecommerce_app/src/common_widgets/empty_placeholder_widget.dart'; | ||
// import 'package:flutter/material.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:starter_architecture_flutter_firebase/src/common_widgets/empty_placeholder_widget.dart'; | ||
|
||
// /// Simple not found screen used for 404 errors (page not found on web) | ||
// class NotFoundScreen extends StatelessWidget { | ||
// const NotFoundScreen({super.key}); | ||
/// Simple not found screen used for 404 errors (page not found on web) | ||
class NotFoundScreen extends StatelessWidget { | ||
const NotFoundScreen({super.key}); | ||
|
||
// @override | ||
// Widget build(BuildContext context) { | ||
// return Scaffold( | ||
// appBar: AppBar(), | ||
// body: EmptyPlaceholderWidget( | ||
// message: '404 - Page not found!'.hardcoded, | ||
// ), | ||
// ); | ||
// } | ||
// } | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar(), | ||
body: const EmptyPlaceholderWidget( | ||
message: '404 - Page not found!', | ||
), | ||
); | ||
} | ||
} |
Oops, something went wrong.