Skip to content

Commit

Permalink
[Bazaar] Create UI of a single business page (#1303)
Browse files Browse the repository at this point in the history
* 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
SourbaevaJanaraJ authored and clangenb committed Jul 7, 2023
1 parent 5587f7e commit 86f4cdb
Show file tree
Hide file tree
Showing 24 changed files with 724 additions and 82 deletions.
2 changes: 2 additions & 0 deletions app/lib/l10n/arb/app_de.arb
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@
"lang": "Sprache",
"lastVisited": "Zuletzt besucht",
"leuZurichFAQ": "leu.zuerich FAQ",
"like":"Gefällt mir",
"list": "Kontoauswahl",
"loading": "Lädt...",
"localizedReason": "Authentifizierung notwendig um auf dein Konto zuzugreifen",
Expand All @@ -207,6 +208,7 @@
"meetupNotificationOneHourBeforeTitle": "1 Stunde übrig",
"menu": "Menu",
"mnemonic": "Mnemonik",
"moreInfo": "Mehr Infos:",
"newbieContent": "Du hast dich als Newbie ohne bisherige Reputation registriert. Es ist nicht garantiert, dass du in diesem Cycle zugewiesen wirst, falls es viele Newbies hat. Bitte überprüfe deinen Zuweisungsstatus am Tag vor dem Cycle, um zu erfahren, ob und wo deine Versammlung stattfinden wird.",
"newbieTitle": "Als Newbie Registriert - Dein Platz ist noch nicht sicher.",
"next": "Weiter",
Expand Down
2 changes: 2 additions & 0 deletions app/lib/l10n/arb/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@
"lang": "Language",
"lastVisited": "Last visited",
"leuZurichFAQ": "leu.zuerich FAQ",
"like":"Like",
"list": "Account Select",
"loading": "Loading...",
"localizedReason": "Authenticate to access your account.",
Expand All @@ -207,6 +208,7 @@
"meetupNotificationOneHourBeforeTitle": "1 hour left",
"menu": "Menu",
"mnemonic": "Mnemonic",
"moreInfo": "More Info:",
"newbieContent": "You registered as a newbie without previous reputation. We can't guarantee that you will be assigned to a gathering this cycle if there are many newbies. Please check your assignment status on the day before the cycle to learn if and where your gathering will take place.",
"newbieTitle": "Registered as newbie - your seat is not definite",
"next": "Next",
Expand Down
2 changes: 2 additions & 0 deletions app/lib/l10n/arb/app_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@
"lang": "Langue",
"lastVisited": "Dernière visite",
"leuZurichFAQ": "leu.zuerich FAQ",
"like": "J'aime",
"list": "Sélection de compte",
"loading": "Chargement…",
"localizedReason": "Authentification nécessaire pour accéder à ton compte",
Expand All @@ -207,6 +208,7 @@
"meetupNotificationOneHourBeforeTitle": "Encore 1 heure",
"menu": "Menu",
"mnemonic": "Mnémonique",
"moreInfo": "Plus d'informations:",
"newbieContent": "Tu t'es enregistré en tant que Novice Il n'est pas garanti que tu sois dans ce cycle Si le nombre de Novices est élevé, tu ne seras pas assigné. S'il te plaît, vérifie ton statut d'assignation le jour précédant le cycle pour savoir pour savoir si et où ta réunion aura lieu.",
"newbieTitle": "Enregistré comme Novice - Ta place n'est pas encore garantie",
"next": "Continuer",
Expand Down
2 changes: 2 additions & 0 deletions app/lib/l10n/arb/app_ru.arb
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@
"lang": "Язык",
"lastVisited": "Последнее посещение",
"leuZurichFAQ": "ЧЗВ leu.zuerich",
"like": "Нравится",
"list": "Выбрать аккаунт",
"loading": "Загружается...",
"localizedReason": "Аутентифицируйтесь для доступа к вашей учетной записи",
Expand All @@ -207,6 +208,7 @@
"meetupNotificationOneHourBeforeTitle": "Остался 1 час",
"menu": "Меню",
"mnemonic": "Мнемоническая фраза",
"moreInfo": "Дополнительная информация:",
"newbieContent": "Вы зарегистрировались в качестве новичка без репутации. Нет гарантии, что Вас назначат на этот цикл, если в нем будет участвовать большое количество новичков. Пожалуйста, проверьте статус вашего назначения за день до цикла чтобы узнать, состоится ли ваше собрание и где оно будет проходить.",
"newbieTitle": "Зарегистрирован в качестве Новичка - место не гарантировано.",
"next": "Следующий",
Expand Down
2 changes: 1 addition & 1 deletion app/lib/models/bazaar/businesses.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:encointer_wallet/page-encointer/new_bazaar/widgets/dropdown_widget.dart';
import 'package:encointer_wallet/page-encointer/new_bazaar/businesses/widgets/dropdown_widget.dart';
import 'package:flutter/material.dart';
import 'package:json_annotation/json_annotation.dart';

Expand Down
82 changes: 82 additions & 0 deletions app/lib/models/bazaar/single_business.dart
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
};
57 changes: 57 additions & 0 deletions app/lib/models/bazaar/single_business.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions app/lib/page-encointer/bazaar/0_main/bazaar_main.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import 'package:encointer_wallet/page-encointer/new_bazaar/businesses/logic/businesses_store.dart';
import 'package:encointer_wallet/page-encointer/new_bazaar/businesses/view/businesses_view.dart';
import 'package:encointer_wallet/page-encointer/new_bazaar/businesses/widgets/dropdown_widget.dart';
import 'package:encointer_wallet/theme/custom/extension/theme_extension.dart';
import 'package:encointer_wallet/page-encointer/new_bazaar/logic/businesses_store.dart';
import 'package:encointer_wallet/page-encointer/new_bazaar/view/businesses_view.dart';
import 'package:encointer_wallet/page-encointer/new_bazaar/widgets/dropdown_widget.dart';
import 'package:encointer_wallet/l10n/l10.dart';

class BazaarPage extends StatelessWidget {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:mobx/mobx.dart';

import 'package:encointer_wallet/page-encointer/new_bazaar/widgets/dropdown_widget.dart';
import 'package:encointer_wallet/page-encointer/new_bazaar/businesses/widgets/dropdown_widget.dart';
import 'package:encointer_wallet/utils/fetch_status.dart';
import 'package:encointer_wallet/models/bazaar/businesses.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:provider/provider.dart';

import 'package:encointer_wallet/common/components/error/error_view.dart';
import 'package:encointer_wallet/common/components/loading/centered_activity_indicator.dart';
import 'package:encointer_wallet/page-encointer/new_bazaar/widgets/empty_businesses.dart';
import 'package:encointer_wallet/page-encointer/new_bazaar/businesses/widgets/empty_businesses.dart';
import 'package:encointer_wallet/models/bazaar/businesses.dart';
import 'package:encointer_wallet/page-encointer/new_bazaar/logic/businesses_store.dart';
import 'package:encointer_wallet/page-encointer/new_bazaar/widgets/businesses_card.dart';
import 'package:encointer_wallet/page-encointer/new_bazaar/businesses/logic/businesses_store.dart';
import 'package:encointer_wallet/page-encointer/new_bazaar/businesses/widgets/businesses_card.dart';
import 'package:encointer_wallet/utils/fetch_status.dart';

class BusinessesView extends StatelessWidget {
Expand Down
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),
],
),
),
),
],
),
),
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:json_annotation/json_annotation.dart';
import 'package:provider/provider.dart';

import 'package:encointer_wallet/theme/custom/colors/app_colors.dart';
import 'package:encointer_wallet/page-encointer/new_bazaar/logic/businesses_store.dart';
import 'package:encointer_wallet/page-encointer/new_bazaar/businesses/logic/businesses_store.dart';

class DropdownWidget extends StatefulWidget {
const DropdownWidget({super.key});
Expand Down
Loading

0 comments on commit 86f4cdb

Please sign in to comment.