Skip to content

Commit

Permalink
2
Browse files Browse the repository at this point in the history
  • Loading branch information
fateh491989 committed Mar 19, 2020
1 parent 4bb0230 commit 47c1db8
Show file tree
Hide file tree
Showing 51 changed files with 2,125 additions and 926 deletions.
Binary file added ScreenShots/1.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ScreenShots/3.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ScreenShots/4.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added attachments.zip
Binary file not shown.
Binary file added images/welcome.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -1,11 +1,7 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'login.dart';
import 'register.dart';
import '../Config/config.dart';
import '../dialogs/errorDialog.dart';
import '../dialogs/loadingDialog.dart';
import 'package:ecommerce/Config/config.dart';


class AuthenticScreen extends StatefulWidget {
Expand Down
@@ -1,12 +1,11 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:ecommerce/Widgets/customTextField.dart';
import 'package:ecommerce/dialogs/errorDialog.dart';
import 'package:ecommerce/dialogs/loadingDialog.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import '../Authentication/authenication.dart';
import '../Config/config.dart';
import '../Widgets/customTextField.dart';
import '../dialogs/errorDialog.dart';
import '../dialogs/loadingDialog.dart';
import '../homepage.dart';
import '../Store/storehome.dart';
import 'package:ecommerce/Config/config.dart';


class Login extends StatefulWidget {
@override
Expand Down Expand Up @@ -118,8 +117,9 @@ class _LoginState extends State<Login> {
readDataToDataBase(currentUser).then((s) {
Navigator.pop(context);
// TODO navigate to homescreen
Route route = MaterialPageRoute(builder: (context) => StoreHomePage());
Navigator.pushReplacement(context, route);

Route newRoute = MaterialPageRoute(builder: (_) => StoreHome());
Navigator.pushReplacement(context, newRoute);
});
} else {
// _success = false;
Expand All @@ -142,7 +142,9 @@ Future readDataToDataBase(FirebaseUser currentUser) async {
.setString(EcommerceApp.userName, snapshot.data[EcommerceApp.userName]);
await EcommerceApp.sharedPreferences
.setString(EcommerceApp.userAvatarUrl, snapshot.data[EcommerceApp.userAvatarUrl]);
await EcommerceApp.sharedPreferences.setStringList(EcommerceApp.userCartList, snapshot.data[EcommerceApp.userCartList]);
print(snapshot.data[EcommerceApp.userCartList]);
List<String> cart = snapshot.data[EcommerceApp.userCartList].cast<String>();
await EcommerceApp.sharedPreferences.setStringList(EcommerceApp.userCartList, cart);
});
// .setData({
// DeliveryApp.userUID: currentUser.uid,
Expand Down
@@ -1,17 +1,14 @@
import 'dart:io';

import 'package:ecommerce/main.dart';
import 'package:ecommerce/Widgets/customTextField.dart';
import 'package:ecommerce/dialogs/errorDialog.dart';
import 'package:ecommerce/dialogs/loadingDialog.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_storage/firebase_storage.dart';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import '../Store/storehome.dart';
import 'package:ecommerce/Config/config.dart';

import '../Authentication/authenication.dart';
import '../Config/config.dart';
import '../Widgets/customTextField.dart';
import '../dialogs/errorDialog.dart';
import '../dialogs/loadingDialog.dart';
import '../homepage.dart';


class Register extends StatefulWidget {
Expand Down Expand Up @@ -94,13 +91,7 @@ class _RegisterState extends State<Register> {
child: Column(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Register here',
style: TextStyle(color: Colors.red),
),
),


InkWell(
onTap: _pickImage,
Expand Down Expand Up @@ -174,32 +165,7 @@ class _RegisterState extends State<Register> {
),
);
}

// void _completeRegister() {
// _passwordController.text == _passwordConfirmController.text
// ? _emailController.text.isNotEmpty &&
// _passwordConfirmController.text.isNotEmpty &&
// _nameController.text.isNotEmpty
// ? _register()
// : showDialog(
// context: context,
// builder: (con) {
// return ErrorAlertDialog(
// message: 'Please fill the desired fields',
// );
// })
// : showDialog(
// context: context,
// builder: (con) {
// return ErrorAlertDialog(
// message: 'Password doesn\'t match',
// );
// });
// }

void _register() async {


FirebaseUser currentUser;
await _auth
.createUserWithEmailAndPassword(
Expand All @@ -221,12 +187,9 @@ class _RegisterState extends State<Register> {
if (currentUser != null) {
writeDataToDataBase(currentUser).then((s) {
Navigator.pop(context);

Route route = MaterialPageRoute(builder: (context) => StoreHomePage());
Navigator.pushReplacement(context, route);
Route newRoute = MaterialPageRoute(builder: (_) => StoreHome());
Navigator.pushReplacement(context, newRoute);
});
} else {
// _success = false;
}
}

Expand Down
12 changes: 11 additions & 1 deletion lib/Store/Config/config.dart → lib/Config/config.dart
Expand Up @@ -5,7 +5,7 @@ import 'package:shared_preferences/shared_preferences.dart';

class EcommerceApp{
// App Information
static const String appName = 'Fresh Genie';
static const String appName = 'Book Store';



Expand All @@ -17,8 +17,10 @@ class EcommerceApp{

// Firebase Collection name
static String collectionUser = "users";
static String collectionOrders = "orders"; // subCollection
static String collectionAllBooks = "books";
static String userCartList = 'userCart';
static String subCollectionAddress = 'userAddress';

//Strings
static String signInText = "Sign in using Phone Number";
Expand All @@ -42,4 +44,12 @@ class EcommerceApp{

// BOOKs field

// Order fields
static final String addressID = 'addressID';
static final String totalAmount = 'totalAmount';
static final String productID = 'productIDs';
static final String paymentDetails ='paymentDetails';
static final String orderTime ='orderTime';
static final String isSuccess ='isSuccess';

}
37 changes: 37 additions & 0 deletions lib/Config/light_color.dart
@@ -0,0 +1,37 @@
import 'package:flutter/material.dart';

class LightColor {
static const Color background = Color(0XFFFFFFFF);

static const Color titleTextColor = const Color(0xff5a5d85);
static const Color subTitleTextColor = const Color(0xff797878);

static const Color bottonTitleTextColor = const Color(0xffd4d4ea);

static const Color grey = Color(0xff9D99A7);
static const Color darkgrey = Color(0xff625f6a);

static const Color yellow = Color(0xfffbbd5c);

static const Color orange = Color(0xfff96d5b);
static const Color darkOrange = Color(0xfff46352);
static const Color lightOrange = Color(0xfffa8e5c);
static const Color lightOrange2 = Color(0xfff97d6d);

static const Color purple = Color(0xff7a81dd);
static const Color lightpurple = Color(0xff898edf);
static const Color darkpurple = Color(0xff7178d3);
static const Color extraDarkPurple = Color(0xff494c79);

static const Color seeBlue = Color(0xff73d4dd);
static const Color darkseeBlue = Color(0xff63c4cf);
static const Color lightseeBlue = Color(0xffb9e6fc);

static const Color brighter = Color(0xff3754aa);
static const Color Darker = Color(0xffffffff);
static const Color black = Color(0xff040405);
static const Color lightblack = Color(0xff3E404D);
static const Color lightGrey = Color(0xffDFE7DD);
static const Color darkBlue = Color(0xff13165A);
static const Color lightBlue = Color(0xff203387);
}
46 changes: 46 additions & 0 deletions lib/Config/theme.dart
@@ -0,0 +1,46 @@
import 'package:flutter/material.dart';
import 'light_color.dart';

class AppTheme {
const AppTheme();
static ThemeData lightTheme = ThemeData(
primarySwatch: Colors.blue,
backgroundColor: LightColor.background,
primaryColor: LightColor.purple,
accentColor: LightColor.lightblack,
primaryColorDark: LightColor.Darker,
primaryColorLight: LightColor.brighter,
cardTheme: CardTheme(color: LightColor.background),
textTheme: TextTheme(display1: TextStyle(color: LightColor.black)),
iconTheme: IconThemeData(color: LightColor.lightblack),
bottomAppBarColor: LightColor.background,
dividerColor: LightColor.lightGrey,
colorScheme: ColorScheme(
primary: LightColor.purple,
primaryVariant: LightColor.purple,
secondary: LightColor.lightBlue,
secondaryVariant: LightColor.darkBlue,
surface: LightColor.background,
background: LightColor.background,
error: Colors.red,
onPrimary: LightColor.Darker,
onSecondary: LightColor.background,
onSurface: LightColor.Darker,
onBackground: LightColor.titleTextColor,
onError: LightColor.titleTextColor,
brightness: Brightness.dark),
);

static TextStyle titleStyle =
const TextStyle(color: LightColor.titleTextColor, fontSize: 16);
static TextStyle subTitleStyle =
const TextStyle(color: LightColor.subTitleTextColor, fontSize: 12);

static TextStyle h1Style =
const TextStyle(fontSize: 24, fontWeight: FontWeight.bold);
static TextStyle h2Style = const TextStyle(fontSize: 22);
static TextStyle h3Style = const TextStyle(fontSize: 20);
static TextStyle h4Style = const TextStyle(fontSize: 18);
static TextStyle h5Style = const TextStyle(fontSize: 16);
static TextStyle h6Style = const TextStyle(fontSize: 14);
}
135 changes: 135 additions & 0 deletions lib/Delievery/addAddress.dart
@@ -0,0 +1,135 @@
import 'package:ecommerce/Config/config.dart';
import 'package:ecommerce/Widgets/customAppBar.dart';
import 'package:ecommerce/modals/address.dart';
import 'package:flutter/material.dart';

class AddAddress extends StatelessWidget {
final _cName = TextEditingController();
final _cPhoneNumber = TextEditingController();
final _cFlatNumber = TextEditingController();
final _cArea = TextEditingController();
final _clandmark = TextEditingController();
final _cCity = TextEditingController();
final _cState = TextEditingController();
final _cPincode = TextEditingController();
final formKey = GlobalKey<FormState>();
final scaffoldKey = GlobalKey<ScaffoldState>();

@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
key: scaffoldKey,
appBar: MyAppBar(),
floatingActionButton: FloatingActionButton.extended(
onPressed: () {
if (formKey.currentState.validate()) {
final model = AddressModel(
name: _cName.text,
state: _cState.text,
pincode: _cPincode.text,
phoneNumber: _cPincode.text,
landmark: _clandmark.text,
flatNumber: _cFlatNumber.text,
city: _cCity.text,
area: _cArea.text)
.toJson();
EcommerceApp.firestore
.collection(EcommerceApp.collectionUser)
.document(
EcommerceApp.sharedPreferences.getString(EcommerceApp.userUID))
.collection(EcommerceApp.subCollectionAddress)
.document(DateTime.now().millisecondsSinceEpoch.toString())
.setData(model).then((_){
final snackbar = SnackBar(content: Text('Address added successfully'));
scaffoldKey.currentState.showSnackBar(snackbar);
FocusScope.of(context).requestFocus(FocusNode());
formKey.currentState.reset();
});
}
},
label: Text('Done'),
backgroundColor: Colors.deepPurple,
icon: Icon(Icons.check),
),
body: SingleChildScrollView(
child: Column(
children: <Widget>[
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Add address',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 20),
),
),
),
Form(
key: formKey,
child: Column(
children: <Widget>[
MyTextField(
hint: 'Name',
controller: _cName,
),
MyTextField(
hint: 'Phone Number',
controller: _cPhoneNumber,
),
MyTextField(
hint: 'Flat Number',
controller: _cFlatNumber,
),
MyTextField(
hint: 'Area',
controller: _cArea,
),
MyTextField(
hint: 'Landmark',
controller: _clandmark,
),
MyTextField(
hint: 'City',
controller: _cCity,
),
MyTextField(
hint: 'State',
controller: _cState,
),
MyTextField(
hint: 'Pincode',
controller: _cPincode,
),
],
)),

],
),
),
),
);
}
}

class MyTextField extends StatelessWidget {
final String hint;
final TextEditingController controller;

const MyTextField({Key key, this.hint, this.controller}) : super(key: key);

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: TextFormField(
controller: controller,
decoration: InputDecoration.collapsed(hintText: hint),
validator: (value) => value.isEmpty ? 'Field can\'t be blank' : null,
),
);
}
}

0 comments on commit 47c1db8

Please sign in to comment.