Skip to content

Commit

Permalink
task: favorite screen with products
Browse files Browse the repository at this point in the history
  • Loading branch information
Atuoha committed Oct 10, 2022
1 parent 321d080 commit f5200c3
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 30 deletions.
54 changes: 28 additions & 26 deletions lib/views/main/customer/favorites.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_storage/firebase_storage.dart';
import 'package:flutter/material.dart';
import '../../../components/search_box.dart';
import '../../../constants/colors.dart';
import '../../../utilities/products_stream_builder.dart';
import '../product_categories/children.dart';
import '../product_categories/men.dart';
import '../product_categories/others.dart';
import '../product_categories/sneakers.dart';
import '../product_categories/women.dart';

class FavoriteScreen extends StatefulWidget {
const FavoriteScreen({Key? key}) : super(key: key);
Expand All @@ -10,39 +18,33 @@ class FavoriteScreen extends StatefulWidget {
}

class _FavoriteScreenState extends State<FavoriteScreen> {
Stream<QuerySnapshot> productStream = FirebaseFirestore.instance
.collection('products')
.where('isFav', isEqualTo: true)
.snapshots();

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(
top: 50,
right: 18.0,
left: 18.0,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const SearchBox(),
const SizedBox(height: 20),
Center(
child: Column(
children: [
ClipRRect(
borderRadius: BorderRadius.circular(20),
child: Image.asset('assets/images/love.gif'),
),
const SizedBox(height: 10),
const Text(
'No favorite products',
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 20,
color: primaryColor,
),
)
],
child: SingleChildScrollView(
child: Column(
children: [
Container(
margin: const EdgeInsets.symmetric(horizontal: 18),
child: const SearchBox(),
),
const SizedBox(height: 10),
SizedBox(
height: MediaQuery.of(context).size.height / 1.2,
child: ProductStreamBuilder(
productStream: productStream,
),
),
),
],
],
),
),
);
}
Expand Down
11 changes: 7 additions & 4 deletions lib/views/main/seller/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ class HomeScreen extends StatefulWidget {

class _HomeScreenState extends State<HomeScreen> {
var currentTabIndex = 0;


var categories = ['Men', 'Women', 'Children', 'Sneakers', 'Others'];
var categories = [
'Men',
'Women',
'Children',
'Sneakers',
'Others',
];

final categoriesList = const [
MenWears(),
Expand Down Expand Up @@ -49,7 +53,6 @@ class _HomeScreenState extends State<HomeScreen> {
);
}


@override
Widget build(BuildContext context) {
return Padding(
Expand Down
File renamed without changes
Binary file added screenshots/New folder/favorites.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file removed screenshots/New folder/product_adj.png
Binary file not shown.
Binary file removed screenshots/New folder/store_adj.png
Binary file not shown.

0 comments on commit f5200c3

Please sign in to comment.