Skip to content

Commit

Permalink
Merge pull request #163 from SapinderSingh/issue-161
Browse files Browse the repository at this point in the history
Added Unknown Screen. Fixes Issue #161
  • Loading branch information
himanshusharma89 authored Mar 26, 2021
2 parents 7e56ba1 + d0cde6b commit 9c28ee5
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 8 deletions.
11 changes: 3 additions & 8 deletions lib/helpers/route_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -108,15 +109,9 @@ class RoutePage {
return SlideLeftRoute(
page: TermsConditionsView(),
);
//TODO: Needs to have a separate screen for this

default:
return PageRouteBuilder<dynamic>(
pageBuilder:
(_, Animation<double> firstAni, Animation<double> secondAni) =>
const SizedBox(
child: Text('Nothing'),
),
);
return SlideLeftRoute(page: UnknownView(),);
}
}
}
81 changes: 81 additions & 0 deletions lib/views/unknown_view.dart
Original file line number Diff line number Diff line change
@@ -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: <Widget>[
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,
),
),
),
),
),
],
),
),
),
),
),
);
}
}

0 comments on commit 9c28ee5

Please sign in to comment.