Skip to content

Commit

Permalink
task: store details setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Atuoha committed Oct 8, 2022
1 parent 97cae9c commit 8da2e2d
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/views/main/store/store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class _StoreScreenState extends State<StoreScreen> {
color: primaryColor,
),
Text(
'Store',
'Stores',
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 28,
Expand Down
116 changes: 108 additions & 8 deletions lib/views/main/store/store_details.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';

import '../../../constants/colors.dart';
import '../../../utilities/products_stream_builder.dart';

class StoreDetails extends StatefulWidget {
const StoreDetails({
Expand All @@ -14,24 +16,122 @@ class StoreDetails extends StatefulWidget {
}

class _StoreDetailsState extends State<StoreDetails> {
void placeCall() {
// TODO: Implement placeCall
}

@override
Widget build(BuildContext context) {
var store = widget.store;

final Stream<QuerySnapshot> productsStream = FirebaseFirestore.instance
.collection('products')
.where('seller_id', isEqualTo: store.id)
.snapshots();

Size size = MediaQuery.of(context).size;
return Scaffold(
extendBodyBehindAppBar: true,
bottomSheet: Card(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 3.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
store['phone'],
style: const TextStyle(
fontWeight: FontWeight.bold,
),
),
Directionality(
textDirection: TextDirection.rtl,
child: ElevatedButton.icon(
style: ElevatedButton.styleFrom(
primary: primaryColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
),
onPressed: () => placeCall(),
icon: const Icon(
Icons.phone,
color: Colors.white,
),
label: const Text(
'Place Call',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
)
],
),
),
),
appBar: AppBar(
elevation: 0,
backgroundColor: Colors.transparent,
automaticallyImplyLeading: false,
leading: Builder(builder: (context) {
return GestureDetector(
onTap: () => Navigator.of(context).pop(),
child: const Icon(
Icons.chevron_left,
size: 35,
leading: Builder(
builder: (context) {
return GestureDetector(
onTap: () => Navigator.of(context).pop(),
child: const Icon(
Icons.chevron_left,
size: 35,
color: primaryColor,
),
);
},
),
actions: const [
Padding(
padding: EdgeInsets.only(right: 18.0),
child: Icon(
Icons.storefront,
color: primaryColor,
size: 35,
),
)
],
),
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: size.height / 3,
child: Image.network(
store['image'],
fit: BoxFit.cover,
),
),
);
}),
const SizedBox(height: 10),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 18.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
store['fullname'],
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 30,
),
),
Text(store['address']),
])),
SizedBox(
height: size.height / 1,
child: ProductStreamBuilder(
productStream: productsStream,
),
)
],
),
),
);
}
Expand Down

0 comments on commit 8da2e2d

Please sign in to comment.