-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Bazaar] Create UI of a single business page (#1303)
* created Single Business, its stores, widgets * added svg * navigation from BazaarMain to SingleBusinessView * added dic to mapButton, deleted comments from BusinessDetailPage, sorted imports * fixed model, store and navigation * added translation, added xtra parameters in model and widgets * did fixes by PR comments * deleted unused assets * fixes by PR comments
- Loading branch information
1 parent
5587f7e
commit 86f4cdb
Showing
24 changed files
with
724 additions
and
82 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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,82 @@ | ||
import 'package:json_annotation/json_annotation.dart'; | ||
|
||
part 'single_business.g.dart'; | ||
|
||
@JsonSerializable() | ||
class SingleBusiness { | ||
const SingleBusiness({ | ||
required this.name, | ||
required this.description, | ||
required this.category, | ||
required this.address, | ||
required this.zipcode, | ||
required this.addressDescription, | ||
required this.telephone, | ||
required this.email, | ||
required this.longitude, | ||
required this.latitude, | ||
required this.openingHours1, | ||
required this.openingHours2, | ||
required this.logo, | ||
required this.photo, | ||
required this.offer, | ||
required this.offerName1, | ||
required this.offerName2, | ||
required this.moreInfo, | ||
this.status, | ||
this.isLiked = false, | ||
this.isLikedPersonally = false, | ||
this.countLikes = 0, | ||
}); | ||
factory SingleBusiness.fromJson(Map<String, dynamic> json) => _$SingleBusinessFromJson(json); | ||
Map<String, dynamic> toJson() => _$SingleBusinessToJson(this); | ||
|
||
final String name; | ||
final String description; | ||
final String category; | ||
final String address; | ||
final String zipcode; | ||
final String addressDescription; | ||
final String telephone; | ||
final String email; | ||
final double longitude; | ||
final double latitude; | ||
final String openingHours1; | ||
final String openingHours2; | ||
final String logo; | ||
final String photo; | ||
final String offer; | ||
final String offerName1; | ||
final String offerName2; | ||
final String moreInfo; | ||
final String? status; | ||
final bool isLiked; | ||
final bool isLikedPersonally; | ||
final int countLikes; | ||
} | ||
|
||
const singleBusinessMockData = { | ||
'name': 'Hatha Lisa', | ||
'description': | ||
'Nutze deine Leu, um deinem Körper und Geist etwas Gutes zu tun. Besuche eine Yogastunde im Kreis 4 oder Kreis 5 mit Lisa Stähli, einer Hatha-Yoga-Lehrerin mit über 4 Jahren Unterrichtserfahrung. Die Klassen sind für alle Niveaus geeignet, werden auf Englisch unterrichtet und bieten sowohl eine Herausforderung als auch die Möglichkeit, sein Gleichgewicht zu finden.\n\nErfahre mehr oder kontaktiere uns:\nhttps://hathalisa.com/', | ||
'category': 'Body & Soul', | ||
'addressDescription': 'Yoga Studio Zürich', | ||
'address': 'Zwinglistrasse, 8', | ||
'zipcode': '8004, Zürich', | ||
'telephone': '+41 123 456 789', | ||
'email': 'info@hathalisa.com', | ||
'longitude': 8.515962660312653, | ||
'latitude': 47.390349148891545, | ||
'openingHours1': 'Tuesdays 07:30-08:30', | ||
'openingHours2': 'Wednesday 12:15-13:20', | ||
'logo': 'QmUH7W2eAWTfHRYYV1YitZaz54sTjEwv6udjZjh7Tg47Xv', | ||
'photo': 'https://github.com/SourbaevaJanaraJ/lock_screen/blob/master/assets/hatha_lisa_single_b.png?raw=true', | ||
'offer': 'Offer for Leu', | ||
'offerName1': 'Single course LEU 25', | ||
'offerName2': '10-course subscription LEU 200', | ||
'moreInfo': 'With Leu since 01 January 2023', | ||
'status': 'Neu bei Leu', | ||
'isLiked': false, | ||
'isLikedPersonally': false, | ||
'countLikes': 0 | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
2 changes: 1 addition & 1 deletion
2
...er/new_bazaar/logic/businesses_store.dart → ...ar/businesses/logic/businesses_store.dart
This file contains 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
File renamed without changes.
8 changes: 4 additions & 4 deletions
8
...nter/new_bazaar/view/businesses_view.dart → ...zaar/businesses/view/businesses_view.dart
This file contains 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
86 changes: 86 additions & 0 deletions
86
app/lib/page-encointer/new_bazaar/businesses/widgets/businesses_card.dart
This file contains 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,86 @@ | ||
import 'package:encointer_wallet/page-encointer/new_bazaar/single_business/logic/single_business_store.dart'; | ||
import 'package:encointer_wallet/page-encointer/new_bazaar/single_business/views/single_business_view.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'package:encointer_wallet/models/bazaar/businesses.dart'; | ||
import 'package:encointer_wallet/theme/theme.dart'; | ||
import 'package:provider/provider.dart'; | ||
|
||
class BusinessesCard extends StatelessWidget { | ||
const BusinessesCard({super.key, required this.businesses}); | ||
|
||
final Businesses businesses; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final textTheme = context.textTheme; | ||
return InkWell( | ||
onTap: () { | ||
Navigator.push<Widget>( | ||
context, | ||
MaterialPageRoute( | ||
builder: (context) => Provider( | ||
create: (context) => SingleBusinessStore(businesses)..getSingleBusiness(), | ||
child: const SingleBusinessView(), | ||
), | ||
), | ||
); | ||
}, | ||
child: SizedBox( | ||
height: 160, | ||
child: Card( | ||
margin: const EdgeInsets.only(top: 10), | ||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), | ||
child: Row( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
DecoratedBox( | ||
decoration: BoxDecoration( | ||
image: DecorationImage( | ||
fit: BoxFit.cover, | ||
image: NetworkImage(businesses.photo), | ||
), | ||
borderRadius: const BorderRadius.only( | ||
topLeft: Radius.circular(20), | ||
bottomLeft: Radius.circular(20), | ||
), | ||
), | ||
child: const SizedBox(height: double.infinity, width: 130), | ||
), | ||
Expanded( | ||
child: ListTile( | ||
contentPadding: const EdgeInsets.fromLTRB(10, 10, 10, 5), | ||
title: Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
Expanded(child: Text(businesses.category.name, style: textTheme.bodySmall)), | ||
Text( | ||
businesses.status?.name ?? '', | ||
style: textTheme.bodySmall!.copyWith(color: businesses.status?.textColor ?? Colors.black), | ||
) | ||
], | ||
), | ||
subtitle: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
const SizedBox(height: 28), | ||
Text(businesses.name, style: textTheme.labelLarge), | ||
const SizedBox(height: 8), | ||
Text( | ||
businesses.description, | ||
style: textTheme.bodyMedium, | ||
overflow: TextOverflow.ellipsis, | ||
maxLines: 2, | ||
), | ||
const SizedBox(height: 18), | ||
], | ||
), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains 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
File renamed without changes.
Oops, something went wrong.