Skip to content

Commit

Permalink
Merge pull request #154 from SapinderSingh/issue-151
Browse files Browse the repository at this point in the history
Fixed Issue #151
  • Loading branch information
himanshusharma89 committed Mar 24, 2021
2 parents 3bc2a72 + e44022f commit 0268e27
Show file tree
Hide file tree
Showing 18 changed files with 648 additions and 625 deletions.
8 changes: 6 additions & 2 deletions lib/dashboard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,13 @@ class _DashboardState extends State<Dashboard> {
});
},
children: <Widget>[
Home(),
Home(
pageController: _pageController,
),
Search(),
const Cart(),
Cart(
pageController: _pageController,
),
ProfilePage(),
],
),
Expand Down
42 changes: 26 additions & 16 deletions lib/helpers/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ class RouteConstant {
static const String ORDERS_SCREEN = '/orders';
static const String SETTINGS_SCREEN = '/settings';
static const String ABOUT_SCREEN = '/about';
static const String FAQs_SCREEN = '/faqs-screen';
static const String ADDRESS_SCREEN = '/address-screen';
static const String SIGN_UP_SCREEN = '/sign-up-screen';
static const String MANAGE_ADDRESS_SCREEN = '/manage-address-screen';
static const String PAYMENT_SUCCESSFULL = '/payment-successfull';
}

class RelicColors {
Expand All @@ -37,44 +42,49 @@ List<ProductCard> productsList = <ProductCard>[
height: 51,
),
),
ProductCard(
ProductCard(
product: Product(
text: 'EDISON TURNTABLE',
owner: 'by Tony Stark',
amount: '₹ 5035',
image: 'assets/items/4.png',
seller: 'SciPedia',
height: 43),),
ProductCard(
height: 43),
),
ProductCard(
product: Product(
text: 'TATUNG EINSTEIN',
owner: 'by Lloyd Duran',
amount: '₹ 4035',
image: 'assets/items/1.png',
seller: 'Diz Arts',
height: 48),),
ProductCard(
height: 48),
),
ProductCard(
product: Product(
text: 'MYRON DISC THROWER',
owner: 'by Lloyd Duran',
amount: '₹ 4035',
image: 'assets/items/2.png',
seller: 'AB Retial',
height: 32),),
ProductCard(
product: Product(
text: 'GUARDIAN CLOCK',
owner: 'by Claudia Davies',
amount: '₹ 4035',
image: 'assets/items/5.png',
seller: 'Electrica',
height: 19),),
ProductCard(
height: 32),
),
ProductCard(
product: Product(
text: 'GUARDIAN CLOCK',
owner: 'by Claudia Davies',
amount: '₹ 4035',
image: 'assets/items/5.png',
seller: 'Electrica',
height: 19),
),
ProductCard(
product: Product(
text: 'ROTATORY DIALER',
owner: 'by Lloyd Duran',
amount: '₹ 4035',
image: 'assets/items/6.png',
seller: 'RS Telecom',
height: 29),),
height: 29),
),
];
66 changes: 46 additions & 20 deletions lib/helpers/route_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,40 @@ import 'package:flutter/cupertino.dart';
import 'package:retro_shopping/dashboard.dart';
import 'package:retro_shopping/helpers/constants.dart';
import 'package:retro_shopping/helpers/slide_route.dart';
import 'package:retro_shopping/model/product_model.dart';
import 'package:retro_shopping/views/auth/signup_view.dart';
import 'package:retro_shopping/views/profile/orders.dart';

import 'package:retro_shopping/views/auth/login_view.dart';

import 'package:retro_shopping/views/cart_view.dart';
import 'package:retro_shopping/views/home_view.dart';
import 'package:retro_shopping/views/profile/profile_view.dart';
import 'package:retro_shopping/views/profile/settings/about.dart';
import 'package:retro_shopping/views/profile/settings/address_screen.dart';
import 'package:retro_shopping/views/profile/settings/faqs_screen.dart';
import 'package:retro_shopping/views/profile/settings/manage_address.dart';
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/widgets/payment/payment_successful.dart';
import 'package:retro_shopping/widgets/product/product_page.dart';

class RoutePage {
static Route<dynamic> generateRoute(RouteSettings settings) {
switch (settings.name) {
case RouteConstant.CART_SCREEN:
return SlideLeftRoute(
page: const Cart(),
page: Cart(),
);

case RouteConstant.HOME_SCREEN:
return SlideLeftRoute(
page: Home(),
);

case RouteConstant.LOGIN_SCREEN:
return SlideLeftRoute(
page: const SizedBox(
child: Text('Login Screen'),
),
page: LoginScreen(),
);

case RouteConstant.PROFILE_SCREEN:
Expand All @@ -41,44 +50,61 @@ class RoutePage {

case RouteConstant.ABOUT_SCREEN:
return SlideLeftRoute(
page: const SizedBox(
child: Text('About'),
),
page: AboutScreen(),
);

case RouteConstant.DASHBOARD_SCREEN:
return SlideLeftRoute(
page: Dashboard(),
);
case RouteConstant.PRODUCTS_SCREEN:
Product product = settings.arguments as Product;
return SlideBottomRoute(
page: ProductPage(),
page: ProductPage(
product: product,
),
);

case RouteConstant.WISHLIST_SCREEN:
return SlideLeftRoute(
page: const SizedBox(
child: Text('Wishlist Screen'),
),
page: const Wishlist(),
);
case RouteConstant.MANAGE_ADDRESS_SCREEN:
return SlideLeftRoute(
page: ManageAddress(),
);

case RouteConstant.ORDERS_SCREEN:
return SlideLeftRoute(
page: const SizedBox(
child: Text('Orders Screen'),
),
page: Order(),
);

case RouteConstant.SETTINGS_SCREEN:
return SlideLeftRoute(
page: const SizedBox(
child: Text('Settings Screen'),
),
page: Settings(),
);
case RouteConstant.PAYMENT_SUCCESSFULL:
return SlideLeftRoute(
page: const PaymentSuccessful(),
);
case RouteConstant.FAQs_SCREEN:
return SlideLeftRoute(
page: FaqsScreen(),
);
case RouteConstant.ADDRESS_SCREEN:
return SlideLeftRoute(
page: AddressScreen(),
);
case RouteConstant.SIGN_UP_SCREEN:
return SlideLeftRoute(
page: SignUpScreen(),
);
//TODO: Needs to have a separate screen for this
default:
return PageRouteBuilder<dynamic>(
pageBuilder: (_, Animation<double> firstAni, Animation<double> secondAni) => const SizedBox(
pageBuilder:
(_, Animation<double> firstAni, Animation<double> secondAni) =>
const SizedBox(
child: Text('Nothing'),
),
);
Expand Down
8 changes: 3 additions & 5 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:provider/provider.dart';
import 'package:retro_shopping/helpers/ad_state.dart';
import 'package:retro_shopping/helpers/constants.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
import 'package:retro_shopping/views/auth/login_view.dart';
import 'package:retro_shopping/helpers/route_page.dart';

Future<void> main() async {
//firebase Initialization
Expand Down Expand Up @@ -50,10 +50,8 @@ class MyApp extends StatelessWidget {
visualDensity: VisualDensity.adaptivePlatformDensity,
textTheme:
GoogleFonts.poppinsTextTheme(Theme.of(context).textTheme)),
routes: <String, WidgetBuilder>{
'/login': (BuildContext context) => LoginScreen(),
},
home: LoginScreen(),
onGenerateRoute: RoutePage.generateRoute,
initialRoute: RouteConstant.DASHBOARD_SCREEN,
),
);
}
Expand Down
85 changes: 38 additions & 47 deletions lib/views/auth/login_view.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:retro_shopping/helpers/constants.dart';
import 'package:retro_shopping/services/auth_service.dart';
import 'package:retro_shopping/views/auth/signup_view.dart';
import 'package:retro_shopping/widgets/retro_button.dart';
import 'package:retro_shopping/dashboard.dart';
import 'package:retro_shopping/widgets/stacked_container.dart';

class LoginScreen extends StatefulWidget {
Expand Down Expand Up @@ -76,37 +75,38 @@ class LoginScreenState extends State<LoginScreen> {
height: height * 0.020,
),
Stack(
// ignore: always_specify_types
children: [
Transform.translate(
offset: const Offset(25, 10),
child: Container(
color: Colors.black,
width: width * 0.77,
height: height * 0.065,
),
// ignore: always_specify_types
children: [
Transform.translate(
offset: const Offset(25, 10),
child: Container(
color: Colors.black,
width: width * 0.77,
height: height * 0.065,
),
Padding(
padding: const EdgeInsets.only(
left: 20.0, right: 20.0),
// ignore: sized_box_for_whitespace
child: Container(
height: height * 0.07,
child: TextField(
controller: _emailController,
decoration: const InputDecoration(
labelText: 'Email Address',
labelStyle: TextStyle(
fontSize: 20.0,
color: Colors.black),
filled: true,
fillColor: Colors.white,
border: OutlineInputBorder(
borderRadius:
BorderRadius.zero))),
),
Padding(
padding: const EdgeInsets.only(
left: 20.0, right: 20.0),
// ignore: sized_box_for_whitespace
child: Container(
height: height * 0.07,
child: TextField(
controller: _emailController,
decoration: const InputDecoration(
labelText: 'Email Address',
labelStyle: TextStyle(
fontSize: 20.0, color: Colors.black),
filled: true,
fillColor: Colors.white,
border: OutlineInputBorder(
borderRadius: BorderRadius.zero),
),
),
),
]),
),
],
),
SizedBox(
height: height * 0.030,
),
Expand Down Expand Up @@ -155,10 +155,9 @@ class LoginScreenState extends State<LoginScreen> {
onTap: () {
debugPrint('Login!');
// ignore: always_specify_types
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) {
return Dashboard();
}));
Navigator.of(context).pushNamed(
RouteConstant.DASHBOARD_SCREEN,
);
},
child: RetroButton(
upperColor: Colors.black,
Expand Down Expand Up @@ -196,13 +195,9 @@ class LoginScreenState extends State<LoginScreen> {
.then(
(String result) {
if (result != null) {
Navigator.of(context).pushReplacement(
// ignore: always_specify_types
MaterialPageRoute(
builder: (BuildContext context) {
return Dashboard();
},
),
Navigator.of(context)
.pushReplacementNamed(
RouteConstant.DASHBOARD_SCREEN,
);
}
},
Expand Down Expand Up @@ -242,12 +237,8 @@ class LoginScreenState extends State<LoginScreen> {
InkWell(
onTap: () {
// ignore: always_specify_types
Navigator.pushReplacement(context,
MaterialPageRoute<dynamic>(
builder: (BuildContext context) {
debugPrint('Navigate to sign up page');
return SignUpScreen();
}));
Navigator.of(context)
.pushNamed(RouteConstant.SIGN_UP_SCREEN);
},
child: const Text(
'SignUp',
Expand Down
Loading

0 comments on commit 0268e27

Please sign in to comment.