forked from zachran-jidlo/zachranobed
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Init firebase functions * Introduce custom claims to set user as donor or recipient * Customize the application from the recipient's perspective * Add recipient object to donor and vice versa * Fix bug with multiple home screens on stack after logout and then login. * Minor changes and refactoring * Introduce abstract class from donor and recipient classes inherit. * Delete forgotten debug print * Introduce notifications * Send the notification only if the delivery is for today * Change app icon to ZO logo * Change app name * Rename donors collection * Rename recipients collection * Rename deliveries collection * Rename offeredFood collection * Save dates in timestamp representation * Delete forgotten dead code * Delete forgotten dead code * Refactoring - rename donor to canteen and recipient to charity * Rework offer_food_form according the figma * Refactoring - rename packaging to boxType * Refactoring - fix typo in password_text_field file name * Refactoring - rename enums to snake case * Adjust donated food detail screen according to the figma * Remove button to create a new offer from the thank you screen * Remove currently unnecessary menu sections * Introduce possibility to change a password --------- Co-authored-by: Jakub Timko <[email protected]>
- Loading branch information
Showing
29 changed files
with
1,048 additions
and
353 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:zachranobed/extensions/build_context_extensions.dart'; | ||
|
||
enum BoxType { | ||
reusableBox, | ||
ikeaBox, | ||
disposablePackaging, | ||
} | ||
|
||
abstract class BoxTypeHelper { | ||
static String toValue(BoxType boxType, BuildContext context) { | ||
switch (boxType) { | ||
case BoxType.reusableBox: | ||
return context.l10n!.boxTypeReKrabicka; | ||
case BoxType.ikeaBox: | ||
return context.l10n!.boxTypeIkeaBox; | ||
case BoxType.disposablePackaging: | ||
return context.l10n!.packagingDisposable; | ||
default: | ||
return ''; | ||
} | ||
} | ||
} |
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,20 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:zachranobed/extensions/build_context_extensions.dart'; | ||
|
||
enum FoodCategory { | ||
warm, | ||
cooled, | ||
} | ||
|
||
abstract class FoodCategoryHelper { | ||
static String toValue(FoodCategory foodCategory, BuildContext context) { | ||
switch (foodCategory) { | ||
case FoodCategory.warm: | ||
return context.l10n!.foodCategoryWarm; | ||
case FoodCategory.cooled: | ||
return context.l10n!.foodCategoryCooled; | ||
default: | ||
return ''; | ||
} | ||
} | ||
} |
This file was deleted.
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,32 @@ | ||
import 'package:cloud_firestore/cloud_firestore.dart'; | ||
import 'package:json_annotation/json_annotation.dart'; | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
import 'package:zachranobed/converters/timestamp_converter.dart'; | ||
import 'package:zachranobed/models/food_info.dart'; | ||
|
||
/* | ||
* Command to rebuild the offered_food.g.dart file: | ||
* flutter packages pub run build_runner build --delete-conflicting-outputs | ||
*/ | ||
part 'offered_food.freezed.dart'; | ||
part 'offered_food.g.dart'; | ||
|
||
@JsonSerializable(explicitToJson: true) | ||
class OfferedFood { | ||
final String id; | ||
@TimestampConverter() | ||
final DateTime date; | ||
final int dateTimestamp; | ||
final FoodInfo foodInfo; | ||
final String packaging; | ||
@TimestampConverter() | ||
final DateTime consumeBy; | ||
final int consumeByTimestamp; | ||
final String weekNumber; | ||
final String donorId; | ||
final String recipientId; | ||
|
||
OfferedFood({ | ||
required this.id, | ||
required this.date, | ||
required this.dateTimestamp, | ||
required this.foodInfo, | ||
required this.packaging, | ||
required this.consumeBy, | ||
required this.consumeByTimestamp, | ||
required this.weekNumber, | ||
required this.donorId, | ||
required this.recipientId, | ||
}); | ||
@Freezed() | ||
class OfferedFood with _$OfferedFood { | ||
const factory OfferedFood({ | ||
String? id, | ||
@TimestampConverter() DateTime? date, | ||
int? dateTimestamp, | ||
String? dishName, | ||
String? foodCategory, | ||
List<String>? allergens, | ||
int? numberOfServings, | ||
String? boxType, | ||
@TimestampConverter() DateTime? consumeBy, | ||
int? consumeByTimestamp, | ||
String? weekNumber, | ||
String? donorId, | ||
String? recipientId, | ||
}) = _OfferedFood; | ||
|
||
factory OfferedFood.fromJson(Map<String, dynamic> json) => | ||
_$OfferedFoodFromJson(json); | ||
|
||
Map<String, dynamic> toJson() => _$OfferedFoodToJson(this); | ||
} |
Oops, something went wrong.