Skip to content

Commit

Permalink
Merge branch 'develop' into feature/terms-and-conditions-optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
bdmendes authored Dec 9, 2023
2 parents 1052804 + 273ef29 commit 64d6b7e
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 11 deletions.
2 changes: 1 addition & 1 deletion uni/app_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.7.20+210
1.7.21+211
2 changes: 2 additions & 0 deletions uni/lib/generated/intl/messages_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ class MessageLookup extends MessageLookupByLibrary {
"Reference created successfully!"),
"remove": MessageLookupByLibrary.simpleMessage("Delete"),
"report_error": MessageLookupByLibrary.simpleMessage("Report error"),
"restaurant_main_page": MessageLookupByLibrary.simpleMessage(
"Do you want to see your favorite restaurants in the main page?"),
"room": MessageLookupByLibrary.simpleMessage("Room"),
"school_calendar":
MessageLookupByLibrary.simpleMessage("School Calendar"),
Expand Down
2 changes: 2 additions & 0 deletions uni/lib/generated/intl/messages_pt_PT.dart
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ class MessageLookup extends MessageLookupByLibrary {
"Referência criada com sucesso!"),
"remove": MessageLookupByLibrary.simpleMessage("Remover"),
"report_error": MessageLookupByLibrary.simpleMessage("Reportar erro"),
"restaurant_main_page": MessageLookupByLibrary.simpleMessage(
"Queres ver os teus restaurantes favoritos na página principal?"),
"room": MessageLookupByLibrary.simpleMessage("Sala"),
"school_calendar":
MessageLookupByLibrary.simpleMessage("Calendário Escolar"),
Expand Down
10 changes: 10 additions & 0 deletions uni/lib/generated/l10n.dart

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

2 changes: 2 additions & 0 deletions uni/lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@
"@remove": {},
"report_error": "Report error",
"@report_error": {},
"restaurant_main_page" : "Do you want to see your favorite restaurants in the main page?",
"@restaurant_main_page": {},
"room": "Room",
"@room": {},
"school_calendar": "School Calendar",
Expand Down
2 changes: 2 additions & 0 deletions uni/lib/l10n/intl_pt_PT.arb
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@
"@remove": {},
"report_error": "Reportar erro",
"@report_error": {},
"restaurant_main_page" : "Queres ver os teus restaurantes favoritos na página principal?",
"@restaurant_main_page": {},
"room": "Sala",
"@room": {},
"school_calendar": "Calendário Escolar",
Expand Down
52 changes: 49 additions & 3 deletions uni/lib/view/restaurant/widgets/restaurant_page_card.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import 'package:flutter/material.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
import 'package:provider/provider.dart';
import 'package:uni/generated/l10n.dart';
import 'package:uni/model/entities/restaurant.dart';
import 'package:uni/model/providers/lazy/home_page_provider.dart';
import 'package:uni/model/providers/lazy/restaurant_provider.dart';
import 'package:uni/utils/favorite_widget_type.dart';
import 'package:uni/view/common_widgets/generic_card.dart';
import 'package:uni/view/lazy_consumer.dart';

Expand Down Expand Up @@ -45,11 +49,53 @@ class CardFavoriteButton extends StatelessWidget {
restaurantProvider.favoriteRestaurants.contains(restaurant.name);
return IconButton(
icon: isFavorite ? Icon(MdiIcons.heart) : Icon(MdiIcons.heartOutline),
onPressed: () => restaurantProvider.toggleFavoriteRestaurant(
restaurant.name,
),
onPressed: () {
restaurantProvider.toggleFavoriteRestaurant(
restaurant.name,
);
final favoriteCardTypes =
context.read<HomePageProvider>().favoriteCards;
if (!isFavorite &&
!favoriteCardTypes.contains(FavoriteWidgetType.restaurant)) {
showRestaurantCardHomeDialog(context, favoriteCardTypes,
(newFavoriteCards) {
Provider.of<HomePageProvider>(context, listen: false)
.setFavoriteCards(newFavoriteCards);
});
}
},
);
},
);
}

void showRestaurantCardHomeDialog(
BuildContext context,
List<FavoriteWidgetType> favoriteCardTypes,
void Function(List<FavoriteWidgetType>) updateHomePage,
) {
showDialog<void>(
context: context,
builder: (context) => AlertDialog(
title: Text(S.of(context).restaurant_main_page),
actions: <Widget>[
ElevatedButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text(S.of(context).no),
),
ElevatedButton(
onPressed: () {
updateHomePage(
favoriteCardTypes + [FavoriteWidgetType.restaurant],
);
Navigator.of(context).pop();
},
child: Text(S.of(context).yes),
),
],
),
);
}
}
8 changes: 4 additions & 4 deletions uni/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,10 @@ packages:
dependency: "direct main"
description:
name: connectivity_plus
sha256: "94d51c6f1299133a2baa4c5c3d2c11ec7d7fb4768dee5c52a56f7d7522fcf70e"
sha256: "224a77051d52a11fbad53dd57827594d3bd24f945af28bd70bab376d68d437f0"
url: "https://pub.dev"
source: hosted
version: "5.0.0"
version: "5.0.2"
connectivity_plus_platform_interface:
dependency: transitive
description:
Expand Down Expand Up @@ -449,10 +449,10 @@ packages:
dependency: "direct main"
description:
name: flutter_widget_from_html_core
sha256: a7dc9eb4bfdef4ea06d114528bf52a7efcdfc6ba46d933957c25067f17c1c6b4
sha256: "86d40a9f26d10011664df057c950e9c348ee1a7dbf141f295a07b0075ffd780b"
url: "https://pub.dev"
source: hosted
version: "0.10.5"
version: "0.14.9"
frontend_server_client:
dependency: transitive
description:
Expand Down
6 changes: 3 additions & 3 deletions uni/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev
# To change it manually, override the value in app_version.txt.
# The app version code is automatically also bumped by CI.
# Do not change it manually.
version: 1.7.20+210
version: 1.7.21+211

environment:
sdk: ">=3.0.0 <4.0.0"
Expand All @@ -17,7 +17,7 @@ dependencies:
add_2_calendar: ^2.2.5
cached_network_image: ^3.2.3
collection: ^1.16.0
connectivity_plus: ^5.0.0
connectivity_plus: ^5.0.2
crypto: ^3.0.1
cupertino_icons: ^1.0.2
currency_text_input_formatter: ^2.1.5
Expand All @@ -34,7 +34,7 @@ dependencies:
flutter_map_marker_popup: ^5.0.0
flutter_markdown: ^0.6.0
flutter_svg: ^2.0.0+1
flutter_widget_from_html_core: ^0.10.3
flutter_widget_from_html_core: ^0.14.9
html: ^0.15.0
http: ^1.1.0
image: ^4.0.13
Expand Down

0 comments on commit 64d6b7e

Please sign in to comment.