From 843e6552b23b947f18a46b595fb7d7ca031f6540 Mon Sep 17 00:00:00 2001 From: Sapinder Singh Date: Fri, 26 Mar 2021 12:04:11 +0530 Subject: [PATCH 1/2] Added Unknown Screen. Fixes Issue #161 --- lib/helpers/constants.dart | 1 + lib/helpers/route_page.dart | 11 ++--- lib/views/unknown_view.dart | 81 +++++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 8 deletions(-) create mode 100644 lib/views/unknown_view.dart diff --git a/lib/helpers/constants.dart b/lib/helpers/constants.dart index cc10a24..792f17f 100644 --- a/lib/helpers/constants.dart +++ b/lib/helpers/constants.dart @@ -23,6 +23,7 @@ class RouteConstant { static const String TERMS_CONDITIONS = '/terms-conditions'; static const String PAYMENT_SUCCESSFULL = '/payment-successful'; static const String CHANGE_USERNAME_SCREEN = '/change_username'; + static const String UNKNOWN_VIEW = '/unknown-view'; } class RelicColors { diff --git a/lib/helpers/route_page.dart b/lib/helpers/route_page.dart index d0e720a..d5849ce 100644 --- a/lib/helpers/route_page.dart +++ b/lib/helpers/route_page.dart @@ -19,6 +19,7 @@ import 'package:retro_shopping/views/profile/settings/settings_view.dart'; import 'package:retro_shopping/views/profile/wishlist.dart'; import 'package:retro_shopping/views/search_view.dart'; import 'package:retro_shopping/views/terms_conditions_view.dart'; +import 'package:retro_shopping/views/unknown_view.dart'; import 'package:retro_shopping/widgets/payment/payment_successful.dart'; import 'package:retro_shopping/widgets/product/product_page.dart'; @@ -108,15 +109,9 @@ class RoutePage { return SlideLeftRoute( page: TermsConditionsView(), ); - //TODO: Needs to have a separate screen for this + default: - return PageRouteBuilder( - pageBuilder: - (_, Animation firstAni, Animation secondAni) => - const SizedBox( - child: Text('Nothing'), - ), - ); + return SlideLeftRoute(page: UnknownView(),); } } } diff --git a/lib/views/unknown_view.dart b/lib/views/unknown_view.dart new file mode 100644 index 0000000..8e64c11 --- /dev/null +++ b/lib/views/unknown_view.dart @@ -0,0 +1,81 @@ +import 'package:flutter/material.dart'; +import 'package:retro_shopping/helpers/constants.dart'; +import 'package:retro_shopping/widgets/retro_button.dart'; + +class UnknownView extends StatelessWidget { + @override + Widget build(BuildContext context) { + final double height = MediaQuery.of(context).size.height; + final double width = MediaQuery.of(context).size.width; + return Scaffold( + body: SafeArea( + child: SingleChildScrollView( + primary: true, + child: SizedBox( + width: width, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 18), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: height * 0.01, + ), + GestureDetector( + onTap: () { + Navigator.of(context).pop(); + }, + child: RetroButton( + upperColor: Colors.white, + lowerColor: Colors.black, + width: 35, + height: 35, + borderColor: Colors.white, + child: const Icon(Icons.arrow_back), + ), + ), + const SizedBox( + height: 30, + ), + const Text( + 'The page you are looking for is not found. Sorry for inconvenience 😕', + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 25, + ), + ), + Center( + heightFactor: 10, + child: InkWell( + onTap: () { + Navigator.of(context).pushReplacementNamed( + RouteConstant.DASHBOARD_SCREEN, + ); + }, + child: RetroButton( + upperColor: Colors.white, + lowerColor: Colors.black, + width: 250, + height: 50, + borderColor: Colors.white, + child: const Text( + 'Click here to get back to home.', + textAlign: TextAlign.center, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 15, + ), + ), + ), + ), + ), + ], + ), + ), + ), + ), + ), + ); + } +} From d0cde6ba634cd12379cd669add6681dfd8965da7 Mon Sep 17 00:00:00 2001 From: Sapinder Singh Date: Fri, 26 Mar 2021 13:30:57 +0530 Subject: [PATCH 2/2] removed unknown route constant --- lib/helpers/constants.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/helpers/constants.dart b/lib/helpers/constants.dart index 792f17f..cc10a24 100644 --- a/lib/helpers/constants.dart +++ b/lib/helpers/constants.dart @@ -23,7 +23,6 @@ class RouteConstant { static const String TERMS_CONDITIONS = '/terms-conditions'; static const String PAYMENT_SUCCESSFULL = '/payment-successful'; static const String CHANGE_USERNAME_SCREEN = '/change_username'; - static const String UNKNOWN_VIEW = '/unknown-view'; } class RelicColors {