Skip to content

Commit

Permalink
Add Read me
Browse files Browse the repository at this point in the history
  • Loading branch information
usamaaelgendy committed Jan 7, 2021
1 parent e1ea0a7 commit c612eb4
Show file tree
Hide file tree
Showing 17 changed files with 323 additions and 104 deletions.
Binary file added Account.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Auth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Cart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added CheckOut.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 38 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,44 @@
# ecommerce_app
# E-Commerce Complate App - Flutter Firebase Using Get-x

A new Flutter application.
In our complete e-commerce app.
we show you how you can create a nice
clean archetecture and clean design for your e-commerce app that can
run both Andriod and iOS devices because it builds with flutter.

## Getting Started
## [Watch it on YouTube](https://www.youtube.com/playlist?list=PLV1fXIAyjeuZ2pOUkmHwzMJCJgCedrQJW)

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:
### Video Preview of Final UI

- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
![Preview](/intro.mp4)

For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
## Screens it contains:

=> Splash

=> Login

=> Forgot Password

=> Sign Up

=> Complete Profile

=> Home Page

=> Product Details

=> Cart

=> Order

=> Profile

=> Bottom Navigation Bar

## Photos
![Preview](/Auth.png)
![Preview](Account.png)
![Preview](Cart.png)
![Preview](Home.png)
![Preview](CheckOut.png)
Binary file added assets/fonts/SourceSansPro.ttf
Binary file not shown.
Binary file added intro.mp4
Binary file not shown.
18 changes: 7 additions & 11 deletions lib/core/view_model/auth_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import 'package:ecommerce_app/model/user_model.dart';
import 'package:ecommerce_app/view/home_view.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:flutter_facebook_login/flutter_facebook_login.dart';
import 'package:flutter_facebook_auth/flutter_facebook_auth.dart';
import 'package:get/get.dart';
import 'package:google_sign_in/google_sign_in.dart';

class AuthViewModel extends GetxController {
GoogleSignIn _googleSignIn = GoogleSignIn(scopes: ['email']);
FirebaseAuth _auth = FirebaseAuth.instance;
FacebookLogin _facebookLogin = FacebookLogin();

String email, password, name;

Expand Down Expand Up @@ -55,17 +54,14 @@ class AuthViewModel extends GetxController {
}

void facebookSignInMethod() async {
FacebookLoginResult result = await _facebookLogin.logIn(['email']);
final AccessToken result = await FacebookAuth.instance.login();

final accessToken = result.accessToken.token;
final FacebookAuthCredential facebookAuthCredential =
FacebookAuthProvider.credential(result.token);

if (result.status == FacebookLoginStatus.loggedIn) {
final faceCredential = FacebookAuthProvider.credential(accessToken);

await _auth.signInWithCredential(faceCredential).then((user) async {
saveUser(user);
});
}
await _auth.signInWithCredential(facebookAuthCredential).then((user) {
saveUser(user);
});
}

void signInWithEmailAndPassword() async {
Expand Down
18 changes: 18 additions & 0 deletions lib/helper/extenstion.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import 'package:flutter/material.dart';

extension HexColor on Color {
/// String is in the format "aabbcc" or "ffaabbcc" with an optional leading "#".
static Color fromHex(String hexString) {
final buffer = StringBuffer();
if (hexString.length == 6 || hexString.length == 7) buffer.write('ff');
buffer.write(hexString.replaceFirst('#', ''));
return Color(int.parse(buffer.toString(), radix: 16));
}

/// Prefixes a hash sign if [leadingHashSign] is set to `true` (default is `true`).
String toHex({bool leadingHashSign = true}) => '${leadingHashSign ? '#' : ''}'
'${alpha.toRadixString(16).padLeft(2, '0')}'
'${red.toRadixString(16).padLeft(2, '0')}'
'${green.toRadixString(16).padLeft(2, '0')}'
'${blue.toRadixString(16).padLeft(2, '0')}';
}
3 changes: 3 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ class MyApp extends StatelessWidget {
home: Scaffold(
body: ControlView(),
),
theme: ThemeData(
fontFamily: 'SourceSans',
),
);
}
}
8 changes: 6 additions & 2 deletions lib/model/product_model.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import 'package:ecommerce_app/helper/extenstion.dart';
import 'package:flutter/cupertino.dart';

class ProductModel {
String name, image, description, color, sized, price;
String name, image, description, sized, price;
Color color;

ProductModel(
{this.name,
Expand All @@ -17,7 +21,7 @@ class ProductModel {
name = map['name'];
image = map['image'];
description = map['description'];
color = map['color'];
color = HexColor.fromHex(map['color']);
sized = map['sized'];
price = map['price'];
}
Expand Down
150 changes: 150 additions & 0 deletions lib/view/daetilas_view.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
import 'package:ecommerce_app/constance.dart';
import 'package:ecommerce_app/model/product_model.dart';
import 'package:ecommerce_app/view/widgets/custom_buttom.dart';
import 'package:ecommerce_app/view/widgets/custom_text.dart';
import 'package:flutter/material.dart';

class DetailsView extends StatelessWidget {
ProductModel model;

DetailsView({this.model});

@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
child: Column(
children: [
Container(
width: MediaQuery.of(context).size.width,
height: 270,
child: Image.network(
model.image,
fit: BoxFit.fill,
),
),
SizedBox(
height: 15,
),
Expanded(
child: SingleChildScrollView(
child: Container(
padding: EdgeInsets.all(18),
child: Column(
children: [
CustomText(
text: model.name,
fontSize: 26,
),
SizedBox(
height: 15,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Container(
padding: EdgeInsets.all(16),
width: MediaQuery.of(context).size.width * .4,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
border: Border.all(
color: Colors.grey,
)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
CustomText(
text: 'Size',
),
CustomText(
text: model.sized,
),
],
),
),
Container(
padding: EdgeInsets.all(16),
width: MediaQuery.of(context).size.width * .44,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
border: Border.all(
color: Colors.grey,
)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
CustomText(
text: 'Color',
),
Container(
width: 30,
height: 20,
padding: EdgeInsets.all(12),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey),
borderRadius: BorderRadius.circular(20),
color: model.color,
),
)
],
),
),
],
),
SizedBox(
height: 15,
),
CustomText(
text: 'Details',
fontSize: 18,
),
SizedBox(
height: 20,
),
CustomText(
text: model.description,
fontSize: 18,
height: 2.5,
)
],
),
),
),
),
Padding(
padding: const EdgeInsets.all(30),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
CustomText(
text: "PRICE ",
fontSize: 22,
color: Colors.grey,
),
CustomText(
text: ' \$' + model.price,
color: primaryColor,
fontSize: 18,
)
],
),
Container(
padding: EdgeInsets.all(20),
width: 180,
height: 100,
child: CustomButton(
onPress: () {},
text: 'Add',
),
),
],
),
)
],
),
),
);
}
}
Loading

0 comments on commit c612eb4

Please sign in to comment.