-
Notifications
You must be signed in to change notification settings - Fork 160
Feature/fetch and display region specific restaurants on home view #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ebrahim-soliman
wants to merge
20
commits into
main
Choose a base branch
from
feature/Fetch-and-Display-region-specific-restaurants-on-Home-View
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
25d708a
move fake merchaints collection inside a region document
546acb4
move fake products collection under merchants new path
1db7b59
Build the LargeMerchantItem in the box_ui project and add it to the e…
27d5d4d
Add the function in the FirestoreApi to get the merchants for a regio…
6d7b48b
change faker api field image to images to match the card design
a7bcf3c
update LargeMerchantItem field names
33b09b8
Display merchants list through the ViewModel using a FutureViewModel
68d557b
use BoxText widget
3008951
constants instead of dublicate strings
35b8331
rerun build runner
50d8a40
change request by Dane
450ec92
change fucntion name createMerchantProduct
d558827
word spelling and a refactor
d4c97d2
get the user region Id instead of hardcoded one
adfcaa6
add try-catch to getAddressListForUser
480adc1
clean error handling
f0e63a1
limit fake merchants rating to be between 0-5
864ff07
add 2 unit tests to homeviewmodel
5e3b5be
add one more test to homeviewmodel
e16e502
minor changes
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| import 'package:flutter/material.dart'; | ||
|
|
||
| const Color kcPrimaryColor = Color(0xff22A45D); | ||
| const Color kcDeepGreyColor = Color(0xff010F07); | ||
| const Color kcMediumGreyColor = Color(0xff868686); | ||
| const Color kcSemiLightColor = Color(0xffD8D8D8); | ||
| const Color kcLightGreyColor = Color(0xffe5e5e5); | ||
| const Color kcVeryLightGreyColor = Color(0xfff2f2f2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
src/clients/box_ui/lib/src/widgets/large_merchants_item.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| import 'package:box_ui/box_ui.dart'; | ||
| import 'package:box_ui/src/shared/styles.dart'; | ||
| import 'package:flutter/material.dart'; | ||
|
|
||
| import 'large_merchants_item_images_carousel.dart'; | ||
|
|
||
| class LargeMerchantItem extends StatelessWidget { | ||
| final List<String> images; | ||
| final String name; | ||
| final List<String> categories; | ||
| final double? rating; | ||
| final int? numberOfRatings; | ||
| final int? deliveryInMinutes; | ||
| final double? deliveryCost; | ||
| final bool isClosed; | ||
|
|
||
| const LargeMerchantItem( | ||
| {Key? key, | ||
| required this.images, | ||
| required this.name, | ||
| required this.categories, | ||
| this.deliveryInMinutes, | ||
| this.deliveryCost, | ||
| this.rating, | ||
| this.numberOfRatings, | ||
| this.isClosed = false}) | ||
| : super(key: key); | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| return Column( | ||
| crossAxisAlignment: CrossAxisAlignment.start, | ||
| children: [ | ||
| LargeMerchantsItemImagesCarsouel( | ||
| images: images, | ||
| ), | ||
| verticalSpaceSmall, | ||
| BoxText.subheading(name), | ||
| verticalSpaceTiny, | ||
| BoxText.body( | ||
| categories.join(' • '), | ||
| color: kcMediumGreyColor, | ||
| ), | ||
| verticalSpaceSmall, | ||
| Row( | ||
| children: [ | ||
| if (rating != null) ...[ | ||
| BoxText.caption( | ||
| rating.toString(), | ||
| ), | ||
| horizontalSpaceTiny, | ||
| Icon( | ||
| Icons.star_rounded, | ||
| color: kcPrimaryColor, | ||
| size: 15, | ||
| ), | ||
| horizontalSpaceTiny, | ||
| BoxText.caption( | ||
| numberOfRatings.toString() + ' Ratings', | ||
| ), | ||
| horizontalSpaceTiny, | ||
| ], | ||
| if (deliveryInMinutes != null) ...[ | ||
| Icon( | ||
| Icons.watch_later_rounded, | ||
| color: Colors.black.withOpacity(0.6), | ||
| size: 15, | ||
| ), | ||
| horizontalSpaceTiny, | ||
| BoxText.caption( | ||
| deliveryInMinutes.toString() + ' Min', | ||
| ), | ||
| horizontalSpaceTiny, | ||
| ], | ||
| if (deliveryCost != null) ...[ | ||
| BoxText.body( | ||
| '•', | ||
| color: kcMediumGreyColor.withOpacity(0.5), | ||
| ), | ||
| horizontalSpaceTiny, | ||
| Icon( | ||
| Icons.attach_money_rounded, | ||
| color: kcMediumGreyColor, | ||
| size: 15, | ||
| ), | ||
| horizontalSpaceTiny, | ||
| BoxText.caption( | ||
| deliveryCost == 0.0 ? 'Free' : deliveryCost.toString(), | ||
| ), | ||
| ] | ||
| ], | ||
| ) | ||
| ], | ||
| ); | ||
| } | ||
| } |
64 changes: 64 additions & 0 deletions
64
src/clients/box_ui/lib/src/widgets/large_merchants_item_images_carousel.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| import 'package:box_ui/src/shared/app_colors.dart'; | ||
| import 'package:carousel_slider/carousel_slider.dart'; | ||
| import 'package:flutter/material.dart'; | ||
|
|
||
| class LargeMerchantsItemImagesCarsouel extends StatefulWidget { | ||
| final List<String> images; | ||
| const LargeMerchantsItemImagesCarsouel({Key? key, required this.images}) | ||
| : super(key: key); | ||
|
|
||
| @override | ||
| _LargeMerchantsItemImagesCarsouelState createState() => | ||
| _LargeMerchantsItemImagesCarsouelState(); | ||
| } | ||
|
|
||
| class _LargeMerchantsItemImagesCarsouelState | ||
| extends State<LargeMerchantsItemImagesCarsouel> { | ||
| int _currentIndex = 0; | ||
| @override | ||
| Widget build(BuildContext context) { | ||
| return Stack( | ||
| children: [ | ||
| ClipRRect( | ||
| borderRadius: BorderRadius.circular(20), | ||
| child: CarouselSlider( | ||
| items: widget.images | ||
| .map((imageUrl) => Container( | ||
| width: double.infinity, | ||
| color: kcLightGreyColor, | ||
| child: Image.network( | ||
| imageUrl, | ||
| fit: BoxFit.cover, | ||
| ), | ||
| )) | ||
| .toList(), | ||
| options: CarouselOptions( | ||
| aspectRatio: 1.8, | ||
| viewportFraction: 1, | ||
| onPageChanged: (currentPageIndex, _) { | ||
| setState(() { | ||
| _currentIndex = currentPageIndex; | ||
| }); | ||
| })), | ||
| ), | ||
| Positioned( | ||
| bottom: 20, | ||
| right: 20, | ||
| child: Row( | ||
| children: [ | ||
| ...widget.images.asMap().entries.map((map) => Container( | ||
| margin: const EdgeInsets.only(right: 8), | ||
| width: 8, | ||
| height: 5, | ||
| decoration: BoxDecoration( | ||
| color: Colors.white | ||
| .withOpacity(_currentIndex == map.key ? 1 : 0.3), | ||
| borderRadius: BorderRadius.circular(32)), | ||
| )) | ||
| ], | ||
| ), | ||
| ), | ||
| ], | ||
| ); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.