feat: missing route screen added (#662)

This commit is contained in:
Osama Asif 2023-12-31 18:30:24 +05:00 committed by GitHub
parent 3e671762cd
commit 9efaaded97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 68 additions and 0 deletions

View File

@ -105,6 +105,11 @@ class StringConstants {
static const String mins = 'mins';
//Error
static const String unableToLocateTheRoute =
'We apologize for the inconvenience, but we were unable to locate the route you were searching for.';
static const String pleaseClick = 'Please click the';
static const String toReturnToTheMainMenu =
'to return to the main menu. Thank you.';
static const String someThingWentWrong = 'Something went wrong';
static const String invalidEmail = 'Invalid Email.';
static const String fieldRequired = 'Field is Required';

View File

@ -13,6 +13,7 @@ import 'package:Medito/views/bottom_navigation/bottom_navigation_bar_view.dart';
import 'package:Medito/views/downloads/downloads_view.dart';
import 'package:Medito/views/end_screen/end_screen_view.dart';
import 'package:Medito/views/home/home_view.dart';
import 'package:Medito/views/missing_route/missing_route_view.dart';
import 'package:Medito/views/notifications/notification_permission_view.dart';
import 'package:Medito/views/pack/pack_view.dart';
import 'package:Medito/views/player/player_view.dart';
@ -35,6 +36,9 @@ final router = GoRouter(
debugLogDiagnostics: true,
navigatorKey: _rootNavigatorKey,
initialLocation: RouteConstants.root,
errorBuilder: (context, state) {
return MissingRouteView();
},
routes: [
GoRoute(
path: RouteConstants.root,

View File

@ -0,0 +1,59 @@
import 'package:Medito/constants/constants.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
class MissingRouteView extends StatelessWidget {
const MissingRouteView({super.key});
@override
Widget build(BuildContext context) {
var textStyle = Theme.of(context).textTheme.headlineSmall?.copyWith(
fontSize: 16,
color: ColorConstants.walterWhite,
fontFamily: SourceSerif,
);
return Scaffold(
backgroundColor: ColorConstants.ebony,
body: SizedBox(
width: MediaQuery.of(context).size.width,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: padding16,
vertical: padding16,
),
child: Center(
child: RichText(
text: TextSpan(
text: StringConstants.unableToLocateTheRoute,
style: textStyle,
children: <TextSpan>[
TextSpan(
text: ' ${StringConstants.pleaseClick} ',
style: textStyle,
),
TextSpan(
text: '${StringConstants.home.toLowerCase()}',
style: textStyle?.copyWith(
decoration: TextDecoration.underline,
color: ColorConstants.lightPurple,
),
recognizer: TapGestureRecognizer()
..onTap =
() => context.go(RouteConstants.bottomNavbarPath),
),
TextSpan(
text: ' ${StringConstants.toReturnToTheMainMenu} ',
style: textStyle,
),
],
),
textAlign: TextAlign.center,
),
),
),
),
);
}
}