From cf9b0b0256c06b59a639a8f916464963ee81363d Mon Sep 17 00:00:00 2001 From: Mathias Mogensencd collaction_website Date: Sat, 4 Mar 2023 19:48:24 +0100 Subject: [PATCH 1/8] fix: add manual logging to auth repo --- .../auth/firebase_auth_repository.dart | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/infrastructure/auth/firebase_auth_repository.dart b/lib/infrastructure/auth/firebase_auth_repository.dart index 0ec66fc7..42283e39 100644 --- a/lib/infrastructure/auth/firebase_auth_repository.dart +++ b/lib/infrastructure/auth/firebase_auth_repository.dart @@ -54,6 +54,13 @@ class FirebaseAuthRepository implements IAuthRepository, Disposable { result.add(right(AuthSuccess.codeSent(credential: credential))); }, verificationFailed: (firebase_auth.FirebaseAuthException error) { + FirebaseCrashlyticsLogger.warn( + error, + null, + message: + '[FirebaseAuthRepository] verifyPhoneNumber().verificationFailed', + ); + result.add(left(error.toFailure())); result.close(); }, @@ -166,6 +173,12 @@ class FirebaseAuthRepository implements IAuthRepository, Disposable { result.add(right(AuthSuccess.codeSent(credential: credential))); }, verificationFailed: (firebase_auth.FirebaseAuthException error) { + FirebaseCrashlyticsLogger.warn( + error, + null, + message: '[FirebaseAuthRepository] resendOTP().verificationFailed', + ); + result.add(left(error.toFailure())); result.close(); }, From 023d67eaef5b6040395cf03006731ed01cc28727 Mon Sep 17 00:00:00 2001 From: Mathias Mogensencd collaction_website Date: Sun, 5 Mar 2023 00:15:16 +0100 Subject: [PATCH 2/8] chore: upgrade gradle build tools and dependencies --- android/build.gradle | 6 +++--- android/gradle/wrapper/gradle-wrapper.properties | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 2a330ec6..6b74e344 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -6,10 +6,10 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:4.2.0' + classpath 'com.android.tools.build:gradle:7.2.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath 'com.google.gms:google-services:4.3.10' - classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1' + classpath 'com.google.gms:google-services:4.3.15' + classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.4' } } diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 939efa29..cb24abda 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Fri Jun 23 08:50:38 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip From ede0ca6fed68afd2dac6de8c9e9a0d31186eec75 Mon Sep 17 00:00:00 2001 From: Isaac Obella Date: Mon, 6 Mar 2023 08:20:25 +0300 Subject: [PATCH 3/8] core(domain): Migrate freezed to equatable orr plain classes --- lib/domain/auth/auth_failures.dart | 27 +- lib/domain/auth/auth_success.dart | 24 +- lib/domain/commitment/commitment.dart | 74 +- lib/domain/contact_form/contact_failures.dart | 15 +- lib/domain/core/page_info.dart | 61 +- lib/domain/core/value_failures.dart | 36 +- lib/domain/crowdaction/crowdaction.dart | 219 ++- .../crowdaction/crowdaction_comment.dart | 123 +- .../crowdaction/crowdaction_failures.dart | 15 +- lib/domain/crowdaction/models/commitment.dart | 74 + lib/domain/crowdaction/models/images.dart | 38 + lib/domain/crowdaction/models/location.dart | 38 + lib/domain/crowdaction/models/statuses.dart | 64 + .../crowdaction/paginated_crowdactions.dart | 46 +- .../paginated_participations.dart | 47 +- lib/domain/participation/participation.dart | 101 +- .../participation/participation_failures.dart | 19 +- lib/domain/profile/profile.dart | 70 +- lib/domain/profile/user_profile.dart | 45 +- lib/domain/settings/build_information.dart | 53 +- lib/domain/user/profile_failure.dart | 15 +- lib/domain/user/upload_failures.dart | 20 +- lib/domain/user/user.dart | 45 +- models/commitment.model.json | 27 + models/crowdaction/commitment.json | 31 + models/crowdaction/crowdaction.json | 78 + models/crowdaction/images.json | 15 + models/crowdaction/location.json | 15 + models/crowdaction_comment.json | 43 + models/page_info.model.json | 27 + models/paginated_crowdaction.json | 23 + .../participation/paginated_participants.json | 23 + models/participation/participation.json | 39 + models/profile/profile.json | 27 + models/profile/user_profile.json | 23 + models/settings/build_information.json | 23 + pubspec.lock | 1554 ----------------- 37 files changed, 1424 insertions(+), 1793 deletions(-) create mode 100644 lib/domain/crowdaction/models/commitment.dart create mode 100644 lib/domain/crowdaction/models/images.dart create mode 100644 lib/domain/crowdaction/models/location.dart create mode 100644 lib/domain/crowdaction/models/statuses.dart create mode 100644 models/commitment.model.json create mode 100644 models/crowdaction/commitment.json create mode 100644 models/crowdaction/crowdaction.json create mode 100644 models/crowdaction/images.json create mode 100644 models/crowdaction/location.json create mode 100644 models/crowdaction_comment.json create mode 100644 models/page_info.model.json create mode 100644 models/paginated_crowdaction.json create mode 100644 models/participation/paginated_participants.json create mode 100644 models/participation/participation.json create mode 100644 models/profile/profile.json create mode 100644 models/profile/user_profile.json create mode 100644 models/settings/build_information.json delete mode 100644 pubspec.lock diff --git a/lib/domain/auth/auth_failures.dart b/lib/domain/auth/auth_failures.dart index 1f82c597..52a71a64 100644 --- a/lib/domain/auth/auth_failures.dart +++ b/lib/domain/auth/auth_failures.dart @@ -1,9 +1,6 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +abstract class AuthFailure { + const AuthFailure(); -part 'auth_failures.freezed.dart'; - -@freezed -class AuthFailure with _$AuthFailure { const factory AuthFailure.serverError() = ServerError; const factory AuthFailure.networkRequestFailed() = NetworkRequestFailed; @@ -14,3 +11,23 @@ class AuthFailure with _$AuthFailure { const factory AuthFailure.verificationFailed() = VerificationFailed; } + +class ServerError extends AuthFailure { + const ServerError(); +} + +class NetworkRequestFailed extends AuthFailure { + const NetworkRequestFailed(); +} + +class InvalidPhone extends AuthFailure { + const InvalidPhone(); +} + +class InvalidSmsCode extends AuthFailure { + const InvalidSmsCode(); +} + +class VerificationFailed extends AuthFailure { + const VerificationFailed(); +} diff --git a/lib/domain/auth/auth_success.dart b/lib/domain/auth/auth_success.dart index e71a2cc8..1209b9f0 100644 --- a/lib/domain/auth/auth_success.dart +++ b/lib/domain/auth/auth_success.dart @@ -1,11 +1,12 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; import '../user/i_user_repository.dart'; -part 'auth_success.freezed.dart'; +abstract class AuthSuccess extends Equatable { + final Credential credential; + + const AuthSuccess({required this.credential}); -@freezed -class AuthSuccess with _$AuthSuccess { const factory AuthSuccess.codeSent({required Credential credential}) = _SmsCodeSent; @@ -16,4 +17,19 @@ class AuthSuccess with _$AuthSuccess { const factory AuthSuccess.verificationCompleted({ required Credential credential, }) = _VerificationCompleted; + + @override + List get props => [credential]; +} + +class _SmsCodeSent extends AuthSuccess { + const _SmsCodeSent({required super.credential}); +} + +class _CodeRetrievalTimedOut extends AuthSuccess { + const _CodeRetrievalTimedOut({required super.credential}); +} + +class _VerificationCompleted extends AuthSuccess { + const _VerificationCompleted({required super.credential}); } diff --git a/lib/domain/commitment/commitment.dart b/lib/domain/commitment/commitment.dart index 53f665e1..69874778 100644 --- a/lib/domain/commitment/commitment.dart +++ b/lib/domain/commitment/commitment.dart @@ -1,14 +1,62 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; - -part 'commitment.freezed.dart'; - -@freezed -class Commitment with _$Commitment { - const factory Commitment({ - required int id, - required String title, - String? description, - @Default(false) bool checked, - String? icon, - }) = _Commitment; +import 'package:equatable/equatable.dart'; + +class Commitment extends Equatable { + const Commitment({ + required this.id, + required this.title, + this.description, + required this.checked, + this.icon, + }); + + factory Commitment.fromJson(Map json) => Commitment( + id: json['id'] as int, + title: json['title'] as String, + description: json['description'] as String?, + checked: json['checked'] as bool, + icon: json['icon'] as String?, + ); + + final int id; + + final String title; + + final String? description; + + final bool checked; + + final String? icon; + + Commitment copyWith({ + int? id, + String? title, + String? Function()? description, + bool? checked, + String? Function()? icon, + }) { + return Commitment( + id: id ?? this.id, + title: title ?? this.title, + description: description != null ? description() : this.description, + checked: checked ?? this.checked, + icon: icon != null ? icon() : this.icon, + ); + } + + @override + List get props => [ + id, + title, + description, + checked, + icon, + ]; + + Map toJson() => { + 'id': id, + 'title': title, + 'description': description, + 'checked': checked, + 'icon': icon, + }; } diff --git a/lib/domain/contact_form/contact_failures.dart b/lib/domain/contact_form/contact_failures.dart index 97c5b9e5..0b2ea199 100644 --- a/lib/domain/contact_form/contact_failures.dart +++ b/lib/domain/contact_form/contact_failures.dart @@ -1,9 +1,14 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +abstract class ContactFailure { + const ContactFailure(); -part 'contact_failures.freezed.dart'; - -@freezed -class ContactFailure with _$ContactFailure { const factory ContactFailure.serverError() = ServerError; const factory ContactFailure.unexpectedError() = UnexpectedError; } + +class ServerError extends ContactFailure { + const ServerError(); +} + +class UnexpectedError extends ContactFailure { + const UnexpectedError(); +} diff --git a/lib/domain/core/page_info.dart b/lib/domain/core/page_info.dart index f5dd705d..c1e74e5f 100644 --- a/lib/domain/core/page_info.dart +++ b/lib/domain/core/page_info.dart @@ -1,15 +1,54 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; -part 'page_info.freezed.dart'; +class PageInfo extends Equatable { + const PageInfo({ + required this.page, + required this.pageSize, + required this.totalPages, + required this.totalItems, + }); -@freezed -class PageInfo with _$PageInfo { - const PageInfo._(); + factory PageInfo.fromJson(Map json) => PageInfo( + page: json['page'] as int, + pageSize: json['pageSize'] as int, + totalPages: json['totalPages'] as int, + totalItems: json['totalItems'] as int, + ); - const factory PageInfo({ - required int page, - required int pageSize, - required int totalPages, - required int totalItems, - }) = _PageInfo; + final int page; + + final int pageSize; + + final int totalPages; + + final int totalItems; + + PageInfo copyWith({ + int? page, + int? pageSize, + int? totalPages, + int? totalItems, + }) { + return PageInfo( + page: page ?? this.page, + pageSize: pageSize ?? this.pageSize, + totalPages: totalPages ?? this.totalPages, + totalItems: totalItems ?? this.totalItems, + ); + } + + @override + List get props => [ + page, + pageSize, + totalPages, + totalItems, + ]; + + Map toJson() => { + 'page': page, + 'pageSize': pageSize, + 'totalPages': totalPages, + 'totalItems': totalItems, + }; } diff --git a/lib/domain/core/value_failures.dart b/lib/domain/core/value_failures.dart index 1b587398..aabd6ec8 100644 --- a/lib/domain/core/value_failures.dart +++ b/lib/domain/core/value_failures.dart @@ -1,9 +1,10 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; -part 'value_failures.freezed.dart'; +class ValueFailure extends Equatable { + final T failedValue; + + const ValueFailure({required this.failedValue}); -@freezed -class ValueFailure with _$ValueFailure { const factory ValueFailure.invalidPhone({ required T failedValue, }) = InvalidPhone; @@ -27,4 +28,31 @@ class ValueFailure with _$ValueFailure { const factory ValueFailure.notStartWithLetter({ required T failedValue, }) = NotStartWithLetter; + + @override + List get props => [failedValue]; +} + +class InvalidPhone extends ValueFailure { + const InvalidPhone({required super.failedValue}); +} + +class InvalidEmail extends ValueFailure { + const InvalidEmail({required super.failedValue}); +} + +class Empty extends ValueFailure { + const Empty({required super.failedValue}); +} + +class ShortUsername extends ValueFailure { + const ShortUsername({required super.failedValue}); +} + +class LongUsername extends ValueFailure { + const LongUsername({required super.failedValue}); +} + +class NotStartWithLetter extends ValueFailure { + const NotStartWithLetter({required super.failedValue}); } diff --git a/lib/domain/crowdaction/crowdaction.dart b/lib/domain/crowdaction/crowdaction.dart index bb75439c..e89df1b0 100644 --- a/lib/domain/crowdaction/crowdaction.dart +++ b/lib/domain/crowdaction/crowdaction.dart @@ -1,32 +1,157 @@ +import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; import '../../core/core.dart'; import '../../presentation/core/collaction_icons.dart'; import '../../presentation/core/ionicons_utils.dart'; import '../../presentation/shared_widgets/secondary_chip.dart'; -part 'crowdaction.freezed.dart'; - -@freezed -class CrowdAction with _$CrowdAction { - const CrowdAction._(); - - const factory CrowdAction({ - required String id, - required String title, - required String description, - required String category, - required Location location, - required List commitments, - required Images images, - required int participantCount, - required Status status, - required JoinStatus joinStatus, - required DateTime endAt, - String? password, - String? subcategory, - }) = _CrowdAction; +part 'models/commitment.dart'; +part 'models/images.dart'; +part 'models/location.dart'; +part 'models/statuses.dart'; + +class CrowdAction extends Equatable { + const CrowdAction({ + required this.id, + required this.title, + required this.description, + required this.category, + this.subcategory, + required this.location, + required this.slug, + this.password, + required this.participantCount, + required this.images, + required this.commitments, + required this.status, + required this.joinStatus, + required this.startAt, + required this.endAt, + }); + + factory CrowdAction.fromJson(Map json) => CrowdAction( + id: json['id'] as String, + title: json['title'] as String, + description: json['description'] as String, + category: json['category'] as String, + subcategory: json['subcategory'] as String?, + location: Location.fromJson(json['location'] as Map), + slug: json['slug'] as String, + password: json['password'] as String?, + participantCount: json['participantCount'] as int, + images: Images.fromJson(json['images'] as Map), + commitments: (json['commitments'] as List) + .map((dynamic e) => Commitment.fromJson(e as Map)) + .toList(), + status: (json['status'] as String).fromStatusJson, + joinStatus: (json['joinStatus'] as String).fromJoinStatusJson, + startAt: json['startAt'] as DateTime, + endAt: json['endAt'] as DateTime, + ); + + final String id; + + final String title; + + final String description; + + final String category; + + final String? subcategory; + + final Location location; + + final String slug; + + final String? password; + + final int participantCount; + + final Images images; + + final List commitments; + + final Status status; + + final JoinStatus joinStatus; + + final DateTime startAt; + + final DateTime endAt; + + CrowdAction copyWith({ + String? id, + String? title, + String? description, + String? category, + String? Function()? subcategory, + Location? location, + String? slug, + String? Function()? password, + int? participantCount, + Images? images, + List? commitments, + Status? status, + JoinStatus? joinStatus, + DateTime? startAt, + DateTime? endAt, + }) { + return CrowdAction( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + category: category ?? this.category, + subcategory: subcategory != null ? subcategory() : this.subcategory, + location: location ?? this.location, + slug: slug ?? this.slug, + password: password != null ? password() : this.password, + participantCount: participantCount ?? this.participantCount, + images: images ?? this.images, + commitments: commitments ?? this.commitments, + status: status ?? this.status, + joinStatus: joinStatus ?? this.joinStatus, + startAt: startAt ?? this.startAt, + endAt: endAt ?? this.endAt, + ); + } + + @override + List get props => [ + id, + title, + description, + category, + subcategory, + location, + slug, + password, + participantCount, + images, + commitments, + status, + joinStatus, + startAt, + endAt, + ]; + + Map toJson() => { + 'id': id, + 'title': title, + 'description': description, + 'category': category, + 'subcategory': subcategory, + 'location': location.toJson(), + 'slug': slug, + 'password': password, + 'participantCount': participantCount, + 'images': images.toJson(), + 'commitments': commitments.map((e) => e.toJson()), + 'status': status.toJson, + 'joinStatus': joinStatus.toJson, + 'startAt': startAt, + 'endAt': endAt, + }; bool get hasParticipants => participantCount > 0; @@ -58,53 +183,3 @@ class CrowdAction with _$CrowdAction { // Crowdaction card url String get cardUrl => '$baseStaticUrl/${images.card}'; } - -@freezed -class Images with _$Images { - const factory Images({ - required String card, - required String banner, - }) = _Images; -} - -@freezed -class Location with _$Location { - const factory Location({ - required String code, - required String name, - }) = _Location; -} - -enum Status { - @JsonValue('STARTED') - started, - @JsonValue('WAITING') - waiting, - @JsonValue('ENDED') - ended, -} - -enum JoinStatus { - @JsonValue('OPEN') - open, - @JsonValue('CLOSED') - closed, -} - -@freezed -class Commitment with _$Commitment { - const Commitment._(); - - factory Commitment({ - required String id, - required String label, - required int points, - required List blocks, - String? description, - String? iconId, - }) = _Commitment; - - IconData get icon => iconId != null - ? IconUtil.fromString(iconId!) - : CollactionIcons.collaction; -} diff --git a/lib/domain/crowdaction/crowdaction_comment.dart b/lib/domain/crowdaction/crowdaction_comment.dart index 8c03bf49..8fbff979 100644 --- a/lib/domain/crowdaction/crowdaction_comment.dart +++ b/lib/domain/crowdaction/crowdaction_comment.dart @@ -1,20 +1,105 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; - -part 'crowdaction_comment.freezed.dart'; - -@freezed -class CrowdactionComment with _$CrowdactionComment { - const CrowdactionComment._(); - - const factory CrowdactionComment({ - required String crowdactionId, - required String content, - required String userId, - required DateTime createdAt, - List? comments, - required int likes, - required bool likedByMe, - bool? flagged, - List? flags, - }) = _CrowdactionComment; +import 'package:equatable/equatable.dart'; + +class CrowdactionComment extends Equatable { + + const CrowdactionComment({ + required this.crowdactionId, + required this.content, + required this.userId, + required this.createdAt, + this.comments, + required this.likes, + required this.likedByMe, + this.flagged, + this.flags, + }); + + factory CrowdactionComment.fromJson(Map json) => CrowdactionComment( + crowdactionId: json['crowdactionId'] as String, + content: json['content'] as String, + userId: json['userId'] as String, + createdAt: DateTime.tryParse(json['createdAt'] as String? ?? '')!, + comments: json['comments'] as List?, + likes: json['likes'] as int, + likedByMe: json['likedByMe'] as bool, + flagged: json['flagged'] as bool?, + flags: json['flags'] as List?, + ); + + /// A description for crowdactionId + final String crowdactionId; + + /// A description for content + final String content; + + /// A description for userId + final String userId; + + /// A description for createdAt + final DateTime createdAt; + + /// A description for comments + final List? comments; + + /// A description for likes + final int likes; + + /// A description for likedByMe + final bool likedByMe; + + /// A description for flagged + final bool? flagged; + + /// A description for flags + final List? flags; + + CrowdactionComment copyWith({ + String? crowdactionId, + String? content, + String? userId, + DateTime? createdAt, + List? Function()? comments, + int? likes, + bool? likedByMe, + bool? Function()? flagged, + List? Function()? flags, + }) { + return CrowdactionComment( + crowdactionId: crowdactionId ?? this.crowdactionId, + content: content ?? this.content, + userId: userId ?? this.userId, + createdAt: createdAt ?? this.createdAt, + comments: comments != null ? comments() : this.comments, + likes: likes ?? this.likes, + likedByMe: likedByMe ?? this.likedByMe, + flagged: flagged != null ? flagged() : this.flagged, + flags: flags != null ? flags() : this.flags, + ); + } + + + @override + List get props => [ + crowdactionId, + content, + userId, + createdAt, + comments, + likes, + likedByMe, + flagged, + flags, + ]; + + Map toJson() => { + 'crowdactionId': crowdactionId, + 'content': content, + 'userId': userId, + 'createdAt': createdAt, + 'comments': comments, + 'likes': likes, + 'likedByMe': likedByMe, + 'flagged': flagged, + 'flags': flags, + }; } diff --git a/lib/domain/crowdaction/crowdaction_failures.dart b/lib/domain/crowdaction/crowdaction_failures.dart index 4bcc5795..27399c16 100644 --- a/lib/domain/crowdaction/crowdaction_failures.dart +++ b/lib/domain/crowdaction/crowdaction_failures.dart @@ -1,11 +1,16 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +abstract class CrowdActionFailure { + const CrowdActionFailure(); -part 'crowdaction_failures.freezed.dart'; - -@freezed -class CrowdActionFailure with _$CrowdActionFailure { const factory CrowdActionFailure.serverError() = ServerError; const factory CrowdActionFailure.networkRequestFailed() = NetworkRequestFailed; } + +class ServerError extends CrowdActionFailure { + const ServerError(); +} + +class NetworkRequestFailed extends CrowdActionFailure { + const NetworkRequestFailed(); +} diff --git a/lib/domain/crowdaction/models/commitment.dart b/lib/domain/crowdaction/models/commitment.dart new file mode 100644 index 00000000..518e0ce3 --- /dev/null +++ b/lib/domain/crowdaction/models/commitment.dart @@ -0,0 +1,74 @@ +part of '../crowdaction.dart'; + +class Commitment extends Equatable { + const Commitment({ + required this.label, + this.description, + required this.points, + required this.blocks, + required this.id, + this.iconId, + }); + + factory Commitment.fromJson(Map json) => Commitment( + label: json['label'] as String, + description: json['description'] as String?, + points: json['points'] as int, + blocks: json['blocks'] as List, + id: json['id'] as String, + iconId: json['iconId'] as String?, + ); + + final String label; + + final String? description; + + final int points; + + final List blocks; + + final String id; + + final String? iconId; + + Commitment copyWith({ + String? label, + String? Function()? description, + int? points, + List? blocks, + String? id, + String? Function()? iconId, + }) { + return Commitment( + label: label ?? this.label, + description: description != null ? description() : this.description, + points: points ?? this.points, + blocks: blocks ?? this.blocks, + id: id ?? this.id, + iconId: iconId != null ? iconId() : this.iconId, + ); + } + + @override + List get props => [ + label, + description, + points, + blocks, + id, + iconId, + ]; + + Map toJson() => { + 'label': label, + 'description': description, + 'points': points, + 'blocks': blocks, + 'id': id, + 'iconId': iconId, + }; + + IconData get icon => iconId != null + ? IconUtil.fromString(iconId!) + : CollactionIcons.collaction; +} diff --git a/lib/domain/crowdaction/models/images.dart b/lib/domain/crowdaction/models/images.dart new file mode 100644 index 00000000..b4b83e5b --- /dev/null +++ b/lib/domain/crowdaction/models/images.dart @@ -0,0 +1,38 @@ +part of '../crowdaction.dart'; + +class Images extends Equatable { + const Images({ + required this.card, + required this.banner, + }); + + factory Images.fromJson(Map json) => Images( + card: json['card'] as String, + banner: json['banner'] as String, + ); + + final String card; + + final String banner; + + Images copyWith({ + String? card, + String? banner, + }) { + return Images( + card: card ?? this.card, + banner: banner ?? this.banner, + ); + } + + @override + List get props => [ + card, + banner, + ]; + + Map toJson() => { + 'card': card, + 'banner': banner, + }; +} diff --git a/lib/domain/crowdaction/models/location.dart b/lib/domain/crowdaction/models/location.dart new file mode 100644 index 00000000..b561469f --- /dev/null +++ b/lib/domain/crowdaction/models/location.dart @@ -0,0 +1,38 @@ +part of '../crowdaction.dart'; + +class Location extends Equatable { + const Location({ + required this.code, + required this.name, + }); + + factory Location.fromJson(Map json) => Location( + code: json['code'] as String, + name: json['name'] as String, + ); + + final String code; + + final String name; + + Location copyWith({ + String? code, + String? name, + }) { + return Location( + code: code ?? this.code, + name: name ?? this.name, + ); + } + + @override + List get props => [ + code, + name, + ]; + + Map toJson() => { + 'code': code, + 'name': name, + }; +} diff --git a/lib/domain/crowdaction/models/statuses.dart b/lib/domain/crowdaction/models/statuses.dart new file mode 100644 index 00000000..aca635bd --- /dev/null +++ b/lib/domain/crowdaction/models/statuses.dart @@ -0,0 +1,64 @@ +part of '../crowdaction.dart'; + +enum Status { + started, + waiting, + ended, +} + +extension StatusFromJsonExtension on String { + Status get fromStatusJson { + switch (this) { + case 'STARTED': + return Status.started; + case 'WAITING': + return Status.waiting; + case 'ENDED': + return Status.ended; + default: + throw Exception('Invalid status $this'); + } + } +} + +extension StatusToJsonExtension on Status { + String get toJson { + switch (this) { + case Status.started: + return 'STARTED'; + case Status.waiting: + return 'WAITING'; + case Status.ended: + return 'ENDED'; + } + } +} + +enum JoinStatus { + open, + closed, +} + +extension JoinStatusFromJsonExtension on String { + JoinStatus get fromJoinStatusJson { + switch (this) { + case 'OPEN': + return JoinStatus.open; + case 'CLOSED': + return JoinStatus.closed; + default: + throw Exception('Invalid status $this'); + } + } +} + +extension JoinStatusToJsonExtension on JoinStatus { + String get toJson { + switch (this) { + case JoinStatus.open: + return 'OPEN'; + case JoinStatus.closed: + return 'CLOSED'; + } + } +} diff --git a/lib/domain/crowdaction/paginated_crowdactions.dart b/lib/domain/crowdaction/paginated_crowdactions.dart index 765fdfc6..1f76dfc4 100644 --- a/lib/domain/crowdaction/paginated_crowdactions.dart +++ b/lib/domain/crowdaction/paginated_crowdactions.dart @@ -1,16 +1,44 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; import '../core/page_info.dart'; import 'crowdaction.dart'; -part 'paginated_crowdactions.freezed.dart'; +class PaginatedCrowdActions extends Equatable { + const PaginatedCrowdActions({ + required this.crowdActions, + required this.pageInfo, + }); -@freezed -class PaginatedCrowdActions with _$PaginatedCrowdActions { - const PaginatedCrowdActions._(); + factory PaginatedCrowdActions.fromJson(Map json) => + PaginatedCrowdActions( + crowdActions: (json['crowdActions'] as List) + .map((dynamic e) => CrowdAction.fromJson(e as Map)) + .toList(), + pageInfo: PageInfo.fromJson(json['pageInfo'] as Map), + ); - const factory PaginatedCrowdActions({ - required List crowdActions, - required PageInfo pageInfo, - }) = _PaginatedCrowdActions; + final List crowdActions; + + final PageInfo pageInfo; + + PaginatedCrowdActions copyWith({ + List? crowdActions, + PageInfo? pageInfo, + }) { + return PaginatedCrowdActions( + crowdActions: crowdActions ?? this.crowdActions, + pageInfo: pageInfo ?? this.pageInfo, + ); + } + + @override + List get props => [ + crowdActions, + pageInfo, + ]; + + Map toJson() => { + 'crowdActions': crowdActions.map((e) => e.toJson()), + 'pageInfo': pageInfo.toJson(), + }; } diff --git a/lib/domain/participation/paginated_participations.dart b/lib/domain/participation/paginated_participations.dart index 4a7cfd6f..5aaa95a3 100644 --- a/lib/domain/participation/paginated_participations.dart +++ b/lib/domain/participation/paginated_participations.dart @@ -1,16 +1,45 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; import '../core/page_info.dart'; import 'participation.dart'; -part 'paginated_participations.freezed.dart'; +class PaginatedParticipations extends Equatable { + const PaginatedParticipations({ + required this.participations, + required this.pageInfo, + }); -@freezed -class PaginatedParticipations with _$PaginatedParticipations { - const PaginatedParticipations._(); + factory PaginatedParticipations.fromJson(Map json) => + PaginatedParticipations( + participations: (json['participations'] as List) + .map((dynamic e) => + Participation.fromJson(e as Map)) + .toList(), + pageInfo: PageInfo.fromJson(json['pageInfo'] as Map), + ); - const factory PaginatedParticipations({ - required List participations, - required PageInfo pageInfo, - }) = _PaginatedParticipations; + final List participations; + + final PageInfo pageInfo; + + PaginatedParticipations copyWith({ + List? participations, + PageInfo? pageInfo, + }) { + return PaginatedParticipations( + participations: participations ?? this.participations, + pageInfo: pageInfo ?? this.pageInfo, + ); + } + + @override + List get props => [ + participations, + pageInfo, + ]; + + Map toJson() => { + 'participations': participations.map((e) => e.toJson()), + 'pageInfo': pageInfo, + }; } diff --git a/lib/domain/participation/participation.dart b/lib/domain/participation/participation.dart index c0f88547..290565e9 100644 --- a/lib/domain/participation/participation.dart +++ b/lib/domain/participation/participation.dart @@ -1,23 +1,90 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; import '../../core/core.dart'; -part 'participation.freezed.dart'; - -@freezed -class Participation with _$Participation { - const Participation._(); - - const factory Participation({ - required String id, - required String crowdActionId, - required String fullName, - required String avatar, - required String userId, - required List commitments, - required DateTime joinDate, - required int dailyCheckIns, - }) = _Participation; +class Participation extends Equatable { + const Participation({ + required this.id, + required this.crowdActionId, + required this.fullName, + required this.avatar, + required this.userId, + required this.commitments, + required this.joinDate, + required this.dailyCheckIns, + }); + + factory Participation.fromJson(Map json) => Participation( + id: json['id'] as String, + crowdActionId: json['crowdActionId'] as String, + fullName: json['fullName'] as String, + avatar: json['avatar'] as String, + userId: json['userId'] as String, + commitments: json['commitments'] as List, + joinDate: DateTime.parse(json['joinDate'] as String), + dailyCheckIns: json['dailyCheckIns'] as String, + ); + + final String id; + + final String crowdActionId; + + final String fullName; + + final String avatar; + + final String userId; + + final List commitments; + + final DateTime joinDate; + + final String dailyCheckIns; + + Participation copyWith({ + String? id, + String? crowdActionId, + String? fullName, + String? avatar, + String? userId, + List? commitments, + DateTime? joinDate, + String? dailyCheckIns, + }) { + return Participation( + id: id ?? this.id, + crowdActionId: crowdActionId ?? this.crowdActionId, + fullName: fullName ?? this.fullName, + avatar: avatar ?? this.avatar, + userId: userId ?? this.userId, + commitments: commitments ?? this.commitments, + joinDate: joinDate ?? this.joinDate, + dailyCheckIns: dailyCheckIns ?? this.dailyCheckIns, + ); + } + + @override + List get props => [ + id, + crowdActionId, + fullName, + avatar, + userId, + commitments, + joinDate, + dailyCheckIns, + ]; + + Map toJson() => { + 'id': id, + 'crowdActionId': crowdActionId, + 'fullName': fullName, + 'avatar': avatar, + 'userId': userId, + 'commitments': commitments, + 'joinDate': joinDate, + 'dailyCheckIns': dailyCheckIns, + }; // Participation avatar url String get avatarUrl => '$baseStaticUrl/$avatar'; diff --git a/lib/domain/participation/participation_failures.dart b/lib/domain/participation/participation_failures.dart index 0c4a5c85..ea9a8edd 100644 --- a/lib/domain/participation/participation_failures.dart +++ b/lib/domain/participation/participation_failures.dart @@ -1,11 +1,20 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +abstract class ParticipationFailure { + const ParticipationFailure(); -part 'participation_failures.freezed.dart'; - -@freezed -class ParticipationFailure with _$ParticipationFailure { const factory ParticipationFailure.serverError() = ServerError; const factory ParticipationFailure.networkRequestFailed() = NetworkRequestFailed; const factory ParticipationFailure.notParticipating() = NotParticipating; } + +class ServerError extends ParticipationFailure { + const ServerError(); +} + +class NetworkRequestFailed extends ParticipationFailure { + const NetworkRequestFailed(); +} + +class NotParticipating extends ParticipationFailure { + const NotParticipating(); +} diff --git a/lib/domain/profile/profile.dart b/lib/domain/profile/profile.dart index 32555339..0d5e1636 100644 --- a/lib/domain/profile/profile.dart +++ b/lib/domain/profile/profile.dart @@ -1,18 +1,64 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; -part 'profile.freezed.dart'; +class Profile extends Equatable { + const Profile({ + required this.userId, + required this.firstName, + required this.lastName, + required this.avatar, + this.bio, + }); -@freezed -class Profile with _$Profile { - const Profile._(); + factory Profile.fromJson(Map json) => Profile( + userId: json['userId'] as String, + firstName: json['firstName'] as String, + lastName: json['lastName'] as String, + avatar: json['avatar'] as String, + bio: json['bio'] as String?, + ); - const factory Profile({ - required String userId, - required String firstName, - required String lastName, - required String avatar, - String? bio, - }) = _Profile; + final String userId; + + final String firstName; + + final String lastName; + + final String avatar; + + final String? bio; + + Profile copyWith({ + String? userId, + String? firstName, + String? lastName, + String? avatar, + String? Function()? bio, + }) { + return Profile( + userId: userId ?? this.userId, + firstName: firstName ?? this.firstName, + lastName: lastName ?? this.lastName, + avatar: avatar ?? this.avatar, + bio: bio != null ? bio() : this.bio, + ); + } + + @override + List get props => [ + userId, + firstName, + lastName, + avatar, + bio, + ]; + + Map toJson() => { + 'userId': userId, + 'firstName': firstName, + 'lastName': lastName, + 'avatar': avatar, + 'bio': bio, + }; String get fullName => '$firstName $lastName'; } diff --git a/lib/domain/profile/user_profile.dart b/lib/domain/profile/user_profile.dart index f977a956..42b4f50a 100644 --- a/lib/domain/profile/user_profile.dart +++ b/lib/domain/profile/user_profile.dart @@ -1,20 +1,41 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; -import '../../core/core.dart'; import '../user/user.dart'; import 'profile.dart'; -part 'user_profile.freezed.dart'; +class UserProfile extends Equatable { + const UserProfile({ + required this.user, + required this.profile, + }); -@freezed -class UserProfile with _$UserProfile { - const UserProfile._(); + // factory UserProfile.fromJson(Map json) => UserProfile( + // user: BaseUser.fromJson(json['user'] as Map), + // profile: Profile.fromJson(json['profile'] as Map), + // ); - const factory UserProfile({ - required User user, - required Profile profile, - }) = _UserProfile; + final User user; - // User profile avatar url - String? get avatarUrl => '$baseStaticUrl/${profile.avatar}'; + final Profile profile; + + UserProfile copyWith({ + User? user, + Profile? profile, + }) { + return UserProfile( + user: user ?? this.user, + profile: profile ?? this.profile, + ); + } + + @override + List get props => [ + user, + profile, + ]; + + // Map toJson() => { + // 'user': user.toJson(), + // 'profile': profile.toJson(), + // }; } diff --git a/lib/domain/settings/build_information.dart b/lib/domain/settings/build_information.dart index d3407c67..a376bee2 100644 --- a/lib/domain/settings/build_information.dart +++ b/lib/domain/settings/build_information.dart @@ -1,14 +1,47 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; -part 'build_information.freezed.dart'; +class BuildInformation extends Equatable { + const BuildInformation({ + required this.buildNumber, + required this.version, + this.environment, + }); -@freezed -class BuildInformation with _$BuildInformation { - const BuildInformation._(); + factory BuildInformation.fromJson(Map json) => + BuildInformation( + buildNumber: json['buildNumber'] as String, + version: json['version'] as String, + environment: json['environment'] as String?, + ); - const factory BuildInformation({ - required String buildNumber, - required String version, - String? environment, - }) = _BuildInformation; + final String buildNumber; + + final String version; + + final String? environment; + + BuildInformation copyWith({ + String? buildNumber, + String? version, + String? Function()? environment, + }) { + return BuildInformation( + buildNumber: buildNumber ?? this.buildNumber, + version: version ?? this.version, + environment: environment != null ? environment() : this.environment, + ); + } + + @override + List get props => [ + buildNumber, + version, + environment, + ]; + + Map toJson() => { + 'buildNumber': buildNumber, + 'version': version, + 'environment': environment, + }; } diff --git a/lib/domain/user/profile_failure.dart b/lib/domain/user/profile_failure.dart index 7e2b06a9..b802fa11 100644 --- a/lib/domain/user/profile_failure.dart +++ b/lib/domain/user/profile_failure.dart @@ -1,9 +1,14 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +abstract class ProfileFailure { + const ProfileFailure(); -part 'profile_failure.freezed.dart'; - -@freezed -class ProfileFailure with _$ProfileFailure { const factory ProfileFailure.unexpected() = Unexpected; const factory ProfileFailure.noUser() = NoUser; } + +class Unexpected extends ProfileFailure { + const Unexpected(); +} + +class NoUser extends ProfileFailure { + const NoUser(); +} diff --git a/lib/domain/user/upload_failures.dart b/lib/domain/user/upload_failures.dart index d26b4bd3..c36659cc 100644 --- a/lib/domain/user/upload_failures.dart +++ b/lib/domain/user/upload_failures.dart @@ -1,13 +1,19 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +abstract class UploadPathFailure { + const UploadPathFailure(); -part 'upload_failures.freezed.dart'; - -@freezed -class UploadPathFailure with _$UploadPathFailure { const factory UploadPathFailure.unexpected() = Unexpected; } -@freezed -class UploadFailure with _$UploadFailure { +class Unexpected extends UploadPathFailure { + const Unexpected(); +} + +abstract class UploadFailure { + const UploadFailure(); + const factory UploadFailure.uploadFailed() = UploadFailed; } + +class UploadFailed extends UploadFailure { + const UploadFailed(); +} diff --git a/lib/domain/user/user.dart b/lib/domain/user/user.dart index d5b80ec5..d2c56ce0 100644 --- a/lib/domain/user/user.dart +++ b/lib/domain/user/user.dart @@ -1,11 +1,25 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; +import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; -part 'user.freezed.dart'; +class User extends Equatable { + final String id; + final Future Function([bool forceRefresh]) getIdToken; + final DateTime? joinDate; + final String? email; + final String? phoneNumber; + final bool isEmailVerified; + final bool isPhoneNumberVerified; -@freezed -class User with _$User { - const User._(); + const User({ + required this.id, + required this.getIdToken, + this.joinDate, + this.email, + this.phoneNumber, + this.isEmailVerified = false, + this.isPhoneNumberVerified = false, + }); @visibleForTesting // ignore: avoid_positional_boolean_parameters @@ -19,17 +33,18 @@ class User with _$User { bool get isAnonymous => this == anonymous; - const factory User({ - required String id, - required Future Function([bool forceRefresh]) getIdToken, - DateTime? joinDate, - String? email, - String? phoneNumber, - @Default(false) bool isEmailVerified, - @Default(false) bool isPhoneNumberVerified, - }) = _User; - String get formattedJoinDate { return DateFormat('MMMM yyyy').format(joinDate!); } + + @override + List get props => [ + id, + getIdToken, + joinDate, + email, + phoneNumber, + isEmailVerified, + isPhoneNumberVerified, + ]; } diff --git a/models/commitment.model.json b/models/commitment.model.json new file mode 100644 index 00000000..ce52de18 --- /dev/null +++ b/models/commitment.model.json @@ -0,0 +1,27 @@ +{ + "model_name": "commitment", + "properties": [ + { + "name": "id", + "type": "int" + }, + { + "name": "title", + "type": "String" + }, + { + "name": "description", + "type": "String?" + }, + { + "name": "checked", + "type": "bool" + }, + { + "name": "icon", + "type": "String?" + } + ], + "style": "basic", + "additionals": ["json", "equatable", "copyWith"] +} diff --git a/models/crowdaction/commitment.json b/models/crowdaction/commitment.json new file mode 100644 index 00000000..004e38c8 --- /dev/null +++ b/models/crowdaction/commitment.json @@ -0,0 +1,31 @@ +{ + "model_name": "commitment", + "properties": [ + { + "name": "label", + "type": "String" + }, + { + "name": "description", + "type": "String?" + }, + { + "name": "points", + "type": "int" + }, + { + "name": "blocks", + "type": "List" + }, + { + "name": "id", + "type": "String" + }, + { + "name": "iconId", + "type": "String?" + } + ], + "style": "basic", + "additionals": ["json", "equatable", "copyWith"] +} diff --git a/models/crowdaction/crowdaction.json b/models/crowdaction/crowdaction.json new file mode 100644 index 00000000..d74b8436 --- /dev/null +++ b/models/crowdaction/crowdaction.json @@ -0,0 +1,78 @@ +{ + "model_name": "crowd_action", + "properties": [ + { + "name": "id", + "type": "String" + }, + { + "name": "title", + "type": "String" + }, + { + "name": "description", + "type": "String" + }, + { + "name": "category", + "type": "String" + }, + { + "name": "subcategory", + "type": "String?" + }, + { + "name": "location", + "type": "Location" + }, + { + "name": "slug", + "type": "String" + }, + { + "name": "password", + "type": "String?" + }, + { + "name": "participantCount", + "type": "int" + }, + { + "name": "images", + "type": "Images" + }, + { + "name": "commitments", + "type": "List" + }, + { + "name": "status", + "type": "Status" + }, + { + "name": "joinStatus", + "type": "JoinStatus" + }, + { + "name": "startAt", + "type": "DateTime" + }, + { + "name": "endAt", + "type": "DateTime" + } + ], + "style": "basic", + "relations": [ + { + "name": "Location" + }, + { + "name": "Images" + }, + { + "name": "Commitment" + } + ], + "additionals": ["json", "equatable", "copyWith"] +} diff --git a/models/crowdaction/images.json b/models/crowdaction/images.json new file mode 100644 index 00000000..2976e3b7 --- /dev/null +++ b/models/crowdaction/images.json @@ -0,0 +1,15 @@ +{ + "model_name": "images", + "properties": [ + { + "name": "card", + "type": "String" + }, + { + "name": "banner", + "type": "String" + } + ], + "style": "basic", + "additionals": ["json", "equatable", "copyWith"] +} diff --git a/models/crowdaction/location.json b/models/crowdaction/location.json new file mode 100644 index 00000000..3037bd41 --- /dev/null +++ b/models/crowdaction/location.json @@ -0,0 +1,15 @@ +{ + "model_name": "location", + "properties": [ + { + "name": "code", + "type": "String" + }, + { + "name": "name", + "type": "String" + } + ], + "style": "basic", + "additionals": ["json", "equatable", "copyWith"] +} diff --git a/models/crowdaction_comment.json b/models/crowdaction_comment.json new file mode 100644 index 00000000..b8edafbc --- /dev/null +++ b/models/crowdaction_comment.json @@ -0,0 +1,43 @@ +{ + "model_name": "crowdaction_comment", + "properties": [ + { + "name": "crowdactionId", + "type": "String" + }, + { + "name": "content", + "type": "String" + }, + { + "name": "userId", + "type": "String" + }, + { + "name": "createdAt", + "type": "DateTime" + }, + { + "name": "comments", + "type": "List?" + }, + { + "name": "likes", + "type": "int" + }, + { + "name": "likedByMe", + "type": "bool" + }, + { + "name": "flagged", + "type": "bool?" + }, + { + "name": "flags", + "type": "List?" + } + ], + "style": "basic", + "additionals": ["json", "equatable", "copyWith"] +} diff --git a/models/page_info.model.json b/models/page_info.model.json new file mode 100644 index 00000000..6240f7a1 --- /dev/null +++ b/models/page_info.model.json @@ -0,0 +1,27 @@ +{ + "model_name": "page_info", + "properties": [ + { + "name": "page", + "type": "int" + }, + { + "name": "pageSize", + "type": "int" + }, + { + "name": "totalPages", + "type": "int" + }, + { + "name": "totalItems", + "type": "int" + } + ], + "style": "basic", + "additionals": [ + "json", + "equatable", + "copyWith" + ] +} diff --git a/models/paginated_crowdaction.json b/models/paginated_crowdaction.json new file mode 100644 index 00000000..dc1c14ef --- /dev/null +++ b/models/paginated_crowdaction.json @@ -0,0 +1,23 @@ +{ + "model_name": "paginated_crowd_actions", + "properties": [ + { + "name": "crowdActions", + "type": "List" + }, + { + "name": "pageInfo", + "type": "PageInfo" + } + ], + "style": "basic", + "relations": [ + { + "name": "CrowdAction" + }, + { + "name": "PageInfo" + } + ], + "additionals": ["json", "equatable", "copyWith"] +} diff --git a/models/participation/paginated_participants.json b/models/participation/paginated_participants.json new file mode 100644 index 00000000..31b4707d --- /dev/null +++ b/models/participation/paginated_participants.json @@ -0,0 +1,23 @@ +{ + "model_name": "paginated_participations", + "properties": [ + { + "name": "participations", + "type": "List" + }, + { + "name": "pageInfo", + "type": "PageInfo" + } + ], + "style": "basic", + "relations": [ + { + "name": "Participation" + }, + { + "name": "PageInfo" + } + ], + "additionals": ["json", "equatable", "copyWith"] +} diff --git a/models/participation/participation.json b/models/participation/participation.json new file mode 100644 index 00000000..3d830b8b --- /dev/null +++ b/models/participation/participation.json @@ -0,0 +1,39 @@ +{ + "model_name": "participation", + "properties": [ + { + "name": "id", + "type": "String" + }, + { + "name": "crowdActionId", + "type": "String" + }, + { + "name": "fullName", + "type": "String" + }, + { + "name": "avatar", + "type": "String" + }, + { + "name": "userId", + "type": "String" + }, + { + "name": "commitments", + "type": "List" + }, + { + "name": "joinDate", + "type": "DateTime" + }, + { + "name": "dailyCheckIns", + "type": "String" + } + ], + "style": "basic", + "additionals": ["json", "equatable", "copyWith"] +} diff --git a/models/profile/profile.json b/models/profile/profile.json new file mode 100644 index 00000000..05aca82e --- /dev/null +++ b/models/profile/profile.json @@ -0,0 +1,27 @@ +{ + "model_name": "profile", + "properties": [ + { + "name": "userId", + "type": "String" + }, + { + "name": "firstName", + "type": "String" + }, + { + "name": "lastName", + "type": "String" + }, + { + "name": "avatar", + "type": "String" + }, + { + "name": "bio", + "type": "String?" + } + ], + "style": "basic", + "additionals": ["json", "equatable", "copyWith"] +} diff --git a/models/profile/user_profile.json b/models/profile/user_profile.json new file mode 100644 index 00000000..9a0f8e08 --- /dev/null +++ b/models/profile/user_profile.json @@ -0,0 +1,23 @@ +{ + "model_name": "user_profile", + "properties": [ + { + "name": "user", + "type": "User" + }, + { + "name": "profile", + "type": "Profile" + } + ], + "style": "basic", + "relations": [ + { + "name": "User" + }, + { + "name": "Profile" + } + ], + "additionals": ["json", "equatable", "copyWith"] +} diff --git a/models/settings/build_information.json b/models/settings/build_information.json new file mode 100644 index 00000000..759348b3 --- /dev/null +++ b/models/settings/build_information.json @@ -0,0 +1,23 @@ +{ + "model_name": "build_information", + "properties": [ + { + "name": "buildNumber", + "type": "String" + }, + { + "name": "version", + "type": "String" + }, + { + "name": "environment", + "type": "String?" + } + ], + "style": "basic", + "additionals": [ + "json", + "equatable", + "copyWith" + ] + } diff --git a/pubspec.lock b/pubspec.lock deleted file mode 100644 index 1767e4ce..00000000 --- a/pubspec.lock +++ /dev/null @@ -1,1554 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - _fe_analyzer_shared: - dependency: transitive - description: - name: _fe_analyzer_shared - sha256: "4897882604d919befd350648c7f91926a9d5de99e67b455bf0917cc2362f4bb8" - url: "https://pub.dev" - source: hosted - version: "47.0.0" - _flutterfire_internals: - dependency: transitive - description: - name: _flutterfire_internals - sha256: "64fcb0dbca4386356386c085142fa6e79c00a3326ceaa778a2d25f5d9ba61441" - url: "https://pub.dev" - source: hosted - version: "1.0.16" - adaptive_number: - dependency: transitive - description: - name: adaptive_number - sha256: "3a567544e9b5c9c803006f51140ad544aedc79604fd4f3f2c1380003f97c1d77" - url: "https://pub.dev" - source: hosted - version: "1.0.0" - analyzer: - dependency: transitive - description: - name: analyzer - sha256: "690e335554a8385bc9d787117d9eb52c0c03ee207a607e593de3c9d71b1cfe80" - url: "https://pub.dev" - source: hosted - version: "4.7.0" - archive: - dependency: transitive - description: - name: archive - sha256: d6347d54a2d8028e0437e3c099f66fdb8ae02c4720c1e7534c9f24c10351f85d - url: "https://pub.dev" - source: hosted - version: "3.3.6" - args: - dependency: transitive - description: - name: args - sha256: "4cab82a83ffef80b262ddedf47a0a8e56ee6fbf7fe21e6e768b02792034dd440" - url: "https://pub.dev" - source: hosted - version: "2.4.0" - async: - dependency: transitive - description: - name: async - sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 - url: "https://pub.dev" - source: hosted - version: "2.10.0" - auto_route: - dependency: "direct main" - description: - name: auto_route - sha256: "12047baeca0e01df93165ef33275b32119d72699ab9a49dc64c20e78f586f96d" - url: "https://pub.dev" - source: hosted - version: "5.0.4" - auto_route_generator: - dependency: "direct dev" - description: - name: auto_route_generator - sha256: c66eaa20dbba3211cac656037f88ba836a633dda953d9f4f9f9f5809b57e4278 - url: "https://pub.dev" - source: hosted - version: "5.0.2" - bloc: - dependency: "direct main" - description: - name: bloc - sha256: "658a5ae59edcf1e58aac98b000a71c762ad8f46f1394c34a52050cafb3e11a80" - url: "https://pub.dev" - source: hosted - version: "8.1.1" - bloc_test: - dependency: "direct dev" - description: - name: bloc_test - sha256: ffbb60c17ee3d8e3784cb78071088e353199057233665541e8ac6cd438dca8ad - url: "https://pub.dev" - source: hosted - version: "9.1.1" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - build: - dependency: transitive - description: - name: build - sha256: "3fbda25365741f8251b39f3917fb3c8e286a96fd068a5a242e11c2012d495777" - url: "https://pub.dev" - source: hosted - version: "2.3.1" - build_config: - dependency: transitive - description: - name: build_config - sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 - url: "https://pub.dev" - source: hosted - version: "1.1.1" - build_daemon: - dependency: transitive - description: - name: build_daemon - sha256: "757153e5d9cd88253cb13f28c2fb55a537dc31fefd98137549895b5beb7c6169" - url: "https://pub.dev" - source: hosted - version: "3.1.1" - build_resolvers: - dependency: transitive - description: - name: build_resolvers - sha256: "687cf90a3951affac1bd5f9ecb5e3e90b60487f3d9cdc359bb310f8876bb02a6" - url: "https://pub.dev" - source: hosted - version: "2.0.10" - build_runner: - dependency: "direct dev" - description: - name: build_runner - sha256: "93f05c041932674be039b0a2323d6cf57e5f2bbf884a3c0382f9e53fc45ebace" - url: "https://pub.dev" - source: hosted - version: "2.3.0" - build_runner_core: - dependency: transitive - description: - name: build_runner_core - sha256: "14febe0f5bac5ae474117a36099b4de6f1dbc52df6c5e55534b3da9591bf4292" - url: "https://pub.dev" - source: hosted - version: "7.2.7" - built_collection: - dependency: transitive - description: - name: built_collection - sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" - url: "https://pub.dev" - source: hosted - version: "5.1.1" - built_value: - dependency: transitive - description: - name: built_value - sha256: "169565c8ad06adb760c3645bf71f00bff161b00002cace266cad42c5d22a7725" - url: "https://pub.dev" - source: hosted - version: "8.4.3" - cached_network_image: - dependency: "direct main" - description: - name: cached_network_image - sha256: fd3d0dc1d451f9a252b32d95d3f0c3c487bc41a75eba2e6097cb0b9c71491b15 - url: "https://pub.dev" - source: hosted - version: "3.2.3" - cached_network_image_platform_interface: - dependency: transitive - description: - name: cached_network_image_platform_interface - sha256: bb2b8403b4ccdc60ef5f25c70dead1f3d32d24b9d6117cfc087f496b178594a7 - url: "https://pub.dev" - source: hosted - version: "2.0.0" - cached_network_image_web: - dependency: transitive - description: - name: cached_network_image_web - sha256: b8eb814ebfcb4dea049680f8c1ffb2df399e4d03bf7a352c775e26fa06e02fa0 - url: "https://pub.dev" - source: hosted - version: "1.0.2" - characters: - dependency: transitive - description: - name: characters - sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c - url: "https://pub.dev" - source: hosted - version: "1.2.1" - checked_yaml: - dependency: transitive - description: - name: checked_yaml - sha256: "3d1505d91afa809d177efd4eed5bb0eb65805097a1463abdd2add076effae311" - url: "https://pub.dev" - source: hosted - version: "2.0.2" - cli_util: - dependency: transitive - description: - name: cli_util - sha256: "66f86e916d285c1a93d3b79587d94bd71984a66aac4ff74e524cfa7877f1395c" - url: "https://pub.dev" - source: hosted - version: "0.3.5" - clock: - dependency: transitive - description: - name: clock - sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf - url: "https://pub.dev" - source: hosted - version: "1.1.1" - code_builder: - dependency: transitive - description: - name: code_builder - sha256: "0d43dd1288fd145de1ecc9a3948ad4a6d5a82f0a14c4fdd0892260787d975cbe" - url: "https://pub.dev" - source: hosted - version: "4.4.0" - collection: - dependency: transitive - description: - name: collection - sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 - url: "https://pub.dev" - source: hosted - version: "1.17.0" - convert: - dependency: transitive - description: - name: convert - sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" - url: "https://pub.dev" - source: hosted - version: "3.1.1" - country_codes: - dependency: "direct main" - description: - name: country_codes - sha256: d6d1a9c3c12577b24eb7f6160768b06a9d8fd3f73ad6b24dcc5b7e0ac4910056 - url: "https://pub.dev" - source: hosted - version: "2.2.0" - country_icons: - dependency: "direct main" - description: - name: country_icons - sha256: "836435012b42c7dcc6d585d1420ce2310d70396569ef70cf5d74c740919f7320" - url: "https://pub.dev" - source: hosted - version: "2.0.2" - coverage: - dependency: transitive - description: - name: coverage - sha256: "2fb815080e44a09b85e0f2ca8a820b15053982b2e714b59267719e8a9ff17097" - url: "https://pub.dev" - source: hosted - version: "1.6.3" - cross_file: - dependency: transitive - description: - name: cross_file - sha256: "0b0036e8cccbfbe0555fd83c1d31a6f30b77a96b598b35a5d36dd41f718695e9" - url: "https://pub.dev" - source: hosted - version: "0.3.3+4" - crypto: - dependency: transitive - description: - name: crypto - sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67 - url: "https://pub.dev" - source: hosted - version: "3.0.2" - dart_jsonwebtoken: - dependency: transitive - description: - name: dart_jsonwebtoken - sha256: "2a42e97c0b8b4e9a42b24a71453635f445c7b66c7d7c81e3a429f37ead9fe778" - url: "https://pub.dev" - source: hosted - version: "2.7.1" - dart_pubspec_licenses: - dependency: transitive - description: - name: dart_pubspec_licenses - sha256: "38680e2d2fc41df3a0d435d0955b91acc382aeefcb89ef4738f8167c8288a29d" - url: "https://pub.dev" - source: hosted - version: "2.0.2" - dart_style: - dependency: transitive - description: - name: dart_style - sha256: "7a03456c3490394c8e7665890333e91ae8a49be43542b616e414449ac358acd4" - url: "https://pub.dev" - source: hosted - version: "2.2.4" - dartz: - dependency: "direct main" - description: - name: dartz - sha256: e6acf34ad2e31b1eb00948692468c30ab48ac8250e0f0df661e29f12dd252168 - url: "https://pub.dev" - source: hosted - version: "0.10.1" - device_frame: - dependency: transitive - description: - name: device_frame - sha256: afe76182aec178d171953d9b4a50a43c57c7cf3c77d8b09a48bf30c8fa04dd9d - url: "https://pub.dev" - source: hosted - version: "1.1.0" - diff_match_patch: - dependency: transitive - description: - name: diff_match_patch - sha256: "2efc9e6e8f449d0abe15be240e2c2a3bcd977c8d126cfd70598aee60af35c0a4" - url: "https://pub.dev" - source: hosted - version: "0.4.1" - dots_indicator: - dependency: "direct main" - description: - name: dots_indicator - sha256: e59dfc90030ee5a4fd4c53144a8ce97cc7a823c2067b8fb9814960cd1ae63f89 - url: "https://pub.dev" - source: hosted - version: "2.1.0" - ed25519_edwards: - dependency: transitive - description: - name: ed25519_edwards - sha256: "6ce0112d131327ec6d42beede1e5dfd526069b18ad45dcf654f15074ad9276cd" - url: "https://pub.dev" - source: hosted - version: "0.3.1" - email_validator: - dependency: "direct main" - description: - name: email_validator - sha256: e9a90f27ab2b915a27d7f9c2a7ddda5dd752d6942616ee83529b686fc086221b - url: "https://pub.dev" - source: hosted - version: "2.1.17" - equatable: - dependency: "direct main" - description: - name: equatable - sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2 - url: "https://pub.dev" - source: hosted - version: "2.0.5" - expandable_page_view: - dependency: "direct main" - description: - name: expandable_page_view - sha256: "210dc6961cfc29f7ed42867824eb699c9a4b9b198a7c04b8bdc1c05844969dc6" - url: "https://pub.dev" - source: hosted - version: "1.0.17" - fake_async: - dependency: transitive - description: - name: fake_async - sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" - url: "https://pub.dev" - source: hosted - version: "1.3.1" - ffi: - dependency: transitive - description: - name: ffi - sha256: a38574032c5f1dd06c4aee541789906c12ccaab8ba01446e800d9c5b79c4a978 - url: "https://pub.dev" - source: hosted - version: "2.0.1" - file: - dependency: transitive - description: - name: file - sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" - url: "https://pub.dev" - source: hosted - version: "6.1.4" - firebase_auth: - dependency: "direct main" - description: - name: firebase_auth - sha256: e946a21254784116d32e497e09b851b4d03a3c65880e80d6939a720dfce88aed - url: "https://pub.dev" - source: hosted - version: "4.2.2" - firebase_auth_mocks: - dependency: "direct dev" - description: - name: firebase_auth_mocks - sha256: c4398019066d1bd0e91a0ba6067272a3a60c7ff8b211aa9c2139b273abe98914 - url: "https://pub.dev" - source: hosted - version: "0.10.3" - firebase_auth_platform_interface: - dependency: transitive - description: - name: firebase_auth_platform_interface - sha256: c645fec50b0391aa878288f58fa4fe9762c271380c457aedf5c7c9b718604f68 - url: "https://pub.dev" - source: hosted - version: "6.11.11" - firebase_auth_web: - dependency: transitive - description: - name: firebase_auth_web - sha256: bf8f3093c141abd0a624e0244864154d9db694682ba0cc1fcfdf60ecb6f7f2e3 - url: "https://pub.dev" - source: hosted - version: "5.2.2" - firebase_core: - dependency: "direct main" - description: - name: firebase_core - sha256: fe30ac230f12f8836bb97e6e09197340d3c584526825b1746ea362a82e1e43f7 - url: "https://pub.dev" - source: hosted - version: "2.7.0" - firebase_core_platform_interface: - dependency: transitive - description: - name: firebase_core_platform_interface - sha256: "5615b30c36f55b2777d0533771deda7e5730e769e5d3cb7fda79e9bed86cfa55" - url: "https://pub.dev" - source: hosted - version: "4.5.3" - firebase_core_web: - dependency: transitive - description: - name: firebase_core_web - sha256: "291fbcace608aca6c860652e1358ef89752be8cc3ef227f8bbcd1e62775b833a" - url: "https://pub.dev" - source: hosted - version: "2.2.1" - firebase_crashlytics: - dependency: "direct main" - description: - name: firebase_crashlytics - sha256: "816bbb920316c8fe257b460b8856b01e274e867a729961bf7a3be6322cdf13e1" - url: "https://pub.dev" - source: hosted - version: "3.0.15" - firebase_crashlytics_platform_interface: - dependency: transitive - description: - name: firebase_crashlytics_platform_interface - sha256: "120e47b9bac3654848d1bdc60b8027f3574b53ee0b81b1a2e5e76ddaa58f6645" - url: "https://pub.dev" - source: hosted - version: "3.3.15" - fixnum: - dependency: transitive - description: - name: fixnum - sha256: "04be3e934c52e082558cc9ee21f42f5c1cd7a1262f4c63cd0357c08d5bba81ec" - url: "https://pub.dev" - source: hosted - version: "1.0.1" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_bloc: - dependency: "direct main" - description: - name: flutter_bloc - sha256: "434951eea948dbe87f737b674281465f610b8259c16c097b8163ce138749a775" - url: "https://pub.dev" - source: hosted - version: "8.1.2" - flutter_blurhash: - dependency: transitive - description: - name: flutter_blurhash - sha256: "05001537bd3fac7644fa6558b09ec8c0a3f2eba78c0765f88912882b1331a5c6" - url: "https://pub.dev" - source: hosted - version: "0.7.0" - flutter_cache_manager: - dependency: transitive - description: - name: flutter_cache_manager - sha256: "32cd900555219333326a2d0653aaaf8671264c29befa65bbd9856d204a4c9fb3" - url: "https://pub.dev" - source: hosted - version: "3.3.0" - flutter_dotenv: - dependency: "direct main" - description: - name: flutter_dotenv - sha256: d9283d92059a22e9834bc0a31336658ffba77089fb6f3cc36751f1fc7c6661a3 - url: "https://pub.dev" - source: hosted - version: "5.0.2" - flutter_launcher_icons: - dependency: "direct dev" - description: - name: flutter_launcher_icons - sha256: ce0e501cfc258907842238e4ca605e74b7fd1cdf04b3b43e86c43f3e40a1592c - url: "https://pub.dev" - source: hosted - version: "0.11.0" - flutter_lints: - dependency: "direct dev" - description: - name: flutter_lints - sha256: aeb0b80a8b3709709c9cc496cdc027c5b3216796bc0af0ce1007eaf24464fd4c - url: "https://pub.dev" - source: hosted - version: "2.0.1" - flutter_oss_licenses: - dependency: "direct dev" - description: - name: flutter_oss_licenses - sha256: eb15e1146b101dca063a177f6d339dfb85b639a9e2d2b71c18188d5fb2144869 - url: "https://pub.dev" - source: hosted - version: "2.0.1" - flutter_plugin_android_lifecycle: - dependency: transitive - description: - name: flutter_plugin_android_lifecycle - sha256: "4bef634684b2c7f3468c77c766c831229af829a0cd2d4ee6c1b99558bd14e5d2" - url: "https://pub.dev" - source: hosted - version: "2.0.8" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - flutter_web_plugins: - dependency: transitive - description: flutter - source: sdk - version: "0.0.0" - freezed: - dependency: "direct dev" - description: - name: freezed - sha256: "4179d41127bc7a67dc3f58ceec1d22f1cdf10470653cb86eda2a63f81b4920c7" - url: "https://pub.dev" - source: hosted - version: "2.2.0" - freezed_annotation: - dependency: "direct main" - description: - name: freezed_annotation - sha256: aeac15850ef1b38ee368d4c53ba9a847e900bb2c53a4db3f6881cbb3cb684338 - url: "https://pub.dev" - source: hosted - version: "2.2.0" - frontend_server_client: - dependency: transitive - description: - name: frontend_server_client - sha256: "4f4a162323c86ffc1245765cfe138872b8f069deb42f7dbb36115fa27f31469b" - url: "https://pub.dev" - source: hosted - version: "2.1.3" - get_it: - dependency: "direct main" - description: - name: get_it - sha256: "290fde3a86072e4b37dbb03c07bec6126f0ecc28dad403c12ffe2e5a2d751ab7" - url: "https://pub.dev" - source: hosted - version: "7.2.0" - glob: - dependency: transitive - description: - name: glob - sha256: "4515b5b6ddb505ebdd242a5f2cc5d22d3d6a80013789debfbda7777f47ea308c" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - go_router: - dependency: transitive - description: - name: go_router - sha256: "25ae21384b758eb80daff113fe8bfb785c2dd17b69fe4885008fe764b26fd1ca" - url: "https://pub.dev" - source: hosted - version: "3.1.1" - graphs: - dependency: transitive - description: - name: graphs - sha256: f9e130f3259f52d26f0cfc0e964513796dafed572fa52e45d2f8d6ca14db39b2 - url: "https://pub.dev" - source: hosted - version: "2.2.0" - http: - dependency: "direct main" - description: - name: http - sha256: "6aa2946395183537c8b880962d935877325d6a09a2867c3970c05c0fed6ac482" - url: "https://pub.dev" - source: hosted - version: "0.13.5" - http_multi_server: - dependency: transitive - description: - name: http_multi_server - sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" - url: "https://pub.dev" - source: hosted - version: "3.2.1" - http_parser: - dependency: transitive - description: - name: http_parser - sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" - url: "https://pub.dev" - source: hosted - version: "4.0.2" - image: - dependency: "direct main" - description: - name: image - sha256: "8e9d133755c3e84c73288363e6343157c383a0c6c56fc51afcc5d4d7180306d6" - url: "https://pub.dev" - source: hosted - version: "3.3.0" - image_cropper: - dependency: "direct main" - description: - name: image_cropper - sha256: "85324928ee8a8be35a529446435ca53067865b9353c8681983472eeec66d780f" - url: "https://pub.dev" - source: hosted - version: "3.0.1" - image_cropper_for_web: - dependency: transitive - description: - name: image_cropper_for_web - sha256: "09e93a8ec0435adcaa23622ac090442872f18145d70b9ff605ffedcf97d56255" - url: "https://pub.dev" - source: hosted - version: "1.0.3" - image_cropper_platform_interface: - dependency: transitive - description: - name: image_cropper_platform_interface - sha256: "62349e3aab63873ea9b9ab9f69d036ab8a0d74b3004beec4303981386cb9273f" - url: "https://pub.dev" - source: hosted - version: "3.0.3" - image_picker: - dependency: "direct main" - description: - name: image_picker - sha256: "22207768556b82d55ec70166824350fee32298732d5efa4d6e756f848f51f66a" - url: "https://pub.dev" - source: hosted - version: "0.8.6+3" - image_picker_android: - dependency: transitive - description: - name: image_picker_android - sha256: "68d067baf7f6e401b1124ee83dd6967e67847314250fd68012aab34a69beb344" - url: "https://pub.dev" - source: hosted - version: "0.8.5+7" - image_picker_for_web: - dependency: transitive - description: - name: image_picker_for_web - sha256: "66fc6e3877bbde82c33d122f3588777c3784ac5bd7d1cdd79213ef7aecb85b34" - url: "https://pub.dev" - source: hosted - version: "2.1.11" - image_picker_ios: - dependency: transitive - description: - name: image_picker_ios - sha256: "39aa70b5f1e5e7c94585b9738632d5fdb764a5655e40cd9e7b95fbd2fc50c519" - url: "https://pub.dev" - source: hosted - version: "0.8.6+9" - image_picker_platform_interface: - dependency: transitive - description: - name: image_picker_platform_interface - sha256: "1991219d9dbc42a99aff77e663af8ca51ced592cd6685c9485e3458302d3d4f8" - url: "https://pub.dev" - source: hosted - version: "2.6.3" - infinite_scroll_pagination: - dependency: "direct main" - description: - name: infinite_scroll_pagination - sha256: "9517328f4e373f08f57dbb11c5aac5b05554142024d6b60c903f3b73476d52db" - url: "https://pub.dev" - source: hosted - version: "3.2.0" - injectable: - dependency: "direct main" - description: - name: injectable - sha256: "7dab7d341feb40a0590d9ff6261aea9495522005e2c6763f9161a4face916f7b" - url: "https://pub.dev" - source: hosted - version: "2.1.0" - injectable_generator: - dependency: "direct dev" - description: - name: injectable_generator - sha256: b206de637c1960007b0beebe447a6ee3cf30c9e5f14542083024a9d0c49a7a09 - url: "https://pub.dev" - source: hosted - version: "2.1.4" - intl: - dependency: "direct main" - description: - name: intl - sha256: a3715e3bc90294e971cb7dc063fbf3cd9ee0ebf8604ffeafabd9e6f16abbdbe6 - url: "https://pub.dev" - source: hosted - version: "0.18.0" - io: - dependency: transitive - description: - name: io - sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" - url: "https://pub.dev" - source: hosted - version: "1.0.4" - ionicons: - dependency: "direct main" - description: - name: ionicons - sha256: "5496bc65a16115ecf05b15b78f494ee4a8869504357668f0a11d689e970523cf" - url: "https://pub.dev" - source: hosted - version: "0.2.2" - js: - dependency: transitive - description: - name: js - sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" - url: "https://pub.dev" - source: hosted - version: "0.6.5" - json_annotation: - dependency: "direct main" - description: - name: json_annotation - sha256: "3520fa844009431b5d4491a5a778603520cdc399ab3406332dcc50f93547258c" - url: "https://pub.dev" - source: hosted - version: "4.7.0" - json_serializable: - dependency: "direct dev" - description: - name: json_serializable - sha256: f3c2c18a7889580f71926f30c1937727c8c7d4f3a435f8f5e8b0ddd25253ef5d - url: "https://pub.dev" - source: hosted - version: "6.5.4" - lint: - dependency: "direct dev" - description: - name: lint - sha256: "3e9343b1cededcfb1e8b40d0dbd3592b7a1c6c0121545663a991433390c2bc97" - url: "https://pub.dev" - source: hosted - version: "2.0.1" - lints: - dependency: transitive - description: - name: lints - sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593" - url: "https://pub.dev" - source: hosted - version: "2.0.1" - logging: - dependency: transitive - description: - name: logging - sha256: "04094f2eb032cbb06c6f6e8d3607edcfcb0455e2bb6cbc010cb01171dcb64e6d" - url: "https://pub.dev" - source: hosted - version: "1.1.1" - matcher: - dependency: transitive - description: - name: matcher - sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" - url: "https://pub.dev" - source: hosted - version: "0.12.13" - material_color_utilities: - dependency: transitive - description: - name: material_color_utilities - sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 - url: "https://pub.dev" - source: hosted - version: "0.2.0" - meta: - dependency: transitive - description: - name: meta - sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" - url: "https://pub.dev" - source: hosted - version: "1.8.0" - mime: - dependency: transitive - description: - name: mime - sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e - url: "https://pub.dev" - source: hosted - version: "1.0.4" - mock_exceptions: - dependency: transitive - description: - name: mock_exceptions - sha256: "6e3e623712d2c6106ffe9e14732912522b565ddaa82a8dcee6cd4441b5984056" - url: "https://pub.dev" - source: hosted - version: "0.8.2" - mocktail: - dependency: "direct main" - description: - name: mocktail - sha256: "80a996cd9a69284b3dc521ce185ffe9150cde69767c2d3a0720147d93c0cef53" - url: "https://pub.dev" - source: hosted - version: "0.3.0" - nested: - dependency: transitive - description: - name: nested - sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" - url: "https://pub.dev" - source: hosted - version: "1.0.0" - node_preamble: - dependency: transitive - description: - name: node_preamble - sha256: "8ebdbaa3b96d5285d068f80772390d27c21e1fa10fb2df6627b1b9415043608d" - url: "https://pub.dev" - source: hosted - version: "2.0.1" - octo_image: - dependency: transitive - description: - name: octo_image - sha256: "107f3ed1330006a3bea63615e81cf637433f5135a52466c7caa0e7152bca9143" - url: "https://pub.dev" - source: hosted - version: "1.0.2" - package_config: - dependency: transitive - description: - name: package_config - sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" - url: "https://pub.dev" - source: hosted - version: "2.1.0" - package_info_plus: - dependency: "direct main" - description: - name: package_info_plus - sha256: "8df5ab0a481d7dc20c0e63809e90a588e496d276ba53358afc4c4443d0a00697" - url: "https://pub.dev" - source: hosted - version: "3.0.3" - package_info_plus_platform_interface: - dependency: transitive - description: - name: package_info_plus_platform_interface - sha256: "9bc8ba46813a4cc42c66ab781470711781940780fd8beddd0c3da62506d3a6c6" - url: "https://pub.dev" - source: hosted - version: "2.0.1" - path: - dependency: transitive - description: - name: path - sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b - url: "https://pub.dev" - source: hosted - version: "1.8.2" - path_provider: - dependency: transitive - description: - name: path_provider - sha256: "04890b994ee89bfa80bf3080bfec40d5a92c5c7a785ebb02c13084a099d2b6f9" - url: "https://pub.dev" - source: hosted - version: "2.0.13" - path_provider_android: - dependency: transitive - description: - name: path_provider_android - sha256: "7623b7d4be0f0f7d9a8b5ee6879fc13e4522d4c875ab86801dee4af32b54b83e" - url: "https://pub.dev" - source: hosted - version: "2.0.23" - path_provider_foundation: - dependency: transitive - description: - name: path_provider_foundation - sha256: eec003594f19fe2456ea965ae36b3fc967bc5005f508890aafe31fa75e41d972 - url: "https://pub.dev" - source: hosted - version: "2.1.2" - path_provider_linux: - dependency: transitive - description: - name: path_provider_linux - sha256: "525ad5e07622d19447ad740b1ed5070031f7a5437f44355ae915ff56e986429a" - url: "https://pub.dev" - source: hosted - version: "2.1.9" - path_provider_platform_interface: - dependency: transitive - description: - name: path_provider_platform_interface - sha256: "57585299a729335f1298b43245842678cb9f43a6310351b18fb577d6e33165ec" - url: "https://pub.dev" - source: hosted - version: "2.0.6" - path_provider_windows: - dependency: transitive - description: - name: path_provider_windows - sha256: "642ddf65fde5404f83267e8459ddb4556316d3ee6d511ed193357e25caa3632d" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - pedantic: - dependency: transitive - description: - name: pedantic - sha256: "67fc27ed9639506c856c840ccce7594d0bdcd91bc8d53d6e52359449a1d50602" - url: "https://pub.dev" - source: hosted - version: "1.11.1" - petitparser: - dependency: transitive - description: - name: petitparser - sha256: "49392a45ced973e8d94a85fdb21293fbb40ba805fc49f2965101ae748a3683b4" - url: "https://pub.dev" - source: hosted - version: "5.1.0" - phone_number: - dependency: "direct main" - description: - name: phone_number - sha256: "42cac4ca32146d83cc8a9c8432dc2d901d40334f0e2b02a3ec7d8237b80ebec3" - url: "https://pub.dev" - source: hosted - version: "1.0.0" - platform: - dependency: transitive - description: - name: platform - sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" - url: "https://pub.dev" - source: hosted - version: "3.1.0" - plugin_platform_interface: - dependency: transitive - description: - name: plugin_platform_interface - sha256: "6a2128648c854906c53fa8e33986fc0247a1116122f9534dd20e3ab9e16a32bc" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - pointycastle: - dependency: transitive - description: - name: pointycastle - sha256: db7306cf0249f838d1a24af52b5a5887c5bf7f31d8bb4e827d071dc0939ad346 - url: "https://pub.dev" - source: hosted - version: "3.6.2" - pool: - dependency: transitive - description: - name: pool - sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" - url: "https://pub.dev" - source: hosted - version: "1.5.1" - process: - dependency: transitive - description: - name: process - sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" - url: "https://pub.dev" - source: hosted - version: "4.2.4" - provider: - dependency: transitive - description: - name: provider - sha256: cdbe7530b12ecd9eb455bdaa2fcb8d4dad22e80b8afb4798b41479d5ce26847f - url: "https://pub.dev" - source: hosted - version: "6.0.5" - pub_semver: - dependency: transitive - description: - name: pub_semver - sha256: "307de764d305289ff24ad257ad5c5793ce56d04947599ad68b3baa124105fc17" - url: "https://pub.dev" - source: hosted - version: "2.1.3" - pubspec_parse: - dependency: transitive - description: - name: pubspec_parse - sha256: "75f6614d6dde2dc68948dffbaa4fe5dae32cd700eb9fb763fe11dfb45a3c4d0a" - url: "https://pub.dev" - source: hosted - version: "1.2.1" - recase: - dependency: transitive - description: - name: recase - sha256: e4eb4ec2dcdee52dcf99cb4ceabaffc631d7424ee55e56f280bc039737f89213 - url: "https://pub.dev" - source: hosted - version: "4.1.0" - rive: - dependency: "direct main" - description: - name: rive - sha256: "21b9364d578d3f55f36e18da0235f58adf26edc328505e9bac1824f1bb297f33" - url: "https://pub.dev" - source: hosted - version: "0.10.2" - rive_common: - dependency: transitive - description: - name: rive_common - sha256: f98a451a5d6c8c82693b4eab1dd65413800bab69ac7f9f8fad79fd39bb5ba3ab - url: "https://pub.dev" - source: hosted - version: "0.0.2" - rxdart: - dependency: "direct main" - description: - name: rxdart - sha256: "0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb" - url: "https://pub.dev" - source: hosted - version: "0.27.7" - share_plus: - dependency: "direct main" - description: - name: share_plus - sha256: "8c6892037b1824e2d7e8f59d54b3105932899008642e6372e5079c6939b4b625" - url: "https://pub.dev" - source: hosted - version: "6.3.1" - share_plus_platform_interface: - dependency: transitive - description: - name: share_plus_platform_interface - sha256: "82ddd4ab9260c295e6e39612d4ff00390b9a7a21f1bb1da771e2f232d80ab8a1" - url: "https://pub.dev" - source: hosted - version: "3.2.0" - shared_preferences: - dependency: "direct main" - description: - name: shared_preferences - sha256: ee6257848f822b8481691f20c3e6d2bfee2e9eccb2a3d249907fcfb198c55b41 - url: "https://pub.dev" - source: hosted - version: "2.0.18" - shared_preferences_android: - dependency: transitive - description: - name: shared_preferences_android - sha256: a51a4f9375097f94df1c6e0a49c0374440d31ab026b59d58a7e7660675879db4 - url: "https://pub.dev" - source: hosted - version: "2.0.16" - shared_preferences_foundation: - dependency: transitive - description: - name: shared_preferences_foundation - sha256: "6b84fdf06b32bb336f972d373cd38b63734f3461ba56ac2ba01b56d052796259" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - shared_preferences_linux: - dependency: transitive - description: - name: shared_preferences_linux - sha256: d7fb71e6e20cd3dfffcc823a28da3539b392e53ed5fc5c2b90b55fdaa8a7e8fa - url: "https://pub.dev" - source: hosted - version: "2.1.4" - shared_preferences_platform_interface: - dependency: transitive - description: - name: shared_preferences_platform_interface - sha256: "824bfd02713e37603b2bdade0842e47d56e7db32b1dcdd1cae533fb88e2913fc" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - shared_preferences_web: - dependency: transitive - description: - name: shared_preferences_web - sha256: "6737b757e49ba93de2a233df229d0b6a87728cea1684da828cbc718b65dcf9d7" - url: "https://pub.dev" - source: hosted - version: "2.0.5" - shared_preferences_windows: - dependency: transitive - description: - name: shared_preferences_windows - sha256: bd014168e8484837c39ef21065b78f305810ceabc1d4f90be6e3b392ce81b46d - url: "https://pub.dev" - source: hosted - version: "2.1.4" - shelf: - dependency: transitive - description: - name: shelf - sha256: c24a96135a2ccd62c64b69315a14adc5c3419df63b4d7c05832a346fdb73682c - url: "https://pub.dev" - source: hosted - version: "1.4.0" - shelf_packages_handler: - dependency: transitive - description: - name: shelf_packages_handler - sha256: aef74dc9195746a384843102142ab65b6a4735bb3beea791e63527b88cc83306 - url: "https://pub.dev" - source: hosted - version: "3.0.1" - shelf_static: - dependency: transitive - description: - name: shelf_static - sha256: e792b76b96a36d4a41b819da593aff4bdd413576b3ba6150df5d8d9996d2e74c - url: "https://pub.dev" - source: hosted - version: "1.1.1" - shelf_web_socket: - dependency: transitive - description: - name: shelf_web_socket - sha256: a988c0e8d8ffbdb8a28aa7ec8e449c260f3deb808781fe1284d22c5bba7156e8 - url: "https://pub.dev" - source: hosted - version: "1.0.3" - shimmer: - dependency: "direct main" - description: - name: shimmer - sha256: "1f1009b5845a1f88f1c5630212279540486f97409e9fc3f63883e71070d107bf" - url: "https://pub.dev" - source: hosted - version: "2.0.0" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.99" - sliver_tools: - dependency: transitive - description: - name: sliver_tools - sha256: bfa69411ebb203cc1a115b1e8bc7935b893eb381fdcf8d453b40c0d4e1db3247 - url: "https://pub.dev" - source: hosted - version: "0.2.9" - source_gen: - dependency: transitive - description: - name: source_gen - sha256: "2d79738b6bbf38a43920e2b8d189e9a3ce6cc201f4b8fc76be5e4fe377b1c38d" - url: "https://pub.dev" - source: hosted - version: "1.2.6" - source_helper: - dependency: transitive - description: - name: source_helper - sha256: "3b67aade1d52416149c633ba1bb36df44d97c6b51830c2198e934e3fca87ca1f" - url: "https://pub.dev" - source: hosted - version: "1.3.3" - source_map_stack_trace: - dependency: transitive - description: - name: source_map_stack_trace - sha256: "84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - source_maps: - dependency: transitive - description: - name: source_maps - sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703" - url: "https://pub.dev" - source: hosted - version: "0.10.12" - source_span: - dependency: transitive - description: - name: source_span - sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 - url: "https://pub.dev" - source: hosted - version: "1.9.1" - sqflite: - dependency: transitive - description: - name: sqflite - sha256: "851d5040552cf911f4cabda08d003eca76b27da3ed0002978272e27c8fbf8ecc" - url: "https://pub.dev" - source: hosted - version: "2.2.5" - sqflite_common: - dependency: transitive - description: - name: sqflite_common - sha256: bfd6973aaeeb93475bc0d875ac9aefddf7965ef22ce09790eb963992ffc5183f - url: "https://pub.dev" - source: hosted - version: "2.4.2+2" - stack_trace: - dependency: transitive - description: - name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 - url: "https://pub.dev" - source: hosted - version: "1.11.0" - stream_channel: - dependency: transitive - description: - name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - stream_transform: - dependency: transitive - description: - name: stream_transform - sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" - url: "https://pub.dev" - source: hosted - version: "2.1.0" - string_scanner: - dependency: transitive - description: - name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - synchronized: - dependency: transitive - description: - name: synchronized - sha256: "33b31b6beb98100bf9add464a36a8dd03eb10c7a8cf15aeec535e9b054aaf04b" - url: "https://pub.dev" - source: hosted - version: "3.0.1" - term_glyph: - dependency: transitive - description: - name: term_glyph - sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.dev" - source: hosted - version: "1.2.1" - test: - dependency: transitive - description: - name: test - sha256: a5fcd2d25eeadbb6589e80198a47d6a464ba3e2049da473943b8af9797900c2d - url: "https://pub.dev" - source: hosted - version: "1.22.0" - test_api: - dependency: transitive - description: - name: test_api - sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 - url: "https://pub.dev" - source: hosted - version: "0.4.16" - test_core: - dependency: transitive - description: - name: test_core - sha256: "0ef9755ec6d746951ba0aabe62f874b707690b5ede0fecc818b138fcc9b14888" - url: "https://pub.dev" - source: hosted - version: "0.4.20" - timing: - dependency: transitive - description: - name: timing - sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" - url: "https://pub.dev" - source: hosted - version: "1.0.1" - typed_data: - dependency: transitive - description: - name: typed_data - sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5" - url: "https://pub.dev" - source: hosted - version: "1.3.1" - url_launcher: - dependency: "direct main" - description: - name: url_launcher - sha256: "75f2846facd11168d007529d6cd8fcb2b750186bea046af9711f10b907e1587e" - url: "https://pub.dev" - source: hosted - version: "6.1.10" - url_launcher_android: - dependency: transitive - description: - name: url_launcher_android - sha256: "1f4d9ebe86f333c15d318f81dcdc08b01d45da44af74552608455ebdc08d9732" - url: "https://pub.dev" - source: hosted - version: "6.0.24" - url_launcher_ios: - dependency: transitive - description: - name: url_launcher_ios - sha256: c9cd648d2f7ab56968e049d4e9116f96a85517f1dd806b96a86ea1018a3a82e5 - url: "https://pub.dev" - source: hosted - version: "6.1.1" - url_launcher_linux: - dependency: transitive - description: - name: url_launcher_linux - sha256: e29039160ab3730e42f3d811dc2a6d5f2864b90a70fb765ea60144b03307f682 - url: "https://pub.dev" - source: hosted - version: "3.0.3" - url_launcher_macos: - dependency: transitive - description: - name: url_launcher_macos - sha256: "2dddb3291a57b074dade66b5e07e64401dd2487caefd4e9e2f467138d8c7eb06" - url: "https://pub.dev" - source: hosted - version: "3.0.3" - url_launcher_platform_interface: - dependency: transitive - description: - name: url_launcher_platform_interface - sha256: "6c9ca697a5ae218ce56cece69d46128169a58aa8653c1b01d26fcd4aad8c4370" - url: "https://pub.dev" - source: hosted - version: "2.1.2" - url_launcher_web: - dependency: transitive - description: - name: url_launcher_web - sha256: "574cfbe2390666003c3a1d129bdc4574aaa6728f0c00a4829a81c316de69dd9b" - url: "https://pub.dev" - source: hosted - version: "2.0.15" - url_launcher_windows: - dependency: transitive - description: - name: url_launcher_windows - sha256: "97c9067950a0d09cbd93e2e3f0383d1403989362b97102fbf446473a48079a4b" - url: "https://pub.dev" - source: hosted - version: "3.0.4" - uuid: - dependency: transitive - description: - name: uuid - sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313" - url: "https://pub.dev" - source: hosted - version: "3.0.7" - vector_math: - dependency: transitive - description: - name: vector_math - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - vm_service: - dependency: transitive - description: - name: vm_service - sha256: e7fb6c2282f7631712b69c19d1bff82f3767eea33a2321c14fa59ad67ea391c7 - url: "https://pub.dev" - source: hosted - version: "9.4.0" - watcher: - dependency: transitive - description: - name: watcher - sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" - url: "https://pub.dev" - source: hosted - version: "1.0.2" - web_socket_channel: - dependency: transitive - description: - name: web_socket_channel - sha256: ca49c0bc209c687b887f30527fb6a9d80040b072cc2990f34b9bec3e7663101b - url: "https://pub.dev" - source: hosted - version: "2.3.0" - webkit_inspection_protocol: - dependency: transitive - description: - name: webkit_inspection_protocol - sha256: "67d3a8b6c79e1987d19d848b0892e582dbb0c66c57cc1fef58a177dd2aa2823d" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - webview_flutter: - dependency: "direct main" - description: - name: webview_flutter - sha256: "9ba213434f13e760ea0f175fbc4d6bb6aeafd7dfc6c7d973f15d3e47a5d6686e" - url: "https://pub.dev" - source: hosted - version: "4.0.5" - webview_flutter_android: - dependency: transitive - description: - name: webview_flutter_android - sha256: "48c8cfb023168473c0a3a4c21ffea6c23a32cc7156701c39f618b303c6a3c96e" - url: "https://pub.dev" - source: hosted - version: "3.3.1" - webview_flutter_platform_interface: - dependency: transitive - description: - name: webview_flutter_platform_interface - sha256: df6472164b3f4eaf3280422227f361dc8424b106726b7f21d79a8656ba53f71f - url: "https://pub.dev" - source: hosted - version: "2.0.2" - webview_flutter_wkwebview: - dependency: transitive - description: - name: webview_flutter_wkwebview - sha256: "283a38c2a2544768033864c698e0133aa9eee0f2c800f494b538a3d1044f7ecb" - url: "https://pub.dev" - source: hosted - version: "3.1.1" - widgetbook: - dependency: "direct dev" - description: - name: widgetbook - sha256: c42a3d414d19c008d90f0b6df669c18bb151c5f3012ed073498d96cf133e9caf - url: "https://pub.dev" - source: hosted - version: "2.4.1" - widgetbook_annotation: - dependency: "direct main" - description: - name: widgetbook_annotation - sha256: "1f12e090865200191ab6b79b7ed4b108a191bf5de3140f92917c8c75e7e3f916" - url: "https://pub.dev" - source: hosted - version: "2.1.0" - widgetbook_generator: - dependency: "direct dev" - description: - name: widgetbook_generator - sha256: b6d00fef564fa5c0b98e26a72a27d52d03400c36409e56be25c0f09cfee3307b - url: "https://pub.dev" - source: hosted - version: "2.4.1" - widgetbook_models: - dependency: transitive - description: - name: widgetbook_models - sha256: "40899314ab0cce1a52b189ee12b79138ba59f445229f850fb326f579c8f63045" - url: "https://pub.dev" - source: hosted - version: "0.0.7" - win32: - dependency: transitive - description: - name: win32 - sha256: c9ebe7ee4ab0c2194e65d3a07d8c54c5d00bb001b76081c4a04cdb8448b59e46 - url: "https://pub.dev" - source: hosted - version: "3.1.3" - xdg_directories: - dependency: transitive - description: - name: xdg_directories - sha256: ee1505df1426458f7f60aac270645098d318a8b4766d85fde75f76f2e21807d1 - url: "https://pub.dev" - source: hosted - version: "1.0.0" - xml: - dependency: transitive - description: - name: xml - sha256: ac0e3f4bf00ba2708c33fbabbbe766300e509f8c82dbd4ab6525039813f7e2fb - url: "https://pub.dev" - source: hosted - version: "6.1.0" - yaml: - dependency: transitive - description: - name: yaml - sha256: "23812a9b125b48d4007117254bca50abb6c712352927eece9e155207b1db2370" - url: "https://pub.dev" - source: hosted - version: "3.1.1" -sdks: - dart: ">=2.18.6 <3.0.0" - flutter: ">=3.3.0" From 783b26ee1811f2e3d8c51ac2fc45af95558cda05 Mon Sep 17 00:00:00 2001 From: Isaac Obella Date: Mon, 6 Mar 2023 10:07:30 +0300 Subject: [PATCH 4/8] core(application): Migrate freezed to equatable orr plain classes Signed-off-by: Isaac Obella --- lib/application/auth/auth_bloc.dart | 66 ++++++------ lib/application/auth/auth_event.dart | 66 +++++++++++- lib/application/auth/auth_state.dart | 102 +++++++++++++++++- .../contact_form/contact_form_bloc.dart | 28 ++--- .../contact_form/contact_form_event.dart | 14 ++- .../contact_form/contact_form_state.dart | 29 ++++- .../crowdaction_details_bloc.dart | 32 +++--- .../crowdaction_details_event.dart | 17 ++- .../crowdaction_details_state.dart | 34 +++++- .../crowdaction_getter_bloc.dart | 64 +++++------ .../crowdaction_getter_event.dart | 23 +++- .../crowdaction_getter_state.dart | 35 +++++- .../crowdaction_participants_bloc.dart | 62 +++++------ .../crowdaction_participants_event.dart | 24 ++++- .../crowdaction_participants_state.dart | 35 +++++- .../crowdaction/spotlight/spotlight_bloc.dart | 10 +- .../spotlight/spotlight_event.dart | 9 +- .../spotlight/spotlight_state.dart | 35 +++++- .../participation/participation_bloc.dart | 54 +++++----- .../participation/participation_event.dart | 31 +++++- .../participation/participation_state.dart | 25 ++++- .../top_participants_bloc.dart | 23 ++-- .../top_participants_event.dart | 14 ++- .../top_participants_state.dart | 29 ++++- .../build_information_bloc.dart | 15 ++- .../build_information_event.dart | 9 +- .../build_information_state.dart | 21 +++- lib/application/user/avatar/avatar_bloc.dart | 26 ++--- lib/application/user/avatar/avatar_event.dart | 21 +++- lib/application/user/avatar/avatar_state.dart | 21 +++- lib/application/username/username_bloc.dart | 32 +++--- lib/application/username/username_event.dart | 15 ++- lib/application/username/username_state.dart | 28 ++++- 33 files changed, 781 insertions(+), 268 deletions(-) diff --git a/lib/application/auth/auth_bloc.dart b/lib/application/auth/auth_bloc.dart index fb746907..595d448a 100644 --- a/lib/application/auth/auth_bloc.dart +++ b/lib/application/auth/auth_bloc.dart @@ -3,7 +3,7 @@ import 'dart:io'; import 'package:bloc/bloc.dart'; import 'package:dartz/dartz.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; import 'package:injectable/injectable.dart'; import '../../domain/auth/auth_failures.dart'; @@ -13,7 +13,6 @@ import '../../domain/user/i_avatar_repository.dart'; import '../../domain/user/i_user_repository.dart'; import '../../domain/user/user.dart'; -part 'auth_bloc.freezed.dart'; part 'auth_event.dart'; part 'auth_state.dart'; @@ -34,21 +33,25 @@ class AuthBloc extends Bloc { ) : super(const AuthState.initial()) { on( (event, emit) async { - await event.map( - initial: (event) async => await _mapObserveUserToState(emit, event), - verifyPhone: (event) async => - await _mapVerifyPhoneToState(emit, event), - signInWithPhone: (event) async => - await _mapSignInWithPhoneToState(emit, event), - updated: (event) async => await _mapUpdatedToState(emit, event), - reset: (event) async => await _mapResetToState(emit, event), - authCheckRequested: (event) async => - await _mapAuthCheckRequestToState(emit, event), - signedOut: (event) async => await _mapSignOutToState(emit, event), - updateProfilePhoto: (event) async => - await _mapUpdateProfilePhotoToState(emit, event), - resendCode: (event) async => await _mapResendCodeToState(emit, event), - ); + if (event is _InitialEvent) { + await _mapObserveUserToState(emit, event); + } else if (event is _VerifyPhone) { + await _mapVerifyPhoneToState(emit, event); + } else if (event is _SignInWithPhone) { + await _mapSignInWithPhoneToState(emit, event); + } else if (event is _Updated) { + await _mapUpdatedToState(emit, event); + } else if (event is _Reset) { + await _mapResetToState(emit, event); + } else if (event is _AuthCheckRequested) { + await _mapAuthCheckRequestToState(emit, event); + } else if (event is _SignedOut) { + await _mapSignOutToState(emit, event); + } else if (event is _UpdateProfilePhoto) { + await _mapUpdateProfilePhotoToState(emit, event); + } else if (event is _ResendCode) { + await _mapResendCodeToState(emit, event); + } }, ); } @@ -135,22 +138,19 @@ class AuthBloc extends Bloc { event.failureOrCredential.fold( (failure) => AuthState.authError(failure), (r) { - return r.map( - codeSent: (event) { - _credential = event.credential; - return const AuthState.smsCodeSent(); - }, - codeRetrievalTimedOut: (event) { - _credential = event.credential; - return const AuthState.codeRetrievalTimedOut(); - }, - verificationCompleted: (event) { - _credential = event.credential; - return AuthState.verificationCompleted( - _credential?.smsCode ?? '', - ); - }, - ); + _credential = r.credential; + + if (r is _SmsCodeSent) { + return const AuthState.smsCodeSent(); + } else if (r is _CodeRetrievalTimedOut) { + return const AuthState.codeRetrievalTimedOut(); + } else if (r is _VerificationCompleted) { + return AuthState.verificationCompleted( + _credential?.smsCode ?? '', + ); + } + + throw Exception(); }, ), ); diff --git a/lib/application/auth/auth_event.dart b/lib/application/auth/auth_event.dart index ed9a3f2a..0bcde3dc 100644 --- a/lib/application/auth/auth_event.dart +++ b/lib/application/auth/auth_event.dart @@ -1,7 +1,8 @@ part of 'auth_bloc.dart'; -@freezed -class AuthEvent with _$AuthEvent { +abstract class AuthEvent extends Equatable { + const AuthEvent(); + const factory AuthEvent.initial() = _InitialEvent; const factory AuthEvent.verifyPhone(String phoneNumber) = _VerifyPhone; @@ -23,4 +24,65 @@ class AuthEvent with _$AuthEvent { /// Sign out const factory AuthEvent.signedOut() = _SignedOut; + + @override + List get props => []; +} + +class _InitialEvent extends AuthEvent { + const _InitialEvent(); +} + +class _VerifyPhone extends AuthEvent { + final String phoneNumber; + + const _VerifyPhone(this.phoneNumber); + + @override + List get props => [phoneNumber]; +} + +class _Updated extends AuthEvent { + final Either failureOrCredential; + + const _Updated(this.failureOrCredential); + + @override + List get props => [failureOrCredential]; +} + +class _SignInWithPhone extends AuthEvent { + final String smsCode; + + const _SignInWithPhone(this.smsCode); + + @override + List get props => [smsCode]; +} + +class _ResendCode extends AuthEvent { + const _ResendCode(); +} + +class _UpdateProfilePhoto extends AuthEvent { + final File photo; + + const _UpdateProfilePhoto(this.photo); + + @override + List get props => [photo]; +} + +class _Reset extends AuthEvent { + const _Reset(); +} + +/// Request for current auth state +class _AuthCheckRequested extends AuthEvent { + const _AuthCheckRequested(); +} + +/// Sign out +class _SignedOut extends AuthEvent { + const _SignedOut(); } diff --git a/lib/application/auth/auth_state.dart b/lib/application/auth/auth_state.dart index bc934d12..a041e0d0 100644 --- a/lib/application/auth/auth_state.dart +++ b/lib/application/auth/auth_state.dart @@ -1,7 +1,8 @@ part of 'auth_bloc.dart'; -@freezed -class AuthState with _$AuthState { +abstract class AuthState extends Equatable { + const AuthState(); + /// No authentication ongoing const factory AuthState.initial() = _Initial; @@ -43,4 +44,101 @@ class AuthState with _$AuthState { const factory AuthState.authenticated(User user) = _Authenticated; const factory AuthState.unauthenticated() = _UnAuthenticated; + + @override + List get props => []; +} + +/// No authentication ongoing +class _Initial extends AuthState { + const _Initial(); +} + +/// Authentication has been started, waiting for backend to respond +class SigningInUser extends AuthState { + const SigningInUser(); +} + +/// SMS Code has been sent, wait for autocomplete or user to enter code +class _SmsCodeSent extends AuthState { + const _SmsCodeSent(); +} + +/// SMS Code verification has been completed, sign in user with credentials +class _VerificationCompleted extends AuthState { + final String smsCode; + + const _VerificationCompleted(this.smsCode); + + @override + List get props => [smsCode]; +} + +/// SMS Code autocomplete has timed out, allow user to resend code +class _CodeRetrievalTimedOut extends AuthState { + const _CodeRetrievalTimedOut(); +} + +/// An error has occurred during authentication +class _AuthError extends AuthState { + final AuthFailure failure; + + const _AuthError(this.failure); + + @override + List get props => [failure]; +} + +/// Authentication may be completed with verification code +class AwaitingVerification extends AuthState { + const AwaitingVerification(); +} + +/// Authentication will be completed, waiting for backend to respond to verification +class _Verifying extends AuthState { + final String smsCode; + + const _Verifying(this.smsCode); + + @override + List get props => [smsCode]; +} + +/// Authentication has been completed +class _LoggedIn extends AuthState { + final bool isNewUser; + + const _LoggedIn({required this.isNewUser}); + + @override + List get props => [isNewUser]; +} + +/// Code is being resent +class AwaitingCodeResend extends AuthState { + const AwaitingCodeResend(); +} + +/// Profile Photo is being updated +class AwaitingProfilePhotoUpdate extends AuthState { + const AwaitingProfilePhotoUpdate(); +} + +/// Profile photo update done +class _ProfilePhotoUpdateDone extends AuthState { + const _ProfilePhotoUpdateDone(); +} + +/// Splash Auth states +class _Authenticated extends AuthState { + final User user; + + const _Authenticated(this.user); + + @override + List get props => [user]; +} + +class _UnAuthenticated extends AuthState { + const _UnAuthenticated(); } diff --git a/lib/application/contact_form/contact_form_bloc.dart b/lib/application/contact_form/contact_form_bloc.dart index 261217da..230f41e7 100644 --- a/lib/application/contact_form/contact_form_bloc.dart +++ b/lib/application/contact_form/contact_form_bloc.dart @@ -1,11 +1,11 @@ import 'package:bloc/bloc.dart'; +import 'package:equatable/equatable.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:injectable/injectable.dart'; import '../../domain/contact_form/i_contact_form_repository.dart'; import '../../infrastructure/contact_form/contact_form_dto.dart'; -part 'contact_form_bloc.freezed.dart'; part 'contact_form_event.dart'; part 'contact_form_state.dart'; @@ -13,23 +13,23 @@ part 'contact_form_state.dart'; class ContactFormBloc extends Bloc { final IContactRepository _contactFormApi; - ContactFormBloc(this._contactFormApi) : super(const _Initial()) { + ContactFormBloc(this._contactFormApi) + : super(const ContactFormState.initial()) { on( (event, emit) async { - await event.when( - submitted: (event) async { - emit(const ContactFormState.submitting()); + if (event is _Submitted) { + emit(const ContactFormState.submitting()); - final unitOrFailure = - await _contactFormApi.sendContactFormContents(event); + final unitOrFailure = await _contactFormApi.sendContactFormContents( + event.contents, + ); - if (unitOrFailure.isRight()) { - emit(const ContactFormState.submissionSuccessful()); - } else { - emit(const ContactFormState.failed('Submission failed')); - } - }, - ); + if (unitOrFailure.isRight()) { + emit(const ContactFormState.submissionSuccessful()); + } else { + emit(const ContactFormState.failed('Submission failed')); + } + } }, ); } diff --git a/lib/application/contact_form/contact_form_event.dart b/lib/application/contact_form/contact_form_event.dart index 700c6d00..ec314925 100644 --- a/lib/application/contact_form/contact_form_event.dart +++ b/lib/application/contact_form/contact_form_event.dart @@ -1,7 +1,17 @@ part of 'contact_form_bloc.dart'; -@freezed -class ContactFormEvent with _$ContactFormEvent { +abstract class ContactFormEvent extends Equatable { + final ContactFormDto contents; + + const ContactFormEvent(this.contents); + const factory ContactFormEvent.submitted(ContactFormDto contents) = _Submitted; + + @override + List get props => [contents]; +} + +class _Submitted extends ContactFormEvent { + const _Submitted(super.contents); } diff --git a/lib/application/contact_form/contact_form_state.dart b/lib/application/contact_form/contact_form_state.dart index fe3200cd..d196b82a 100644 --- a/lib/application/contact_form/contact_form_state.dart +++ b/lib/application/contact_form/contact_form_state.dart @@ -1,7 +1,8 @@ part of 'contact_form_bloc.dart'; -@freezed -class ContactFormState with _$ContactFormState { +abstract class ContactFormState extends Equatable { + const ContactFormState(); + const factory ContactFormState.initial() = _Initial; const factory ContactFormState.submitting() = Submitting; @@ -9,4 +10,28 @@ class ContactFormState with _$ContactFormState { const factory ContactFormState.submissionSuccessful() = _SubmissionSuccessful; const factory ContactFormState.failed(String failureMessage) = _Failed; + + @override + List get props => []; +} + +class _Initial extends ContactFormState { + const _Initial(); +} + +class Submitting extends ContactFormState { + const Submitting(); +} + +class _SubmissionSuccessful extends ContactFormState { + const _SubmissionSuccessful(); +} + +class _Failed extends ContactFormState { + final String failureMessage; + + const _Failed(this.failureMessage); + + @override + List get props => [failureMessage]; } diff --git a/lib/application/crowdaction/crowdaction_details/crowdaction_details_bloc.dart b/lib/application/crowdaction/crowdaction_details/crowdaction_details_bloc.dart index 99251ee6..3c15b4cc 100644 --- a/lib/application/crowdaction/crowdaction_details/crowdaction_details_bloc.dart +++ b/lib/application/crowdaction/crowdaction_details/crowdaction_details_bloc.dart @@ -1,12 +1,11 @@ import 'package:bloc/bloc.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; import 'package:injectable/injectable.dart'; import '../../../domain/crowdaction/crowdaction.dart'; import '../../../domain/crowdaction/crowdaction_failures.dart'; import '../../../domain/crowdaction/i_crowdaction_repository.dart'; -part 'crowdaction_details_bloc.freezed.dart'; part 'crowdaction_details_event.dart'; part 'crowdaction_details_state.dart'; @@ -15,23 +14,22 @@ class CrowdActionDetailsBloc extends Bloc { final ICrowdActionRepository crowdActionRepository; - CrowdActionDetailsBloc(this.crowdActionRepository) : super(const _Initial()) { + CrowdActionDetailsBloc(this.crowdActionRepository) + : super(const CrowdActionDetailsState.initial()) { on((event, emit) async { - await event.when( - fetchCrowdAction: (crowdActionId) async { - final crowdActionOrFailure = - await crowdActionRepository.getCrowdAction(crowdActionId); + if (event is _FetchCrowdAction) { + final crowdActionOrFailure = + await crowdActionRepository.getCrowdAction(event.id); - crowdActionOrFailure.fold( - (failure) { - emit(CrowdActionDetailsState.loadFailure(failure)); - }, - (crowdAction) { - emit(CrowdActionDetailsState.loadSuccess(crowdAction)); - }, - ); - }, - ); + crowdActionOrFailure.fold( + (failure) { + emit(CrowdActionDetailsState.loadFailure(failure)); + }, + (crowdAction) { + emit(CrowdActionDetailsState.loadSuccess(crowdAction)); + }, + ); + } }); } } diff --git a/lib/application/crowdaction/crowdaction_details/crowdaction_details_event.dart b/lib/application/crowdaction/crowdaction_details/crowdaction_details_event.dart index ac5cb2c1..3e8db0e8 100644 --- a/lib/application/crowdaction/crowdaction_details/crowdaction_details_event.dart +++ b/lib/application/crowdaction/crowdaction_details/crowdaction_details_event.dart @@ -1,7 +1,20 @@ part of 'crowdaction_details_bloc.dart'; -@freezed -class CrowdActionDetailsEvent with _$CrowdActionDetailsEvent { +abstract class CrowdActionDetailsEvent extends Equatable { + const CrowdActionDetailsEvent(); + const factory CrowdActionDetailsEvent.fetchCrowdAction({required String id}) = _FetchCrowdAction; + + @override + List get props => []; +} + +class _FetchCrowdAction extends CrowdActionDetailsEvent { + final String id; + + const _FetchCrowdAction({required this.id}); + + @override + List get props => [id]; } diff --git a/lib/application/crowdaction/crowdaction_details/crowdaction_details_state.dart b/lib/application/crowdaction/crowdaction_details/crowdaction_details_state.dart index d047d976..56130c28 100644 --- a/lib/application/crowdaction/crowdaction_details/crowdaction_details_state.dart +++ b/lib/application/crowdaction/crowdaction_details/crowdaction_details_state.dart @@ -1,7 +1,8 @@ part of 'crowdaction_details_bloc.dart'; -@freezed -class CrowdActionDetailsState with _$CrowdActionDetailsState { +abstract class CrowdActionDetailsState extends Equatable { + const CrowdActionDetailsState(); + const factory CrowdActionDetailsState.initial() = _Initial; const factory CrowdActionDetailsState.loadInProgress() = _LoadInProgress; const factory CrowdActionDetailsState.loadSuccess(CrowdAction crowdAction) = @@ -9,4 +10,33 @@ class CrowdActionDetailsState with _$CrowdActionDetailsState { const factory CrowdActionDetailsState.loadFailure( CrowdActionFailure crowdactionFailure, ) = _LoadFailure; + + @override + List get props => []; +} + +class _Initial extends CrowdActionDetailsState { + const _Initial(); +} + +class _LoadInProgress extends CrowdActionDetailsState { + const _LoadInProgress(); +} + +class _LoadSuccess extends CrowdActionDetailsState { + final CrowdAction crowdAction; + + const _LoadSuccess(this.crowdAction); + + @override + List get props => [crowdAction]; +} + +class _LoadFailure extends CrowdActionDetailsState { + final CrowdActionFailure crowdactionFailure; + + const _LoadFailure(this.crowdactionFailure); + + @override + List get props => [crowdactionFailure]; } diff --git a/lib/application/crowdaction/crowdaction_getter/crowdaction_getter_bloc.dart b/lib/application/crowdaction/crowdaction_getter/crowdaction_getter_bloc.dart index ce015e84..df670a57 100644 --- a/lib/application/crowdaction/crowdaction_getter/crowdaction_getter_bloc.dart +++ b/lib/application/crowdaction/crowdaction_getter/crowdaction_getter_bloc.dart @@ -1,5 +1,5 @@ import 'package:bloc/bloc.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; import 'package:injectable/injectable.dart'; import '../../../domain/core/page_info.dart'; @@ -7,7 +7,6 @@ import '../../../domain/crowdaction/crowdaction.dart'; import '../../../domain/crowdaction/crowdaction_failures.dart'; import '../../../domain/crowdaction/i_crowdaction_repository.dart'; -part 'crowdaction_getter_bloc.freezed.dart'; part 'crowdaction_getter_event.dart'; part 'crowdaction_getter_state.dart'; @@ -19,44 +18,39 @@ class CrowdActionGetterBloc CrowdActionGetterBloc(this._crowdActionRepository) : super(const CrowdActionGetterState.initial()) { on((event, emit) async { - await event.map( - init: (_) async { - emit(const CrowdActionGetterState.loading()); - emit(const CrowdActionGetterState.initial()); - }, - getCrowdActions: (event) async { - emit(const CrowdActionGetterState.loading()); + if (event is _Init) { + emit(const CrowdActionGetterState.loading()); + emit(const CrowdActionGetterState.initial()); + } else if (event is _GetCrowdActions) { + emit(const CrowdActionGetterState.loading()); - final paginatedCrowdActionsOrFailure = - await _crowdActionRepository.getCrowdActions( - pageNumber: event.pageNumber, - ); + final paginatedCrowdActionsOrFailure = + await _crowdActionRepository.getCrowdActions( + pageNumber: event.pageNumber, + ); - paginatedCrowdActionsOrFailure.fold( + paginatedCrowdActionsOrFailure.fold( (failure) => emit( - CrowdActionGetterState.failure(failure), - ), - (paginatedCrowdActions) { - if (paginatedCrowdActions.pageInfo.page == - paginatedCrowdActions.pageInfo.totalPages) { - emit( - CrowdActionGetterState.finished( - crowdActions: paginatedCrowdActions.crowdActions, - ), - ); - return; - } + CrowdActionGetterState.failure(failure), + ), (paginatedCrowdActions) { + if (paginatedCrowdActions.pageInfo.page == + paginatedCrowdActions.pageInfo.totalPages) { + emit( + CrowdActionGetterState.finished( + crowdActions: paginatedCrowdActions.crowdActions, + ), + ); + return; + } - emit( - CrowdActionGetterState.success( - crowdActions: paginatedCrowdActions.crowdActions, - pageInfo: paginatedCrowdActions.pageInfo, - ), - ); - }, + emit( + CrowdActionGetterState.success( + crowdActions: paginatedCrowdActions.crowdActions, + pageInfo: paginatedCrowdActions.pageInfo, + ), ); - }, - ); + }); + } }); } } diff --git a/lib/application/crowdaction/crowdaction_getter/crowdaction_getter_event.dart b/lib/application/crowdaction/crowdaction_getter/crowdaction_getter_event.dart index dfc64464..39406c7a 100644 --- a/lib/application/crowdaction/crowdaction_getter/crowdaction_getter_event.dart +++ b/lib/application/crowdaction/crowdaction_getter/crowdaction_getter_event.dart @@ -1,9 +1,26 @@ part of 'crowdaction_getter_bloc.dart'; -@freezed -class CrowdActionGetterEvent with _$CrowdActionGetterEvent { +abstract class CrowdActionGetterEvent extends Equatable { + const CrowdActionGetterEvent(); + const factory CrowdActionGetterEvent.init() = _Init; const factory CrowdActionGetterEvent.getCrowdActions({ - @Default(1) int pageNumber, + int pageNumber, }) = _GetCrowdActions; + + @override + List get props => []; +} + +class _Init extends CrowdActionGetterEvent { + const _Init(); +} + +class _GetCrowdActions extends CrowdActionGetterEvent { + final int pageNumber; + + const _GetCrowdActions({this.pageNumber = 1}); + + @override + List get props => [pageNumber]; } diff --git a/lib/application/crowdaction/crowdaction_getter/crowdaction_getter_state.dart b/lib/application/crowdaction/crowdaction_getter/crowdaction_getter_state.dart index 3818019d..07ec4b13 100644 --- a/lib/application/crowdaction/crowdaction_getter/crowdaction_getter_state.dart +++ b/lib/application/crowdaction/crowdaction_getter/crowdaction_getter_state.dart @@ -1,7 +1,8 @@ part of 'crowdaction_getter_bloc.dart'; -@freezed -class CrowdActionGetterState with _$CrowdActionGetterState { +abstract class CrowdActionGetterState extends Equatable { + const CrowdActionGetterState(); + const factory CrowdActionGetterState.initial() = _Initial; const factory CrowdActionGetterState.loading() = _Loading; @@ -16,4 +17,34 @@ class CrowdActionGetterState with _$CrowdActionGetterState { }) = _Finished; const factory CrowdActionGetterState.failure(CrowdActionFailure failure) = _Failure; + + @override + List get props => []; +} + +class _Initial extends CrowdActionGetterState { + const _Initial(); +} + +class _Loading extends CrowdActionGetterState { + const _Loading(); +} + +class _Success extends CrowdActionGetterState { + final List crowdActions; + final PageInfo pageInfo; + + const _Success({required this.crowdActions, required this.pageInfo}); +} + +class _Finished extends CrowdActionGetterState { + final List crowdActions; + + const _Finished({required this.crowdActions}); +} + +class _Failure extends CrowdActionGetterState { + final CrowdActionFailure failure; + + const _Failure(this.failure); } diff --git a/lib/application/crowdaction/crowdaction_participants/crowdaction_participants_bloc.dart b/lib/application/crowdaction/crowdaction_participants/crowdaction_participants_bloc.dart index 22c25050..a136a175 100644 --- a/lib/application/crowdaction/crowdaction_participants/crowdaction_participants_bloc.dart +++ b/lib/application/crowdaction/crowdaction_participants/crowdaction_participants_bloc.dart @@ -1,5 +1,5 @@ import 'package:bloc/bloc.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; import 'package:injectable/injectable.dart'; import '../../../domain/core/page_info.dart'; @@ -7,7 +7,6 @@ import '../../../domain/participation/i_participation_repository.dart'; import '../../../domain/participation/participation.dart'; import '../../../domain/participation/participation_failures.dart'; -part 'crowdaction_participants_bloc.freezed.dart'; part 'crowdaction_participants_event.dart'; part 'crowdaction_participants_state.dart'; @@ -19,43 +18,40 @@ class CrowdActionParticipantsBloc CrowdActionParticipantsBloc(this.participationRepository) : super(const CrowdActionParticipantsState.initial()) { on((event, emit) async { - await event.when( - init: () async { - emit(const CrowdActionParticipantsState.loading()); - emit(const CrowdActionParticipantsState.initial()); - }, - getParticipants: (crowdActionId, pageNumber) async { - emit(const CrowdActionParticipantsState.loading()); + if (event is _Init) { + emit(const CrowdActionParticipantsState.loading()); + emit(const CrowdActionParticipantsState.initial()); + } else if (event is _GetParticipants) { + emit(const CrowdActionParticipantsState.loading()); - final paginatedParticipationsOrFailure = - await participationRepository.getParticipations( - crowdActionId: crowdActionId, - pageNumber: pageNumber, - ); - - paginatedParticipationsOrFailure.fold( - (failure) => emit(CrowdActionParticipantsState.failure(failure)), - (paginatedParticipants) { - if (paginatedParticipants.pageInfo.page == - paginatedParticipants.pageInfo.totalPages) { - emit( - CrowdActionParticipantsState.finished( - participants: paginatedParticipants.participations, - ), - ); - return; - } + final paginatedParticipationsOrFailure = + await participationRepository.getParticipations( + crowdActionId: event.crowdActionId, + pageNumber: event.pageNumber, + ); + paginatedParticipationsOrFailure.fold( + (failure) => emit(CrowdActionParticipantsState.failure(failure)), + (paginatedParticipants) { + if (paginatedParticipants.pageInfo.page == + paginatedParticipants.pageInfo.totalPages) { emit( - CrowdActionParticipantsState.success( + CrowdActionParticipantsState.finished( participants: paginatedParticipants.participations, - pageInfo: paginatedParticipants.pageInfo, ), ); - }, - ); - }, - ); + return; + } + + emit( + CrowdActionParticipantsState.success( + participants: paginatedParticipants.participations, + pageInfo: paginatedParticipants.pageInfo, + ), + ); + }, + ); + } }); } } diff --git a/lib/application/crowdaction/crowdaction_participants/crowdaction_participants_event.dart b/lib/application/crowdaction/crowdaction_participants/crowdaction_participants_event.dart index 911cfc87..748f31f2 100644 --- a/lib/application/crowdaction/crowdaction_participants/crowdaction_participants_event.dart +++ b/lib/application/crowdaction/crowdaction_participants/crowdaction_participants_event.dart @@ -1,10 +1,28 @@ part of 'crowdaction_participants_bloc.dart'; -@freezed -class CrowdActionParticipantsEvent with _$CrowdActionParticipantsEvent { +abstract class CrowdActionParticipantsEvent extends Equatable { + const CrowdActionParticipantsEvent(); + const factory CrowdActionParticipantsEvent.init() = _Init; const factory CrowdActionParticipantsEvent.getParticipants({ required String crowdActionId, - @Default(1) int pageNumber, + int pageNumber, }) = _GetParticipants; + + @override + List get props => []; +} + +class _Init extends CrowdActionParticipantsEvent { + const _Init(); +} + +class _GetParticipants extends CrowdActionParticipantsEvent { + final String crowdActionId; + final int pageNumber; + + const _GetParticipants({required this.crowdActionId, this.pageNumber = 1}); + + @override + List get props => [crowdActionId, pageNumber]; } diff --git a/lib/application/crowdaction/crowdaction_participants/crowdaction_participants_state.dart b/lib/application/crowdaction/crowdaction_participants/crowdaction_participants_state.dart index 98885dea..b83e0407 100644 --- a/lib/application/crowdaction/crowdaction_participants/crowdaction_participants_state.dart +++ b/lib/application/crowdaction/crowdaction_participants/crowdaction_participants_state.dart @@ -1,7 +1,8 @@ part of 'crowdaction_participants_bloc.dart'; -@freezed -class CrowdActionParticipantsState with _$CrowdActionParticipantsState { +abstract class CrowdActionParticipantsState extends Equatable { + const CrowdActionParticipantsState(); + const factory CrowdActionParticipantsState.initial() = _Initial; const factory CrowdActionParticipantsState.loading() = _Loading; const factory CrowdActionParticipantsState.success({ @@ -14,4 +15,34 @@ class CrowdActionParticipantsState with _$CrowdActionParticipantsState { const factory CrowdActionParticipantsState.failure( ParticipationFailure failure, ) = _Failure; + + @override + List get props => []; +} + +class _Initial extends CrowdActionParticipantsState { + const _Initial(); +} + +class _Loading extends CrowdActionParticipantsState { + const _Loading(); +} + +class _Success extends CrowdActionParticipantsState { + final List participants; + final PageInfo pageInfo; + + const _Success({required this.participants, required this.pageInfo}); +} + +class _Finished extends CrowdActionParticipantsState { + final List participants; + + const _Finished({required this.participants}); +} + +class _Failure extends CrowdActionParticipantsState { + final ParticipationFailure failure; + + const _Failure(this.failure); } diff --git a/lib/application/crowdaction/spotlight/spotlight_bloc.dart b/lib/application/crowdaction/spotlight/spotlight_bloc.dart index 7bd71a64..2c691a53 100644 --- a/lib/application/crowdaction/spotlight/spotlight_bloc.dart +++ b/lib/application/crowdaction/spotlight/spotlight_bloc.dart @@ -1,14 +1,13 @@ import 'dart:async'; import 'package:bloc/bloc.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; import 'package:injectable/injectable.dart'; import '../../../domain/crowdaction/crowdaction.dart'; import '../../../domain/crowdaction/crowdaction_failures.dart'; import '../../../domain/crowdaction/i_crowdaction_repository.dart'; -part 'spotlight_bloc.freezed.dart'; part 'spotlight_event.dart'; part 'spotlight_state.dart'; @@ -20,10 +19,9 @@ class SpotlightBloc extends Bloc { : super(const SpotlightState.initial()) { on( (event, emit) async { - await event.map( - getSpotLightCrowdActions: (event) async => - await _mapGetSpotLightCrowdActionsToState(emit, event), - ); + if (event is _GetSpotlightCrowdActions) { + await _mapGetSpotLightCrowdActionsToState(emit, event); + } }, ); } diff --git a/lib/application/crowdaction/spotlight/spotlight_event.dart b/lib/application/crowdaction/spotlight/spotlight_event.dart index 768c09d3..7034dd66 100644 --- a/lib/application/crowdaction/spotlight/spotlight_event.dart +++ b/lib/application/crowdaction/spotlight/spotlight_event.dart @@ -1,7 +1,12 @@ part of 'spotlight_bloc.dart'; -@freezed -class SpotlightEvent with _$SpotlightEvent { +abstract class SpotlightEvent { + const SpotlightEvent(); + const factory SpotlightEvent.getSpotLightCrowdActions() = _GetSpotlightCrowdActions; } + +class _GetSpotlightCrowdActions extends SpotlightEvent { + const _GetSpotlightCrowdActions(); +} diff --git a/lib/application/crowdaction/spotlight/spotlight_state.dart b/lib/application/crowdaction/spotlight/spotlight_state.dart index 72f333dc..e04c105b 100644 --- a/lib/application/crowdaction/spotlight/spotlight_state.dart +++ b/lib/application/crowdaction/spotlight/spotlight_state.dart @@ -1,7 +1,8 @@ part of 'spotlight_bloc.dart'; -@freezed -class SpotlightState with _$SpotlightState { +abstract class SpotlightState extends Equatable { + const SpotlightState(); + const factory SpotlightState.initial() = _Initial; // Spot light crowd actions @@ -15,4 +16,34 @@ class SpotlightState with _$SpotlightState { const factory SpotlightState.spotLightCrowdActions( List crowdActions, ) = _SpotLightCrowdActions; + + @override + List get props => []; +} + +class _Initial extends SpotlightState { + const _Initial(); +} + +// Spot light crowd actions +class _FetchingSpotLightCrowdActions extends SpotlightState { + const _FetchingSpotLightCrowdActions(); +} + +class _SpotLightCrowdActionsError extends SpotlightState { + final CrowdActionFailure error; + + const _SpotLightCrowdActionsError(this.error); + + @override + List get props => [error]; +} + +class _SpotLightCrowdActions extends SpotlightState { + final List crowdActions; + + const _SpotLightCrowdActions(this.crowdActions); + + @override + List get props => [crowdActions]; } diff --git a/lib/application/participation/participation_bloc.dart b/lib/application/participation/participation_bloc.dart index c9befcf7..61ea53ee 100644 --- a/lib/application/participation/participation_bloc.dart +++ b/lib/application/participation/participation_bloc.dart @@ -1,11 +1,10 @@ import 'package:bloc/bloc.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; import 'package:injectable/injectable.dart'; import '../../domain/participation/i_participation_repository.dart'; import '../../domain/participation/participation.dart'; -part 'participation_bloc.freezed.dart'; part 'participation_event.dart'; part 'participation_state.dart'; @@ -15,37 +14,32 @@ class ParticipationBloc extends Bloc { ParticipationBloc(this.participationRepository) : super(const _Loading()) { on((event, emit) async { - await event.when( - getParticipation: (crowdActionId) async { - final failureOrParticipation = await participationRepository - .getParticipation(crowdActionId: crowdActionId); + if (event is _GetParticipation) { + final failureOrParticipation = await participationRepository + .getParticipation(crowdActionId: event.crowdActionId); - emit( - failureOrParticipation.fold( - (failure) => const ParticipationState.notParticipating(), - (participation) => - ParticipationState.participating(participation), - ), - ); - }, - checkIn: () { - // TODO: Implement once the backend has implemented it - }, - toggleParticipation: (crowdActionId, commitments) async { - emit(const ParticipationState.loading()); + emit( + failureOrParticipation.fold( + (failure) => const ParticipationState.notParticipating(), + (participation) => ParticipationState.participating(participation), + ), + ); + } else if (event is _CheckIn) { + // TODO: Implement once the backend has implemented it + } else if (event is _ToggleParticipation) { + emit(const ParticipationState.loading()); - await participationRepository.toggleParticipation( - crowdActionId: crowdActionId, - commitments: commitments, - ); + await participationRepository.toggleParticipation( + crowdActionId: event.crowdActionId, + commitments: event.commitments, + ); - add( - ParticipationEvent.getParticipation( - crowdActionId: crowdActionId, - ), - ); - }, - ); + add( + ParticipationEvent.getParticipation( + crowdActionId: event.crowdActionId, + ), + ); + } }); } } diff --git a/lib/application/participation/participation_event.dart b/lib/application/participation/participation_event.dart index 587341b2..ec1ae00a 100644 --- a/lib/application/participation/participation_event.dart +++ b/lib/application/participation/participation_event.dart @@ -1,7 +1,8 @@ part of 'participation_bloc.dart'; -@freezed -class ParticipationEvent with _$ParticipationEvent { +abstract class ParticipationEvent extends Equatable { + const ParticipationEvent(); + const factory ParticipationEvent.getParticipation({ required String crowdActionId, }) = _GetParticipation; @@ -10,4 +11,30 @@ class ParticipationEvent with _$ParticipationEvent { required String crowdActionId, List? commitments, }) = _ToggleParticipation; + + @override + List get props => []; +} + +class _GetParticipation extends ParticipationEvent { + final String crowdActionId; + + const _GetParticipation({required this.crowdActionId}); + + @override + List get props => [crowdActionId]; +} + +class _CheckIn extends ParticipationEvent { + const _CheckIn(); +} + +class _ToggleParticipation extends ParticipationEvent { + final String crowdActionId; + final List? commitments; + + const _ToggleParticipation({required this.crowdActionId, this.commitments}); + + @override + List get props => [crowdActionId, commitments]; } diff --git a/lib/application/participation/participation_state.dart b/lib/application/participation/participation_state.dart index 3564cde9..98f7c2b2 100644 --- a/lib/application/participation/participation_state.dart +++ b/lib/application/participation/participation_state.dart @@ -1,9 +1,30 @@ part of 'participation_bloc.dart'; -@freezed -class ParticipationState with _$ParticipationState { +abstract class ParticipationState extends Equatable { + const ParticipationState(); + const factory ParticipationState.loading() = _Loading; const factory ParticipationState.participating(Participation participation) = _Participating; const factory ParticipationState.notParticipating() = _NotParticipating; + + @override + List get props => []; +} + +class _Loading extends ParticipationState { + const _Loading(); +} + +class _Participating extends ParticipationState { + final Participation participation; + + const _Participating(this.participation); + + @override + List get props => [participation]; +} + +class _NotParticipating extends ParticipationState { + const _NotParticipating(); } diff --git a/lib/application/participation/top_participants/top_participants_bloc.dart b/lib/application/participation/top_participants/top_participants_bloc.dart index 03144750..31e5ad82 100644 --- a/lib/application/participation/top_participants/top_participants_bloc.dart +++ b/lib/application/participation/top_participants/top_participants_bloc.dart @@ -1,11 +1,10 @@ import 'package:bloc/bloc.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; import 'package:injectable/injectable.dart'; import '../../../domain/participation/i_participation_repository.dart'; import '../../../domain/participation/participation.dart'; -part 'top_participants_bloc.freezed.dart'; part 'top_participants_event.dart'; part 'top_participants_state.dart'; @@ -16,19 +15,17 @@ class TopParticipantsBloc TopParticipantsBloc(this._participationRepository) : super(const _Initial()) { on((event, emit) async { - await event.map( - fetchParticipants: (event) async { - emit(const TopParticipantsState.fetching()); + if (event is _FetchParticipants) { + emit(const TopParticipantsState.fetching()); - final participantsOrFailure = await _participationRepository - .getTopParticipants(crowdActionId: event.crowdActionId); + final participantsOrFailure = await _participationRepository + .getTopParticipants(crowdActionId: event.crowdActionId); - participantsOrFailure.fold( - (failure) => emit(const TopParticipantsState.failure()), - (participants) => emit(TopParticipantsState.fetched(participants)), - ); - }, - ); + participantsOrFailure.fold( + (failure) => emit(const TopParticipantsState.failure()), + (participants) => emit(TopParticipantsState.fetched(participants)), + ); + } }); } } diff --git a/lib/application/participation/top_participants/top_participants_event.dart b/lib/application/participation/top_participants/top_participants_event.dart index ba4bc387..5f36e894 100644 --- a/lib/application/participation/top_participants/top_participants_event.dart +++ b/lib/application/participation/top_participants/top_participants_event.dart @@ -1,8 +1,18 @@ part of 'top_participants_bloc.dart'; -@freezed -class TopParticipantsEvent with _$TopParticipantsEvent { +abstract class TopParticipantsEvent extends Equatable { + const TopParticipantsEvent(); + const factory TopParticipantsEvent.fetchParticipants({ required String crowdActionId, }) = _FetchParticipants; } + +class _FetchParticipants extends TopParticipantsEvent { + final String crowdActionId; + + const _FetchParticipants({required this.crowdActionId}); + + @override + List get props => throw UnimplementedError(); +} diff --git a/lib/application/participation/top_participants/top_participants_state.dart b/lib/application/participation/top_participants/top_participants_state.dart index 99061e0b..31f6f3f4 100644 --- a/lib/application/participation/top_participants/top_participants_state.dart +++ b/lib/application/participation/top_participants/top_participants_state.dart @@ -1,11 +1,36 @@ part of 'top_participants_bloc.dart'; -@freezed -class TopParticipantsState with _$TopParticipantsState { +abstract class TopParticipantsState extends Equatable { + const TopParticipantsState(); + const factory TopParticipantsState.initial() = _Initial; const factory TopParticipantsState.fetching() = _Fetching; const factory TopParticipantsState.fetched( List topParticipants, ) = _Fetched; const factory TopParticipantsState.failure() = _Failure; + + @override + List get props => []; +} + +class _Initial extends TopParticipantsState { + const _Initial(); +} + +class _Fetching extends TopParticipantsState { + const _Fetching(); +} + +class _Fetched extends TopParticipantsState { + final List topParticipants; + + const _Fetched(this.topParticipants); + + @override + List get props => [topParticipants]; +} + +class _Failure extends TopParticipantsState { + const _Failure(); } diff --git a/lib/application/settings/build_information/build_information_bloc.dart b/lib/application/settings/build_information/build_information_bloc.dart index c07dad77..f1c6e22e 100644 --- a/lib/application/settings/build_information/build_information_bloc.dart +++ b/lib/application/settings/build_information/build_information_bloc.dart @@ -1,11 +1,10 @@ import 'package:bloc/bloc.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; import 'package:injectable/injectable.dart'; import '../../../domain/core/i_settings_repository.dart'; import '../../../domain/settings/build_information.dart'; -part 'build_information_bloc.freezed.dart'; part 'build_information_event.dart'; part 'build_information_state.dart'; @@ -17,14 +16,12 @@ class BuildInformationBloc BuildInformationBloc(this._settingsRepository) : super(const BuildInformationState.loading()) { on((event, emit) async { - await event.when( - fetch: () async { - emit(const BuildInformationState.loading()); + if (event is _Fetch) { + emit(const BuildInformationState.loading()); - final buildInfo = await _settingsRepository.getBuildInformation(); - emit(BuildInformationState.fetched(buildInfo)); - }, - ); + final buildInfo = await _settingsRepository.getBuildInformation(); + emit(BuildInformationState.fetched(buildInfo)); + } }); } } diff --git a/lib/application/settings/build_information/build_information_event.dart b/lib/application/settings/build_information/build_information_event.dart index 86e752d1..9df9ce2c 100644 --- a/lib/application/settings/build_information/build_information_event.dart +++ b/lib/application/settings/build_information/build_information_event.dart @@ -1,6 +1,11 @@ part of 'build_information_bloc.dart'; -@freezed -class BuildInformationEvent with _$BuildInformationEvent { +abstract class BuildInformationEvent { + const BuildInformationEvent(); + const factory BuildInformationEvent.fetch() = _Fetch; } + +class _Fetch extends BuildInformationEvent { + const _Fetch(); +} diff --git a/lib/application/settings/build_information/build_information_state.dart b/lib/application/settings/build_information/build_information_state.dart index b033cd75..ecda4df2 100644 --- a/lib/application/settings/build_information/build_information_state.dart +++ b/lib/application/settings/build_information/build_information_state.dart @@ -1,8 +1,25 @@ part of 'build_information_bloc.dart'; -@freezed -class BuildInformationState with _$BuildInformationState { +abstract class BuildInformationState extends Equatable { + const BuildInformationState(); + const factory BuildInformationState.loading() = _Loading; const factory BuildInformationState.fetched(BuildInformation buildInfo) = _Fetched; + + @override + List get props => []; +} + +class _Loading extends BuildInformationState { + const _Loading(); +} + +class _Fetched extends BuildInformationState { + final BuildInformation buildInfo; + + const _Fetched(this.buildInfo); + + @override + List get props => [buildInfo]; } diff --git a/lib/application/user/avatar/avatar_bloc.dart b/lib/application/user/avatar/avatar_bloc.dart index ed4eb79a..f9aa236e 100644 --- a/lib/application/user/avatar/avatar_bloc.dart +++ b/lib/application/user/avatar/avatar_bloc.dart @@ -1,12 +1,11 @@ import 'dart:io'; import 'package:bloc/bloc.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; import 'package:injectable/injectable.dart'; import '../../../domain/user/i_avatar_repository.dart'; -part 'avatar_bloc.freezed.dart'; part 'avatar_event.dart'; part 'avatar_state.dart'; @@ -16,21 +15,18 @@ class AvatarBloc extends Bloc { AvatarBloc(this.avatarRepository) : super(const _Initial()) { on((event, emit) async { - await event.when( - started: () {}, - uploadAvatar: (image) async { - emit(const AvatarState.uploading()); + if (event is _UploadAvatar) { + emit(const AvatarState.uploading()); - final uploadAvatar = await avatarRepository.uploadAvatar(image); + final uploadAvatar = await avatarRepository.uploadAvatar(event.image); - emit( - uploadAvatar.fold( - (failure) => const AvatarState.uploadFailed(), - (success) => const AvatarState.uploadSuccess(), - ), - ); - }, - ); + emit( + uploadAvatar.fold( + (failure) => const AvatarState.uploadFailed(), + (success) => const AvatarState.uploadSuccess(), + ), + ); + } }); } } diff --git a/lib/application/user/avatar/avatar_event.dart b/lib/application/user/avatar/avatar_event.dart index 2e90e2c9..4b274003 100644 --- a/lib/application/user/avatar/avatar_event.dart +++ b/lib/application/user/avatar/avatar_event.dart @@ -1,7 +1,24 @@ part of 'avatar_bloc.dart'; -@freezed -class AvatarEvent with _$AvatarEvent { +abstract class AvatarEvent extends Equatable { + const AvatarEvent(); + const factory AvatarEvent.started() = _Started; const factory AvatarEvent.uploadAvatar(File image) = _UploadAvatar; + + @override + List get props => []; +} + +class _Started extends AvatarEvent { + const _Started(); +} + +class _UploadAvatar extends AvatarEvent { + final File image; + + const _UploadAvatar(this.image); + + @override + List get props => [image]; } diff --git a/lib/application/user/avatar/avatar_state.dart b/lib/application/user/avatar/avatar_state.dart index 203156ae..b054a5ef 100644 --- a/lib/application/user/avatar/avatar_state.dart +++ b/lib/application/user/avatar/avatar_state.dart @@ -1,9 +1,26 @@ part of 'avatar_bloc.dart'; -@freezed -class AvatarState with _$AvatarState { +abstract class AvatarState { + const AvatarState(); + const factory AvatarState.initial() = _Initial; const factory AvatarState.uploading() = _Uploading; const factory AvatarState.uploadSuccess() = _UploadSuccess; const factory AvatarState.uploadFailed() = _UploadFailed; } + +class _Initial extends AvatarState { + const _Initial(); +} + +class _Uploading extends AvatarState { + const _Uploading(); +} + +class _UploadSuccess extends AvatarState { + const _UploadSuccess(); +} + +class _UploadFailed extends AvatarState { + const _UploadFailed(); +} diff --git a/lib/application/username/username_bloc.dart b/lib/application/username/username_bloc.dart index 743fcb73..38a615b2 100644 --- a/lib/application/username/username_bloc.dart +++ b/lib/application/username/username_bloc.dart @@ -1,10 +1,9 @@ import 'package:bloc/bloc.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; import 'package:injectable/injectable.dart'; import '../../domain/user/i_profile_repository.dart'; -part 'username_bloc.freezed.dart'; part 'username_event.dart'; part 'username_state.dart'; @@ -14,23 +13,22 @@ class UsernameBloc extends Bloc { UsernameBloc(this.profileRepository) : super(const _Initial()) { on((event, emit) async { - await event.when( - updateUsername: (firstName, lastName) async { - emit(const UsernameState.updateInProgress()); + if (event is _UpdateUsername) { + emit(const UsernameState.updateInProgress()); - final unitOrFailure = await profileRepository.updateUsername( - firstName: firstName, - lastName: lastName, - ); + final unitOrFailure = await profileRepository.updateUsername( + firstName: event.firstName, + lastName: event.lastName, + ); - emit( - unitOrFailure.fold( - (failure) => const UsernameState.updateFailure(), - (_) => UsernameState.updateSuccess("$firstName $lastName"), - ), - ); - }, - ); + emit( + unitOrFailure.fold( + (failure) => const UsernameState.updateFailure(), + (_) => UsernameState.updateSuccess( + "${event.firstName} ${event.lastName}"), + ), + ); + } }); } } diff --git a/lib/application/username/username_event.dart b/lib/application/username/username_event.dart index d03a9938..ea83f174 100644 --- a/lib/application/username/username_event.dart +++ b/lib/application/username/username_event.dart @@ -1,9 +1,20 @@ part of 'username_bloc.dart'; -@freezed -class UsernameEvent with _$UsernameEvent { +abstract class UsernameEvent extends Equatable { + const UsernameEvent(); + const factory UsernameEvent.updateUsername({ required String firstName, required String lastName, }) = _UpdateUsername; } + +class _UpdateUsername extends UsernameEvent { + final String firstName; + final String lastName; + + const _UpdateUsername({required this.firstName, required this.lastName}); + + @override + List get props => [firstName, lastName]; +} diff --git a/lib/application/username/username_state.dart b/lib/application/username/username_state.dart index 6340aae3..fbcee9bc 100644 --- a/lib/application/username/username_state.dart +++ b/lib/application/username/username_state.dart @@ -1,9 +1,33 @@ part of 'username_bloc.dart'; -@freezed -class UsernameState with _$UsernameState { +abstract class UsernameState extends Equatable { + const UsernameState(); + const factory UsernameState.initial() = _Initial; const factory UsernameState.updateInProgress() = _UpdateInProgress; const factory UsernameState.updateSuccess(String fullname) = _UpdateSuccess; const factory UsernameState.updateFailure() = _UpdateFailure; + + @override + List get props => []; +} + +class _Initial extends UsernameState { + const _Initial(); +} + +class _UpdateInProgress extends UsernameState { + const _UpdateInProgress(); +} + +class _UpdateSuccess extends UsernameState { + final String fullname; + const _UpdateSuccess(this.fullname); + + @override + List get props => [fullname]; +} + +class _UpdateFailure extends UsernameState { + const _UpdateFailure(); } From dc6a05877a40512b674d468d71c63da1a8bdba4b Mon Sep 17 00:00:00 2001 From: Isaac Obella Date: Mon, 6 Mar 2023 13:12:15 +0300 Subject: [PATCH 5/8] core(infrastructure): Migrate dtos Signed-off-by: Isaac Obella --- lib/domain/crowdaction/crowdaction.dart | 8 - lib/domain/participation/participation.dart | 6 +- .../contact_form/contact_form_dto.dart | 54 +++-- lib/infrastructure/core/page_info_dto.dart | 63 ++++-- .../crowdaction/crowdaction_comment_dto.dart | 116 ++++++++-- .../crowdaction/crowdaction_dto.dart | 207 +++++++++++------- .../crowdaction/models/commitment_dto.dart | 81 +++++++ .../crowdaction/models/images_dto.dart | 45 ++++ .../crowdaction/models/location_dto.dart | 45 ++++ .../paginated_crowdactions_dto.dart | 56 +++-- .../paginated_participations_dto.dart | 56 +++-- .../participation/participation_dto.dart | 104 +++++++-- lib/infrastructure/profile/profile_dto.dart | 76 +++++-- models/{ => domain}/comment.model.json | 0 models/{ => domain}/commitment.model.json | 0 .../{ => domain}/crowdaction/commitment.json | 0 .../{ => domain}/crowdaction/crowdaction.json | 0 models/{ => domain}/crowdaction/images.json | 0 models/{ => domain}/crowdaction/location.json | 0 models/{ => domain}/crowdaction_comment.json | 0 .../page_info.json} | 0 .../{ => domain}/paginated_crowdaction.json | 0 .../participation/paginated_participants.json | 0 .../participation/participation.json | 0 models/{ => domain}/profile/profile.json | 0 models/{ => domain}/profile/user_profile.json | 0 .../settings/build_information.json | 0 models/infrastructure/contact_form.json | 19 ++ .../crowdaction/commitment.json | 31 +++ .../crowdaction/crowdaction.json | 70 ++++++ models/infrastructure/crowdaction/images.json | 15 ++ .../infrastructure/crowdaction/location.json | 15 ++ .../infrastructure/crowdaction_comment.json | 43 ++++ models/infrastructure/page_info.json | 27 +++ .../infrastructure/paginated_crowdaction.json | 23 ++ .../participation/paginated_participants.json | 23 ++ .../participation/participation.json | 39 ++++ models/infrastructure/profile.json | 28 +++ 38 files changed, 1039 insertions(+), 211 deletions(-) create mode 100644 lib/infrastructure/crowdaction/models/commitment_dto.dart create mode 100644 lib/infrastructure/crowdaction/models/images_dto.dart create mode 100644 lib/infrastructure/crowdaction/models/location_dto.dart rename models/{ => domain}/comment.model.json (100%) rename models/{ => domain}/commitment.model.json (100%) rename models/{ => domain}/crowdaction/commitment.json (100%) rename models/{ => domain}/crowdaction/crowdaction.json (100%) rename models/{ => domain}/crowdaction/images.json (100%) rename models/{ => domain}/crowdaction/location.json (100%) rename models/{ => domain}/crowdaction_comment.json (100%) rename models/{page_info.model.json => domain/page_info.json} (100%) rename models/{ => domain}/paginated_crowdaction.json (100%) rename models/{ => domain}/participation/paginated_participants.json (100%) rename models/{ => domain}/participation/participation.json (100%) rename models/{ => domain}/profile/profile.json (100%) rename models/{ => domain}/profile/user_profile.json (100%) rename models/{ => domain}/settings/build_information.json (100%) create mode 100644 models/infrastructure/contact_form.json create mode 100644 models/infrastructure/crowdaction/commitment.json create mode 100644 models/infrastructure/crowdaction/crowdaction.json create mode 100644 models/infrastructure/crowdaction/images.json create mode 100644 models/infrastructure/crowdaction/location.json create mode 100644 models/infrastructure/crowdaction_comment.json create mode 100644 models/infrastructure/page_info.json create mode 100644 models/infrastructure/paginated_crowdaction.json create mode 100644 models/infrastructure/participation/paginated_participants.json create mode 100644 models/infrastructure/participation/participation.json create mode 100644 models/infrastructure/profile.json diff --git a/lib/domain/crowdaction/crowdaction.dart b/lib/domain/crowdaction/crowdaction.dart index e89df1b0..d25c52de 100644 --- a/lib/domain/crowdaction/crowdaction.dart +++ b/lib/domain/crowdaction/crowdaction.dart @@ -19,7 +19,6 @@ class CrowdAction extends Equatable { required this.category, this.subcategory, required this.location, - required this.slug, this.password, required this.participantCount, required this.images, @@ -37,7 +36,6 @@ class CrowdAction extends Equatable { category: json['category'] as String, subcategory: json['subcategory'] as String?, location: Location.fromJson(json['location'] as Map), - slug: json['slug'] as String, password: json['password'] as String?, participantCount: json['participantCount'] as int, images: Images.fromJson(json['images'] as Map), @@ -62,8 +60,6 @@ class CrowdAction extends Equatable { final Location location; - final String slug; - final String? password; final int participantCount; @@ -87,7 +83,6 @@ class CrowdAction extends Equatable { String? category, String? Function()? subcategory, Location? location, - String? slug, String? Function()? password, int? participantCount, Images? images, @@ -104,7 +99,6 @@ class CrowdAction extends Equatable { category: category ?? this.category, subcategory: subcategory != null ? subcategory() : this.subcategory, location: location ?? this.location, - slug: slug ?? this.slug, password: password != null ? password() : this.password, participantCount: participantCount ?? this.participantCount, images: images ?? this.images, @@ -124,7 +118,6 @@ class CrowdAction extends Equatable { category, subcategory, location, - slug, password, participantCount, images, @@ -142,7 +135,6 @@ class CrowdAction extends Equatable { 'category': category, 'subcategory': subcategory, 'location': location.toJson(), - 'slug': slug, 'password': password, 'participantCount': participantCount, 'images': images.toJson(), diff --git a/lib/domain/participation/participation.dart b/lib/domain/participation/participation.dart index 290565e9..a9eb3f1e 100644 --- a/lib/domain/participation/participation.dart +++ b/lib/domain/participation/participation.dart @@ -22,7 +22,7 @@ class Participation extends Equatable { userId: json['userId'] as String, commitments: json['commitments'] as List, joinDate: DateTime.parse(json['joinDate'] as String), - dailyCheckIns: json['dailyCheckIns'] as String, + dailyCheckIns: json['dailyCheckIns'] as int, ); final String id; @@ -39,7 +39,7 @@ class Participation extends Equatable { final DateTime joinDate; - final String dailyCheckIns; + final int dailyCheckIns; Participation copyWith({ String? id, @@ -49,7 +49,7 @@ class Participation extends Equatable { String? userId, List? commitments, DateTime? joinDate, - String? dailyCheckIns, + int? dailyCheckIns, }) { return Participation( id: id ?? this.id, diff --git a/lib/infrastructure/contact_form/contact_form_dto.dart b/lib/infrastructure/contact_form/contact_form_dto.dart index e148b108..98510841 100644 --- a/lib/infrastructure/contact_form/contact_form_dto.dart +++ b/lib/infrastructure/contact_form/contact_form_dto.dart @@ -1,18 +1,46 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; -part 'contact_form_dto.freezed.dart'; -part 'contact_form_dto.g.dart'; +class ContactFormDto extends Equatable { + const ContactFormDto({ + required this.email, + this.subject = 'Hello CollAction!', + required this.message, + }); -@freezed -class ContactFormDto with _$ContactFormDto { - const ContactFormDto._(); + factory ContactFormDto.fromJson(Map json) => ContactFormDto( + email: json['email'] as String, + subject: json['subject'] as String?, + message: json['message'] as String, + ); - factory ContactFormDto({ - required String email, - @Default('Hello CollAction!') String? subject, - required String message, - }) = _ContactFormDto; + final String email; - factory ContactFormDto.fromJson(Map json) => - _$ContactFormDtoFromJson(json); + final String? subject; + + final String message; + + ContactFormDto copyWith({ + String? email, + String? Function()? subject, + String? message, + }) { + return ContactFormDto( + email: email ?? this.email, + subject: subject != null ? subject() : this.subject, + message: message ?? this.message, + ); + } + + @override + List get props => [ + email, + subject, + message, + ]; + + Map toJson() => { + 'email': email, + 'subject': subject, + 'message': message, + }; } diff --git a/lib/infrastructure/core/page_info_dto.dart b/lib/infrastructure/core/page_info_dto.dart index 90c2be6e..74d11a1c 100644 --- a/lib/infrastructure/core/page_info_dto.dart +++ b/lib/infrastructure/core/page_info_dto.dart @@ -1,23 +1,58 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; import '../../domain/core/page_info.dart'; -part 'page_info_dto.g.dart'; -part 'page_info_dto.freezed.dart'; +class PageInfoDto extends Equatable { + const PageInfoDto({ + required this.page, + required this.pageSize, + required this.totalPages, + required this.totalItems, + }); -@freezed -class PageInfoDto with _$PageInfoDto { - const PageInfoDto._(); + factory PageInfoDto.fromJson(Map json) => PageInfoDto( + page: json['page'] as int, + pageSize: json['pageSize'] as int, + totalPages: json['totalPages'] as int, + totalItems: json['totalItems'] as int, + ); + + final int page; + + final int pageSize; + + final int totalPages; + + final int totalItems; + + PageInfoDto copyWith({ + int? page, + int? pageSize, + int? totalPages, + int? totalItems, + }) { + return PageInfoDto( + page: page ?? this.page, + pageSize: pageSize ?? this.pageSize, + totalPages: totalPages ?? this.totalPages, + totalItems: totalItems ?? this.totalItems, + ); + } - const factory PageInfoDto({ - required int page, - required int pageSize, - required int totalPages, - required int totalItems, - }) = _PageInfoDto; + @override + List get props => [ + page, + pageSize, + totalPages, + totalItems, + ]; - factory PageInfoDto.fromJson(Map json) => - _$PageInfoDtoFromJson(json); + Map toJson() => { + 'page': page, + 'pageSize': pageSize, + 'totalPages': totalPages, + 'totalItems': totalItems, + }; PageInfo toDomain() => PageInfo( page: page, diff --git a/lib/infrastructure/crowdaction/crowdaction_comment_dto.dart b/lib/infrastructure/crowdaction/crowdaction_comment_dto.dart index 37f6c5ba..f93d8521 100644 --- a/lib/infrastructure/crowdaction/crowdaction_comment_dto.dart +++ b/lib/infrastructure/crowdaction/crowdaction_comment_dto.dart @@ -1,29 +1,99 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; import '../../domain/crowdaction/crowdaction_comment.dart'; -part 'crowdaction_comment_dto.freezed.dart'; -part 'crowdaction_comment_dto.g.dart'; - -// ignore_for_file: invalid_annotation_target -@freezed -class CrowdactionCommentDto with _$CrowdactionCommentDto { - const CrowdactionCommentDto._(); - - const factory CrowdactionCommentDto({ - @JsonKey(name: 'crowdaction_id') required String crowdactionId, - required String content, - @JsonKey(name: 'user_id') required String userId, - @JsonKey(name: 'created_at') required DateTime createdAt, - List? comments, - required int likes, - @JsonKey(name: 'liked_by_me', defaultValue: false) required bool likedByMe, - bool? flagged, - List? flags, - }) = _CrowdactionCommentDto; - - factory CrowdactionCommentDto.fromJson(Map data) => - _$CrowdactionCommentDtoFromJson(data); +class CrowdactionCommentDto extends Equatable { + const CrowdactionCommentDto({ + required this.crowdactionId, + required this.userId, + required this.createdAt, + required this.content, + this.comments, + required this.likes, + required this.likedByMe, + this.flagged, + this.flags, + }); + + factory CrowdactionCommentDto.fromJson(Map json) => + CrowdactionCommentDto( + crowdactionId: json['crowdaction_id'] as String, + userId: json['user_id'] as String, + createdAt: json['created_at'] as DateTime, + content: json['content'] as String, + comments: json['comments'] as List?, + likes: json['likes'] as int, + likedByMe: json['liked_by_me'] as bool, + flagged: json['flagged'] as bool?, + flags: json['flags'] as List?, + ); + + final String crowdactionId; + + final String userId; + + final DateTime createdAt; + + final String content; + + final List? comments; + + final int likes; + + final bool likedByMe; + + final bool? flagged; + + final List? flags; + + CrowdactionCommentDto copyWith({ + String? crowdactionId, + String? userId, + DateTime? createdAt, + String? content, + List? Function()? comments, + int? likes, + bool? likedByMe, + bool? Function()? flagged, + List? Function()? flags, + }) { + return CrowdactionCommentDto( + crowdactionId: crowdactionId ?? this.crowdactionId, + userId: userId ?? this.userId, + createdAt: createdAt ?? this.createdAt, + content: content ?? this.content, + comments: comments != null ? comments() : this.comments, + likes: likes ?? this.likes, + likedByMe: likedByMe ?? this.likedByMe, + flagged: flagged != null ? flagged() : this.flagged, + flags: flags != null ? flags() : this.flags, + ); + } + + @override + List get props => [ + crowdactionId, + userId, + createdAt, + content, + comments, + likes, + likedByMe, + flagged, + flags, + ]; + + Map toJson() => { + 'crowdaction_id': crowdactionId, + 'user_id': userId, + 'created_at': createdAt, + 'content': content, + 'comments': comments, + 'likes': likes, + 'liked_by_me': likedByMe, + 'flagged': flagged, + 'flags': flags, + }; CrowdactionComment toDomain() { return CrowdactionComment( diff --git a/lib/infrastructure/crowdaction/crowdaction_dto.dart b/lib/infrastructure/crowdaction/crowdaction_dto.dart index d3f53167..e900041e 100644 --- a/lib/infrastructure/crowdaction/crowdaction_dto.dart +++ b/lib/infrastructure/crowdaction/crowdaction_dto.dart @@ -1,32 +1,28 @@ -// ignore_for_file: non_constant_identifier_names - -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; import '../../domain/crowdaction/crowdaction.dart'; -part 'crowdaction_dto.freezed.dart'; - -part 'crowdaction_dto.g.dart'; - -@freezed -class CrowdActionDto with _$CrowdActionDto { - const CrowdActionDto._(); - - const factory CrowdActionDto({ - required String id, - required String title, - required String description, - required String category, - required LocationDto location, - required List commitments, - required ImagesDto images, - required int participantCount, - required Status status, - required JoinStatus joinStatus, - required String endAt, - String? password, - String? subcategory, - }) = _CrowdActionDto; +part 'models/commitment_dto.dart'; +part 'models/images_dto.dart'; +part 'models/location_dto.dart'; + +class CrowdActionDto extends Equatable { + const CrowdActionDto({ + required this.id, + required this.title, + required this.description, + required this.category, + this.subcategory, + required this.location, + this.password, + required this.participantCount, + required this.images, + required this.commitments, + required this.status, + required this.joinStatus, + required this.endAt, + required this.startAt, + }); CrowdAction toDomain() { return CrowdAction( @@ -41,80 +37,125 @@ class CrowdActionDto with _$CrowdActionDto { status: status, joinStatus: joinStatus, endAt: DateTime.parse(endAt), + startAt: DateTime.parse(startAt), password: password, subcategory: subcategory, ); } - factory CrowdActionDto.fromJson(Map json) => - _$CrowdActionDtoFromJson(json); -} + factory CrowdActionDto.fromJson(Map json) => CrowdActionDto( + id: json['id'] as String, + title: json['title'] as String, + description: json['description'] as String, + category: json['category'] as String, + subcategory: json['subcategory'] as String?, + location: + LocationDto.fromJson(json['location'] as Map), + password: json['password'] as String?, + participantCount: json['participantCount'] as int, + images: ImagesDto.fromJson(json['images'] as Map), + commitments: (json['commitments'] as List) + .map((dynamic e) => + CommitmentDto.fromJson(e as Map)) + .toList(), + status: (json['status'] as String).fromStatusJson, + joinStatus: (json['joinStatus'] as String).fromJoinStatusJson, + endAt: json['endAt'] as String, + startAt: json['startAt'] as String, + ); -@freezed -class ImagesDto with _$ImagesDto { - const ImagesDto._(); + final String id; - factory ImagesDto({ - required String card, - required String banner, - }) = _ImagesDto; + final String title; - Images toDomain() { - return Images( - card: card, - banner: banner, - ); - } + final String description; - factory ImagesDto.fromJson(Map json) => - _$ImagesDtoFromJson(json); -} + final String category; -@freezed -class LocationDto with _$LocationDto { - const LocationDto._(); + final String? subcategory; - factory LocationDto({ - required String code, - required String name, - }) = _LocationDto; + final LocationDto location; - Location toDomain() { - return Location( - code: code, - name: name, - ); - } + final String? password; - factory LocationDto.fromJson(Map json) => - _$LocationDtoFromJson(json); -} + final int participantCount; -@freezed -class CommitmentDto with _$CommitmentDto { - const CommitmentDto._(); + final ImagesDto images; - factory CommitmentDto({ - // ignore: invalid_annotation_target - @JsonKey(name: '_id') required String id, - required String label, - required int points, - required List blocks, - String? description, - String? icon, - }) = _CommitmentDto; + final List commitments; - Commitment toDomain() { - return Commitment( - id: id, - label: label, - points: points, - blocks: blocks, - description: description, - iconId: icon, + final Status status; + + final JoinStatus joinStatus; + + final String endAt; + + final String startAt; + + CrowdActionDto copyWith({ + String? id, + String? title, + String? description, + String? category, + String? Function()? subcategory, + LocationDto? location, + String? Function()? password, + int? participantCount, + ImagesDto? images, + List? commitments, + Status? status, + JoinStatus? joinStatus, + String? endAt, + String? startAt, + }) { + return CrowdActionDto( + id: id ?? this.id, + title: title ?? this.title, + description: description ?? this.description, + category: category ?? this.category, + subcategory: subcategory != null ? subcategory() : this.subcategory, + location: location ?? this.location, + password: password != null ? password() : this.password, + participantCount: participantCount ?? this.participantCount, + images: images ?? this.images, + commitments: commitments ?? this.commitments, + status: status ?? this.status, + joinStatus: joinStatus ?? this.joinStatus, + endAt: endAt ?? this.endAt, + startAt: startAt ?? this.startAt, ); } - factory CommitmentDto.fromJson(Map json) => - _$CommitmentDtoFromJson(json); + @override + List get props => [ + id, + title, + description, + category, + subcategory, + location, + password, + participantCount, + images, + commitments, + status, + joinStatus, + endAt, + ]; + + Map toJson() => { + 'id': id, + 'title': title, + 'description': description, + 'category': category, + 'subcategory': subcategory, + 'location': location.toJson(), + 'password': password, + 'participantCount': participantCount, + 'images': images.toJson(), + 'commitments': commitments.map((e) => e.toJson()), + 'status': status.toJson, + 'joinStatus': joinStatus.toJson, + 'endAt': endAt, + }; } diff --git a/lib/infrastructure/crowdaction/models/commitment_dto.dart b/lib/infrastructure/crowdaction/models/commitment_dto.dart new file mode 100644 index 00000000..16428b00 --- /dev/null +++ b/lib/infrastructure/crowdaction/models/commitment_dto.dart @@ -0,0 +1,81 @@ +part of '../crowdaction_dto.dart'; + +class CommitmentDto extends Equatable { + const CommitmentDto({ + required this.label, + this.description, + required this.points, + required this.blocks, + required this.id, + this.icon, + }); + + Commitment toDomain() { + return Commitment( + id: id, + label: label, + points: points, + blocks: blocks, + description: description, + iconId: icon, + ); + } + + factory CommitmentDto.fromJson(Map json) => CommitmentDto( + label: json['label'] as String, + description: json['description'] as String?, + points: json['points'] as int, + blocks: json['blocks'] as List, + id: json['_id'] as String, + icon: json['icon'] as String?, + ); + + final String label; + + final String? description; + + final int points; + + final List blocks; + + final String id; + + final String? icon; + + CommitmentDto copyWith({ + String? label, + String? Function()? description, + int? points, + List? blocks, + String? id, + String? Function()? icon, + }) { + return CommitmentDto( + label: label ?? this.label, + description: description != null ? description() : this.description, + points: points ?? this.points, + blocks: blocks ?? this.blocks, + id: id ?? this.id, + icon: icon != null ? icon() : this.icon, + ); + } + + @override + List get props => [ + label, + description, + points, + blocks, + id, + icon, + ]; + + Map toJson() => { + 'label': label, + 'description': description, + 'points': points, + 'blocks': blocks, + '_id': id, + 'icon': icon, + }; +} diff --git a/lib/infrastructure/crowdaction/models/images_dto.dart b/lib/infrastructure/crowdaction/models/images_dto.dart new file mode 100644 index 00000000..cc556e30 --- /dev/null +++ b/lib/infrastructure/crowdaction/models/images_dto.dart @@ -0,0 +1,45 @@ +part of '../crowdaction_dto.dart'; + +class ImagesDto extends Equatable { + const ImagesDto({ + required this.card, + required this.banner, + }); + + Images toDomain() { + return Images( + card: card, + banner: banner, + ); + } + + factory ImagesDto.fromJson(Map json) => ImagesDto( + card: json['card'] as String, + banner: json['banner'] as String, + ); + + final String card; + + final String banner; + + ImagesDto copyWith({ + String? card, + String? banner, + }) { + return ImagesDto( + card: card ?? this.card, + banner: banner ?? this.banner, + ); + } + + @override + List get props => [ + card, + banner, + ]; + + Map toJson() => { + 'card': card, + 'banner': banner, + }; +} diff --git a/lib/infrastructure/crowdaction/models/location_dto.dart b/lib/infrastructure/crowdaction/models/location_dto.dart new file mode 100644 index 00000000..1a734911 --- /dev/null +++ b/lib/infrastructure/crowdaction/models/location_dto.dart @@ -0,0 +1,45 @@ +part of '../crowdaction_dto.dart'; + +class LocationDto extends Equatable { + const LocationDto({ + required this.code, + required this.name, + }); + + Location toDomain() { + return Location( + code: code, + name: name, + ); + } + + factory LocationDto.fromJson(Map json) => LocationDto( + code: json['code'] as String, + name: json['name'] as String, + ); + + final String code; + + final String name; + + LocationDto copyWith({ + String? code, + String? name, + }) { + return LocationDto( + code: code ?? this.code, + name: name ?? this.name, + ); + } + + @override + List get props => [ + code, + name, + ]; + + Map toJson() => { + 'code': code, + 'name': name, + }; +} diff --git a/lib/infrastructure/crowdaction/paginated_crowdactions_dto.dart b/lib/infrastructure/crowdaction/paginated_crowdactions_dto.dart index b5b0187d..4f309fff 100644 --- a/lib/infrastructure/crowdaction/paginated_crowdactions_dto.dart +++ b/lib/infrastructure/crowdaction/paginated_crowdactions_dto.dart @@ -1,26 +1,52 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; import '../../domain/crowdaction/paginated_crowdactions.dart'; import '../core/page_info_dto.dart'; import 'crowdaction_dto.dart'; -part 'paginated_crowdactions_dto.g.dart'; -part 'paginated_crowdactions_dto.freezed.dart'; - -@freezed -class PaginatedCrowdActionsDto with _$PaginatedCrowdActionsDto { - const PaginatedCrowdActionsDto._(); - - const factory PaginatedCrowdActionsDto({ - required List crowdActions, - required PageInfoDto pageInfo, - }) = _PaginatedCrowdActionsDto; - - factory PaginatedCrowdActionsDto.fromJson(Map json) => - _$PaginatedCrowdActionsDtoFromJson(json); +class PaginatedCrowdActionsDto extends Equatable { + const PaginatedCrowdActionsDto({ + required this.crowdActions, + required this.pageInfo, + }); PaginatedCrowdActions toDomain() => PaginatedCrowdActions( crowdActions: crowdActions.map((e) => e.toDomain()).toList(), pageInfo: pageInfo.toDomain(), ); + + factory PaginatedCrowdActionsDto.fromJson(Map json) => + PaginatedCrowdActionsDto( + crowdActions: (json['crowdActions'] as List) + .map((dynamic e) => + CrowdActionDto.fromJson(e as Map)) + .toList(), + pageInfo: + PageInfoDto.fromJson(json['pageInfo'] as Map), + ); + + final List crowdActions; + + final PageInfoDto pageInfo; + + PaginatedCrowdActionsDto copyWith({ + List? crowdActions, + PageInfoDto? pageInfo, + }) { + return PaginatedCrowdActionsDto( + crowdActions: crowdActions ?? this.crowdActions, + pageInfo: pageInfo ?? this.pageInfo, + ); + } + + @override + List get props => [ + crowdActions, + pageInfo, + ]; + + Map toJson() => { + 'crowdActions': crowdActions, + 'pageInfo': pageInfo, + }; } diff --git a/lib/infrastructure/participation/paginated_participations_dto.dart b/lib/infrastructure/participation/paginated_participations_dto.dart index 2ccd36f7..3ad59ffb 100644 --- a/lib/infrastructure/participation/paginated_participations_dto.dart +++ b/lib/infrastructure/participation/paginated_participations_dto.dart @@ -1,26 +1,52 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; import '../../domain/participation/paginated_participations.dart'; import '../core/page_info_dto.dart'; import 'participation_dto.dart'; -part 'paginated_participations_dto.freezed.dart'; -part 'paginated_participations_dto.g.dart'; - -@freezed -class PaginatedParticipationsDto with _$PaginatedParticipationsDto { - const PaginatedParticipationsDto._(); - - const factory PaginatedParticipationsDto({ - required List participations, - required PageInfoDto pageInfo, - }) = _PaginatedParticipationsDto; - - factory PaginatedParticipationsDto.fromJson(Map json) => - _$PaginatedParticipationsDtoFromJson(json); +class PaginatedParticipationsDto extends Equatable { + const PaginatedParticipationsDto({ + required this.participations, + required this.pageInfo, + }); PaginatedParticipations toDomain() => PaginatedParticipations( participations: participations.map((e) => e.toDomain()).toList(), pageInfo: pageInfo.toDomain(), ); + + factory PaginatedParticipationsDto.fromJson(Map json) => + PaginatedParticipationsDto( + participations: (json['participations'] as List) + .map((dynamic e) => + ParticipationDto.fromJson(e as Map)) + .toList(), + pageInfo: + PageInfoDto.fromJson(json['pageInfo'] as Map), + ); + + final List participations; + + final PageInfoDto pageInfo; + + PaginatedParticipationsDto copyWith({ + List? participations, + PageInfoDto? pageInfo, + }) { + return PaginatedParticipationsDto( + participations: participations ?? this.participations, + pageInfo: pageInfo ?? this.pageInfo, + ); + } + + @override + List get props => [ + participations, + pageInfo, + ]; + + Map toJson() => { + 'participations': participations, + 'pageInfo': pageInfo, + }; } diff --git a/lib/infrastructure/participation/participation_dto.dart b/lib/infrastructure/participation/participation_dto.dart index 145c3485..b9f4285a 100644 --- a/lib/infrastructure/participation/participation_dto.dart +++ b/lib/infrastructure/participation/participation_dto.dart @@ -1,24 +1,18 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; import '../../domain/participation/participation.dart'; -part 'participation_dto.freezed.dart'; -part 'participation_dto.g.dart'; - -@freezed -class ParticipationDto with _$ParticipationDto { - const ParticipationDto._(); - - factory ParticipationDto({ - required String id, - required String crowdActionId, - required String userId, - required String fullName, - required String avatar, - required List commitments, - required String joinDate, - required int dailyCheckIns, - }) = _ParticipationDto; +class ParticipationDto extends Equatable { + const ParticipationDto({ + required this.id, + required this.crowdActionId, + required this.fullName, + required this.avatar, + required this.userId, + required this.commitments, + required this.joinDate, + required this.dailyCheckIns, + }); Participation toDomain() { return Participation( @@ -33,6 +27,76 @@ class ParticipationDto with _$ParticipationDto { ); } - factory ParticipationDto.fromJson(Map json) => - _$ParticipationDtoFromJson(json); + factory ParticipationDto.fromJson(Map json) => + ParticipationDto( + id: json['id'] as String, + crowdActionId: json['crowdActionId'] as String, + fullName: json['fullName'] as String, + avatar: json['avatar'] as String, + userId: json['userId'] as String, + commitments: json['commitments'] as List, + joinDate: json['joinDate'] as String, + dailyCheckIns: json['dailyCheckIns'] as int, + ); + + final String id; + + final String crowdActionId; + + final String fullName; + + final String avatar; + + final String userId; + + final List commitments; + + final String joinDate; + + final int dailyCheckIns; + + ParticipationDto copyWith({ + String? id, + String? crowdActionId, + String? fullName, + String? avatar, + String? userId, + List? commitments, + String? joinDate, + int? dailyCheckIns, + }) { + return ParticipationDto( + id: id ?? this.id, + crowdActionId: crowdActionId ?? this.crowdActionId, + fullName: fullName ?? this.fullName, + avatar: avatar ?? this.avatar, + userId: userId ?? this.userId, + commitments: commitments ?? this.commitments, + joinDate: joinDate ?? this.joinDate, + dailyCheckIns: dailyCheckIns ?? this.dailyCheckIns, + ); + } + + @override + List get props => [ + id, + crowdActionId, + fullName, + avatar, + userId, + commitments, + joinDate, + dailyCheckIns, + ]; + + Map toJson() => { + 'id': id, + 'crowdActionId': crowdActionId, + 'fullName': fullName, + 'avatar': avatar, + 'userId': userId, + 'commitments': commitments, + 'joinDate': joinDate, + 'dailyCheckIns': dailyCheckIns, + }; } diff --git a/lib/infrastructure/profile/profile_dto.dart b/lib/infrastructure/profile/profile_dto.dart index bc2f0364..018da2bb 100644 --- a/lib/infrastructure/profile/profile_dto.dart +++ b/lib/infrastructure/profile/profile_dto.dart @@ -1,21 +1,15 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:equatable/equatable.dart'; import '../../domain/profile/profile.dart'; -part 'profile_dto.freezed.dart'; -part 'profile_dto.g.dart'; - -@freezed -class ProfileDto with _$ProfileDto { - const ProfileDto._(); - - const factory ProfileDto({ - required String userId, - required String firstName, - required String lastName, - required String avatar, - String? bio, - }) = _ProfileDto; +class ProfileDto extends Equatable { + const ProfileDto({ + required this.userId, + required this.firstName, + required this.lastName, + required this.avatar, + this.bio, + }); Profile toDomain() { return Profile( @@ -27,6 +21,54 @@ class ProfileDto with _$ProfileDto { ); } - factory ProfileDto.fromJson(Map json) => - _$ProfileDtoFromJson(json); + factory ProfileDto.fromJson(Map json) => ProfileDto( + userId: json['userId'] as String, + firstName: json['firstName'] as String, + lastName: json['lastName'] as String, + avatar: json['avatar'] as String, + bio: json['bio'] as String?, + ); + + final String userId; + + final String firstName; + + final String lastName; + + final String avatar; + + final String? bio; + + ProfileDto copyWith({ + String? userId, + String? firstName, + String? lastName, + String? avatar, + String? Function()? bio, + }) { + return ProfileDto( + userId: userId ?? this.userId, + firstName: firstName ?? this.firstName, + lastName: lastName ?? this.lastName, + avatar: avatar ?? this.avatar, + bio: bio != null ? bio() : this.bio, + ); + } + + @override + List get props => [ + userId, + firstName, + lastName, + avatar, + bio, + ]; + + Map toJson() => { + 'userId': userId, + 'firstName': firstName, + 'lastName': lastName, + 'avatar': avatar, + 'bio': bio, + }; } diff --git a/models/comment.model.json b/models/domain/comment.model.json similarity index 100% rename from models/comment.model.json rename to models/domain/comment.model.json diff --git a/models/commitment.model.json b/models/domain/commitment.model.json similarity index 100% rename from models/commitment.model.json rename to models/domain/commitment.model.json diff --git a/models/crowdaction/commitment.json b/models/domain/crowdaction/commitment.json similarity index 100% rename from models/crowdaction/commitment.json rename to models/domain/crowdaction/commitment.json diff --git a/models/crowdaction/crowdaction.json b/models/domain/crowdaction/crowdaction.json similarity index 100% rename from models/crowdaction/crowdaction.json rename to models/domain/crowdaction/crowdaction.json diff --git a/models/crowdaction/images.json b/models/domain/crowdaction/images.json similarity index 100% rename from models/crowdaction/images.json rename to models/domain/crowdaction/images.json diff --git a/models/crowdaction/location.json b/models/domain/crowdaction/location.json similarity index 100% rename from models/crowdaction/location.json rename to models/domain/crowdaction/location.json diff --git a/models/crowdaction_comment.json b/models/domain/crowdaction_comment.json similarity index 100% rename from models/crowdaction_comment.json rename to models/domain/crowdaction_comment.json diff --git a/models/page_info.model.json b/models/domain/page_info.json similarity index 100% rename from models/page_info.model.json rename to models/domain/page_info.json diff --git a/models/paginated_crowdaction.json b/models/domain/paginated_crowdaction.json similarity index 100% rename from models/paginated_crowdaction.json rename to models/domain/paginated_crowdaction.json diff --git a/models/participation/paginated_participants.json b/models/domain/participation/paginated_participants.json similarity index 100% rename from models/participation/paginated_participants.json rename to models/domain/participation/paginated_participants.json diff --git a/models/participation/participation.json b/models/domain/participation/participation.json similarity index 100% rename from models/participation/participation.json rename to models/domain/participation/participation.json diff --git a/models/profile/profile.json b/models/domain/profile/profile.json similarity index 100% rename from models/profile/profile.json rename to models/domain/profile/profile.json diff --git a/models/profile/user_profile.json b/models/domain/profile/user_profile.json similarity index 100% rename from models/profile/user_profile.json rename to models/domain/profile/user_profile.json diff --git a/models/settings/build_information.json b/models/domain/settings/build_information.json similarity index 100% rename from models/settings/build_information.json rename to models/domain/settings/build_information.json diff --git a/models/infrastructure/contact_form.json b/models/infrastructure/contact_form.json new file mode 100644 index 00000000..18cfbb47 --- /dev/null +++ b/models/infrastructure/contact_form.json @@ -0,0 +1,19 @@ +{ + "model_name": "contact_form_dto", + "properties": [ + { + "name": "email", + "type": "String" + }, + { + "name": "subject", + "type": "String?" + }, + { + "name": "message", + "type": "String" + } + ], + "style": "basic", + "additionals": ["json", "equatable", "copyWith"] +} diff --git a/models/infrastructure/crowdaction/commitment.json b/models/infrastructure/crowdaction/commitment.json new file mode 100644 index 00000000..720b96e8 --- /dev/null +++ b/models/infrastructure/crowdaction/commitment.json @@ -0,0 +1,31 @@ +{ + "model_name": "commitment_dto", + "properties": [ + { + "name": "label", + "type": "String" + }, + { + "name": "description", + "type": "String?" + }, + { + "name": "points", + "type": "int" + }, + { + "name": "blocks", + "type": "List" + }, + { + "name": "_id", + "type": "String" + }, + { + "name": "icon", + "type": "String?" + } + ], + "style": "basic", + "additionals": ["json", "equatable", "copyWith"] +} diff --git a/models/infrastructure/crowdaction/crowdaction.json b/models/infrastructure/crowdaction/crowdaction.json new file mode 100644 index 00000000..f88ec423 --- /dev/null +++ b/models/infrastructure/crowdaction/crowdaction.json @@ -0,0 +1,70 @@ +{ + "model_name": "crowd_action_dto", + "properties": [ + { + "name": "id", + "type": "String" + }, + { + "name": "title", + "type": "String" + }, + { + "name": "description", + "type": "String" + }, + { + "name": "category", + "type": "String" + }, + { + "name": "subcategory", + "type": "String?" + }, + { + "name": "location", + "type": "LocationDto" + }, + { + "name": "password", + "type": "String?" + }, + { + "name": "participantCount", + "type": "int" + }, + { + "name": "images", + "type": "Images" + }, + { + "name": "commitments", + "type": "List" + }, + { + "name": "status", + "type": "Status" + }, + { + "name": "joinStatus", + "type": "JoinStatus" + }, + { + "name": "endAt", + "type": "DateTime" + } + ], + "style": "basic", + "relations": [ + { + "name": "LocationDto" + }, + { + "name": "ImagesDto" + }, + { + "name": "CommitmentDto" + } + ], + "additionals": ["json", "equatable", "copyWith"] +} diff --git a/models/infrastructure/crowdaction/images.json b/models/infrastructure/crowdaction/images.json new file mode 100644 index 00000000..b45acb5a --- /dev/null +++ b/models/infrastructure/crowdaction/images.json @@ -0,0 +1,15 @@ +{ + "model_name": "images_dto", + "properties": [ + { + "name": "card", + "type": "String" + }, + { + "name": "banner", + "type": "String" + } + ], + "style": "basic", + "additionals": ["json", "equatable", "copyWith"] +} diff --git a/models/infrastructure/crowdaction/location.json b/models/infrastructure/crowdaction/location.json new file mode 100644 index 00000000..d734580a --- /dev/null +++ b/models/infrastructure/crowdaction/location.json @@ -0,0 +1,15 @@ +{ + "model_name": "location_dto", + "properties": [ + { + "name": "code", + "type": "String" + }, + { + "name": "name", + "type": "String" + } + ], + "style": "basic", + "additionals": ["json", "equatable", "copyWith"] +} diff --git a/models/infrastructure/crowdaction_comment.json b/models/infrastructure/crowdaction_comment.json new file mode 100644 index 00000000..90ed239d --- /dev/null +++ b/models/infrastructure/crowdaction_comment.json @@ -0,0 +1,43 @@ +{ + "model_name": "crowdaction_comment_dto", + "properties": [ + { + "name": "crowdaction_id", + "type": "String" + }, + { + "name": "user_id", + "type": "String" + }, + { + "name": "created_at", + "type": "DateTime" + }, + { + "name": "content", + "type": "String" + }, + { + "name": "comments", + "type": "List?" + }, + { + "name": "likes", + "type": "int" + }, + { + "name": "liked_by_me", + "type": "bool" + }, + { + "name": "flagged", + "type": "bool?" + }, + { + "name": "flags", + "type": "List?" + } + ], + "style": "basic", + "additionals": ["json", "equatable", "copyWith"] +} diff --git a/models/infrastructure/page_info.json b/models/infrastructure/page_info.json new file mode 100644 index 00000000..954edad7 --- /dev/null +++ b/models/infrastructure/page_info.json @@ -0,0 +1,27 @@ +{ + "model_name": "page_info_dto", + "properties": [ + { + "name": "page", + "type": "int" + }, + { + "name": "pageSize", + "type": "int" + }, + { + "name": "totalPages", + "type": "int" + }, + { + "name": "totalItems", + "type": "int" + } + ], + "style": "basic", + "additionals": [ + "json", + "equatable", + "copyWith" + ] +} diff --git a/models/infrastructure/paginated_crowdaction.json b/models/infrastructure/paginated_crowdaction.json new file mode 100644 index 00000000..89155b4c --- /dev/null +++ b/models/infrastructure/paginated_crowdaction.json @@ -0,0 +1,23 @@ +{ + "model_name": "paginated_crowd_actions_dto", + "properties": [ + { + "name": "crowdActions", + "type": "List" + }, + { + "name": "pageInfo", + "type": "PageInfoDto" + } + ], + "style": "basic", + "relations": [ + { + "name": "CrowdActionDto" + }, + { + "name": "PageInfoDto" + } + ], + "additionals": ["json", "equatable", "copyWith"] +} diff --git a/models/infrastructure/participation/paginated_participants.json b/models/infrastructure/participation/paginated_participants.json new file mode 100644 index 00000000..1b236a0b --- /dev/null +++ b/models/infrastructure/participation/paginated_participants.json @@ -0,0 +1,23 @@ +{ + "model_name": "paginated_participations_dto", + "properties": [ + { + "name": "participations", + "type": "List" + }, + { + "name": "pageInfo", + "type": "PageInfoDto" + } + ], + "style": "basic", + "relations": [ + { + "name": "ParticipationDto" + }, + { + "name": "PageInfoDto" + } + ], + "additionals": ["json", "equatable", "copyWith"] +} diff --git a/models/infrastructure/participation/participation.json b/models/infrastructure/participation/participation.json new file mode 100644 index 00000000..9ff83387 --- /dev/null +++ b/models/infrastructure/participation/participation.json @@ -0,0 +1,39 @@ +{ + "model_name": "participation_dto", + "properties": [ + { + "name": "id", + "type": "String" + }, + { + "name": "crowdActionId", + "type": "String" + }, + { + "name": "fullName", + "type": "String" + }, + { + "name": "avatar", + "type": "String" + }, + { + "name": "userId", + "type": "String" + }, + { + "name": "commitments", + "type": "List" + }, + { + "name": "joinDate", + "type": "String" + }, + { + "name": "dailyCheckIns", + "type": "int" + } + ], + "style": "basic", + "additionals": ["json", "equatable", "copyWith"] +} diff --git a/models/infrastructure/profile.json b/models/infrastructure/profile.json new file mode 100644 index 00000000..56955dd3 --- /dev/null +++ b/models/infrastructure/profile.json @@ -0,0 +1,28 @@ +{ + "model_name": "profile_dto", + "properties": [ + { + "name": "userId", + "type": "String" + }, + { + "name": "firstName", + "type": "String" + }, + { + "name": "lastName", + "type": "String" + }, + { + "name": "avatar", + "type": "String" + }, + { + "name": "bio", + "type": "String?" + } + ], + "style": "basic", + "additionals": ["json", "equatable", "copyWith"] + } + \ No newline at end of file From be14fe21b329d502de4891a7940538822fd03377 Mon Sep 17 00:00:00 2001 From: Isaac Obella Date: Mon, 6 Mar 2023 14:54:08 +0300 Subject: [PATCH 6/8] core(presentation): Refactor to match application Signed-off-by: Isaac Obella --- lib/application/auth/auth_bloc.dart | 4 +- lib/application/auth/auth_state.dart | 36 +-- .../contact_form/contact_form_state.dart | 18 +- .../crowdaction_details_state.dart | 24 +- .../crowdaction_getter_state.dart | 21 +- .../crowdaction_participants_state.dart | 18 +- .../spotlight/spotlight_state.dart | 24 +- .../participation/participation_bloc.dart | 2 +- .../participation/participation_state.dart | 18 +- .../top_participants_state.dart | 12 +- .../build_information_state.dart | 6 +- lib/application/user/avatar/avatar_state.dart | 4 +- lib/application/username/username_state.dart | 6 + lib/domain/crowdaction/crowdaction.dart | 8 - .../crowdaction/crowdaction_dto.dart | 1 - lib/presentation/auth/auth_screen.dart | 53 ++-- .../auth/widgets/enter_username.dart | 32 +-- .../auth/widgets/profile_photo.dart | 15 +- .../auth/widgets/verification_code.dart | 7 +- .../contact_form/widgets/contact_form.dart | 51 ++-- lib/presentation/core/app_widget.dart | 8 +- .../crowdaction_browse_screen.dart | 44 ++-- .../crowdaction_details_screen.dart | 69 +++--- .../widgets/confirm_participation.dart | 13 +- .../widgets/participation_count_text.dart | 47 ++-- .../widgets/withdraw_participation.dart | 231 +++++++++--------- .../widgets/in_spotlight_header.dart | 25 +- .../crowdaction_participants_screen.dart | 44 ++-- .../home/widgets/crowdaction_carousel.dart | 31 ++- .../home/widgets/current_upcoming_layout.dart | 26 +- .../settings/settings_screen.dart | 12 +- .../commitments/commitment_card_list.dart | 6 +- .../shared_widgets/content_placeholder.dart | 6 +- .../shared_widgets/participant_avatars.dart | 19 +- 34 files changed, 439 insertions(+), 502 deletions(-) diff --git a/lib/application/auth/auth_bloc.dart b/lib/application/auth/auth_bloc.dart index 595d448a..233bada4 100644 --- a/lib/application/auth/auth_bloc.dart +++ b/lib/application/auth/auth_bloc.dart @@ -140,11 +140,11 @@ class AuthBloc extends Bloc { (r) { _credential = r.credential; - if (r is _SmsCodeSent) { + if (r is SmsCodeSent) { return const AuthState.smsCodeSent(); } else if (r is _CodeRetrievalTimedOut) { return const AuthState.codeRetrievalTimedOut(); - } else if (r is _VerificationCompleted) { + } else if (r is VerificationCompleted) { return AuthState.verificationCompleted( _credential?.smsCode ?? '', ); diff --git a/lib/application/auth/auth_state.dart b/lib/application/auth/auth_state.dart index a041e0d0..f18c59f5 100644 --- a/lib/application/auth/auth_state.dart +++ b/lib/application/auth/auth_state.dart @@ -10,17 +10,17 @@ abstract class AuthState extends Equatable { const factory AuthState.signingInUser() = SigningInUser; /// SMS Code has been sent, wait for autocomplete or user to enter code - const factory AuthState.smsCodeSent() = _SmsCodeSent; + const factory AuthState.smsCodeSent() = SmsCodeSent; /// SMS Code verification has been completed, sign in user with credentials const factory AuthState.verificationCompleted(String smsCode) = - _VerificationCompleted; + VerificationCompleted; /// SMS Code autocomplete has timed out, allow user to resend code const factory AuthState.codeRetrievalTimedOut() = _CodeRetrievalTimedOut; /// An error has occurred during authentication - const factory AuthState.authError(AuthFailure failure) = _AuthError; + const factory AuthState.authError(AuthFailure failure) = AuthError; /// Authentication may be completed with verification code const factory AuthState.awaitingVerification() = AwaitingVerification; @@ -29,7 +29,7 @@ abstract class AuthState extends Equatable { const factory AuthState.verifying(String smsCode) = _Verifying; /// Authentication has been completed - const factory AuthState.loggedIn({required bool isNewUser}) = _LoggedIn; + const factory AuthState.loggedIn({required bool isNewUser}) = LoggedIn; /// Code is being resent const factory AuthState.awaitingCodeResend() = AwaitingCodeResend; @@ -38,10 +38,10 @@ abstract class AuthState extends Equatable { const factory AuthState.awaitingPhotoUpdate() = AwaitingProfilePhotoUpdate; /// Profile photo update done - const factory AuthState.photoUpdateDone() = _ProfilePhotoUpdateDone; + const factory AuthState.photoUpdateDone() = ProfilePhotoUpdateDone; /// Splash Auth states - const factory AuthState.authenticated(User user) = _Authenticated; + const factory AuthState.authenticated(User user) = Authenticated; const factory AuthState.unauthenticated() = _UnAuthenticated; @@ -60,15 +60,15 @@ class SigningInUser extends AuthState { } /// SMS Code has been sent, wait for autocomplete or user to enter code -class _SmsCodeSent extends AuthState { - const _SmsCodeSent(); +class SmsCodeSent extends AuthState { + const SmsCodeSent(); } /// SMS Code verification has been completed, sign in user with credentials -class _VerificationCompleted extends AuthState { +class VerificationCompleted extends AuthState { final String smsCode; - const _VerificationCompleted(this.smsCode); + const VerificationCompleted(this.smsCode); @override List get props => [smsCode]; @@ -80,10 +80,10 @@ class _CodeRetrievalTimedOut extends AuthState { } /// An error has occurred during authentication -class _AuthError extends AuthState { +class AuthError extends AuthState { final AuthFailure failure; - const _AuthError(this.failure); + const AuthError(this.failure); @override List get props => [failure]; @@ -105,10 +105,10 @@ class _Verifying extends AuthState { } /// Authentication has been completed -class _LoggedIn extends AuthState { +class LoggedIn extends AuthState { final bool isNewUser; - const _LoggedIn({required this.isNewUser}); + const LoggedIn({required this.isNewUser}); @override List get props => [isNewUser]; @@ -125,15 +125,15 @@ class AwaitingProfilePhotoUpdate extends AuthState { } /// Profile photo update done -class _ProfilePhotoUpdateDone extends AuthState { - const _ProfilePhotoUpdateDone(); +class ProfilePhotoUpdateDone extends AuthState { + const ProfilePhotoUpdateDone(); } /// Splash Auth states -class _Authenticated extends AuthState { +class Authenticated extends AuthState { final User user; - const _Authenticated(this.user); + const Authenticated(this.user); @override List get props => [user]; diff --git a/lib/application/contact_form/contact_form_state.dart b/lib/application/contact_form/contact_form_state.dart index d196b82a..19fa6397 100644 --- a/lib/application/contact_form/contact_form_state.dart +++ b/lib/application/contact_form/contact_form_state.dart @@ -3,34 +3,34 @@ part of 'contact_form_bloc.dart'; abstract class ContactFormState extends Equatable { const ContactFormState(); - const factory ContactFormState.initial() = _Initial; + const factory ContactFormState.initial() = Initial; const factory ContactFormState.submitting() = Submitting; - const factory ContactFormState.submissionSuccessful() = _SubmissionSuccessful; + const factory ContactFormState.submissionSuccessful() = SubmissionSuccessful; - const factory ContactFormState.failed(String failureMessage) = _Failed; + const factory ContactFormState.failed(String failureMessage) = Failed; @override List get props => []; } -class _Initial extends ContactFormState { - const _Initial(); +class Initial extends ContactFormState { + const Initial(); } class Submitting extends ContactFormState { const Submitting(); } -class _SubmissionSuccessful extends ContactFormState { - const _SubmissionSuccessful(); +class SubmissionSuccessful extends ContactFormState { + const SubmissionSuccessful(); } -class _Failed extends ContactFormState { +class Failed extends ContactFormState { final String failureMessage; - const _Failed(this.failureMessage); + const Failed(this.failureMessage); @override List get props => [failureMessage]; diff --git a/lib/application/crowdaction/crowdaction_details/crowdaction_details_state.dart b/lib/application/crowdaction/crowdaction_details/crowdaction_details_state.dart index 56130c28..fd32c9bc 100644 --- a/lib/application/crowdaction/crowdaction_details/crowdaction_details_state.dart +++ b/lib/application/crowdaction/crowdaction_details/crowdaction_details_state.dart @@ -3,39 +3,39 @@ part of 'crowdaction_details_bloc.dart'; abstract class CrowdActionDetailsState extends Equatable { const CrowdActionDetailsState(); - const factory CrowdActionDetailsState.initial() = _Initial; - const factory CrowdActionDetailsState.loadInProgress() = _LoadInProgress; + const factory CrowdActionDetailsState.initial() = Initial; + const factory CrowdActionDetailsState.loadInProgress() = LoadInProgress; const factory CrowdActionDetailsState.loadSuccess(CrowdAction crowdAction) = - _LoadSuccess; + LoadSuccess; const factory CrowdActionDetailsState.loadFailure( CrowdActionFailure crowdactionFailure, - ) = _LoadFailure; + ) = LoadFailure; @override List get props => []; } -class _Initial extends CrowdActionDetailsState { - const _Initial(); +class Initial extends CrowdActionDetailsState { + const Initial(); } -class _LoadInProgress extends CrowdActionDetailsState { - const _LoadInProgress(); +class LoadInProgress extends CrowdActionDetailsState { + const LoadInProgress(); } -class _LoadSuccess extends CrowdActionDetailsState { +class LoadSuccess extends CrowdActionDetailsState { final CrowdAction crowdAction; - const _LoadSuccess(this.crowdAction); + const LoadSuccess(this.crowdAction); @override List get props => [crowdAction]; } -class _LoadFailure extends CrowdActionDetailsState { +class LoadFailure extends CrowdActionDetailsState { final CrowdActionFailure crowdactionFailure; - const _LoadFailure(this.crowdactionFailure); + const LoadFailure(this.crowdactionFailure); @override List get props => [crowdactionFailure]; diff --git a/lib/application/crowdaction/crowdaction_getter/crowdaction_getter_state.dart b/lib/application/crowdaction/crowdaction_getter/crowdaction_getter_state.dart index 07ec4b13..263b0738 100644 --- a/lib/application/crowdaction/crowdaction_getter/crowdaction_getter_state.dart +++ b/lib/application/crowdaction/crowdaction_getter/crowdaction_getter_state.dart @@ -3,18 +3,19 @@ part of 'crowdaction_getter_bloc.dart'; abstract class CrowdActionGetterState extends Equatable { const CrowdActionGetterState(); - const factory CrowdActionGetterState.initial() = _Initial; + const factory CrowdActionGetterState.initial() = Initial; const factory CrowdActionGetterState.loading() = _Loading; const factory CrowdActionGetterState.success({ required List crowdActions, required PageInfo pageInfo, - }) = _Success; + }) = Success; const factory CrowdActionGetterState.finished({ required List crowdActions, - }) = _Finished; + }) = Finished; + const factory CrowdActionGetterState.failure(CrowdActionFailure failure) = _Failure; @@ -22,29 +23,29 @@ abstract class CrowdActionGetterState extends Equatable { List get props => []; } -class _Initial extends CrowdActionGetterState { - const _Initial(); +class Initial extends CrowdActionGetterState { + const Initial(); } class _Loading extends CrowdActionGetterState { const _Loading(); } -class _Success extends CrowdActionGetterState { +class Success extends CrowdActionGetterState { final List crowdActions; final PageInfo pageInfo; - const _Success({required this.crowdActions, required this.pageInfo}); + const Success({required this.crowdActions, required this.pageInfo}); } -class _Finished extends CrowdActionGetterState { +class Finished extends CrowdActionGetterState { final List crowdActions; - const _Finished({required this.crowdActions}); + const Finished({required this.crowdActions}); } class _Failure extends CrowdActionGetterState { final CrowdActionFailure failure; - + const _Failure(this.failure); } diff --git a/lib/application/crowdaction/crowdaction_participants/crowdaction_participants_state.dart b/lib/application/crowdaction/crowdaction_participants/crowdaction_participants_state.dart index b83e0407..31a142c4 100644 --- a/lib/application/crowdaction/crowdaction_participants/crowdaction_participants_state.dart +++ b/lib/application/crowdaction/crowdaction_participants/crowdaction_participants_state.dart @@ -3,15 +3,15 @@ part of 'crowdaction_participants_bloc.dart'; abstract class CrowdActionParticipantsState extends Equatable { const CrowdActionParticipantsState(); - const factory CrowdActionParticipantsState.initial() = _Initial; + const factory CrowdActionParticipantsState.initial() = Initial; const factory CrowdActionParticipantsState.loading() = _Loading; const factory CrowdActionParticipantsState.success({ required List participants, required PageInfo pageInfo, - }) = _Success; + }) = Success; const factory CrowdActionParticipantsState.finished({ required List participants, - }) = _Finished; + }) = Finished; const factory CrowdActionParticipantsState.failure( ParticipationFailure failure, ) = _Failure; @@ -20,25 +20,25 @@ abstract class CrowdActionParticipantsState extends Equatable { List get props => []; } -class _Initial extends CrowdActionParticipantsState { - const _Initial(); +class Initial extends CrowdActionParticipantsState { + const Initial(); } class _Loading extends CrowdActionParticipantsState { const _Loading(); } -class _Success extends CrowdActionParticipantsState { +class Success extends CrowdActionParticipantsState { final List participants; final PageInfo pageInfo; - const _Success({required this.participants, required this.pageInfo}); + const Success({required this.participants, required this.pageInfo}); } -class _Finished extends CrowdActionParticipantsState { +class Finished extends CrowdActionParticipantsState { final List participants; - const _Finished({required this.participants}); + const Finished({required this.participants}); } class _Failure extends CrowdActionParticipantsState { diff --git a/lib/application/crowdaction/spotlight/spotlight_state.dart b/lib/application/crowdaction/spotlight/spotlight_state.dart index e04c105b..a9608fe1 100644 --- a/lib/application/crowdaction/spotlight/spotlight_state.dart +++ b/lib/application/crowdaction/spotlight/spotlight_state.dart @@ -3,46 +3,46 @@ part of 'spotlight_bloc.dart'; abstract class SpotlightState extends Equatable { const SpotlightState(); - const factory SpotlightState.initial() = _Initial; + const factory SpotlightState.initial() = Initial; // Spot light crowd actions const factory SpotlightState.fetchingCrowdSpotLightActions() = - _FetchingSpotLightCrowdActions; + FetchingSpotLightCrowdActions; const factory SpotlightState.spotLightCrowdActionsError( CrowdActionFailure error, - ) = _SpotLightCrowdActionsError; + ) = SpotLightCrowdActionsError; const factory SpotlightState.spotLightCrowdActions( List crowdActions, - ) = _SpotLightCrowdActions; + ) = SpotLightCrowdActions; @override List get props => []; } -class _Initial extends SpotlightState { - const _Initial(); +class Initial extends SpotlightState { + const Initial(); } // Spot light crowd actions -class _FetchingSpotLightCrowdActions extends SpotlightState { - const _FetchingSpotLightCrowdActions(); +class FetchingSpotLightCrowdActions extends SpotlightState { + const FetchingSpotLightCrowdActions(); } -class _SpotLightCrowdActionsError extends SpotlightState { +class SpotLightCrowdActionsError extends SpotlightState { final CrowdActionFailure error; - const _SpotLightCrowdActionsError(this.error); + const SpotLightCrowdActionsError(this.error); @override List get props => [error]; } -class _SpotLightCrowdActions extends SpotlightState { +class SpotLightCrowdActions extends SpotlightState { final List crowdActions; - const _SpotLightCrowdActions(this.crowdActions); + const SpotLightCrowdActions(this.crowdActions); @override List get props => [crowdActions]; diff --git a/lib/application/participation/participation_bloc.dart b/lib/application/participation/participation_bloc.dart index 61ea53ee..3db2f4cb 100644 --- a/lib/application/participation/participation_bloc.dart +++ b/lib/application/participation/participation_bloc.dart @@ -12,7 +12,7 @@ part 'participation_state.dart'; class ParticipationBloc extends Bloc { final IParticipationRepository participationRepository; - ParticipationBloc(this.participationRepository) : super(const _Loading()) { + ParticipationBloc(this.participationRepository) : super(const Loading()) { on((event, emit) async { if (event is _GetParticipation) { final failureOrParticipation = await participationRepository diff --git a/lib/application/participation/participation_state.dart b/lib/application/participation/participation_state.dart index 98f7c2b2..a185f5b7 100644 --- a/lib/application/participation/participation_state.dart +++ b/lib/application/participation/participation_state.dart @@ -3,28 +3,28 @@ part of 'participation_bloc.dart'; abstract class ParticipationState extends Equatable { const ParticipationState(); - const factory ParticipationState.loading() = _Loading; + const factory ParticipationState.loading() = Loading; const factory ParticipationState.participating(Participation participation) = - _Participating; - const factory ParticipationState.notParticipating() = _NotParticipating; + Participating; + const factory ParticipationState.notParticipating() = NotParticipating; @override List get props => []; } -class _Loading extends ParticipationState { - const _Loading(); +class Loading extends ParticipationState { + const Loading(); } -class _Participating extends ParticipationState { +class Participating extends ParticipationState { final Participation participation; - const _Participating(this.participation); + const Participating(this.participation); @override List get props => [participation]; } -class _NotParticipating extends ParticipationState { - const _NotParticipating(); +class NotParticipating extends ParticipationState { + const NotParticipating(); } diff --git a/lib/application/participation/top_participants/top_participants_state.dart b/lib/application/participation/top_participants/top_participants_state.dart index 31f6f3f4..172004d9 100644 --- a/lib/application/participation/top_participants/top_participants_state.dart +++ b/lib/application/participation/top_participants/top_participants_state.dart @@ -4,10 +4,10 @@ abstract class TopParticipantsState extends Equatable { const TopParticipantsState(); const factory TopParticipantsState.initial() = _Initial; - const factory TopParticipantsState.fetching() = _Fetching; + const factory TopParticipantsState.fetching() = Fetching; const factory TopParticipantsState.fetched( List topParticipants, - ) = _Fetched; + ) = Fetched; const factory TopParticipantsState.failure() = _Failure; @override @@ -18,14 +18,14 @@ class _Initial extends TopParticipantsState { const _Initial(); } -class _Fetching extends TopParticipantsState { - const _Fetching(); +class Fetching extends TopParticipantsState { + const Fetching(); } -class _Fetched extends TopParticipantsState { +class Fetched extends TopParticipantsState { final List topParticipants; - const _Fetched(this.topParticipants); + const Fetched(this.topParticipants); @override List get props => [topParticipants]; diff --git a/lib/application/settings/build_information/build_information_state.dart b/lib/application/settings/build_information/build_information_state.dart index ecda4df2..5daa0dcf 100644 --- a/lib/application/settings/build_information/build_information_state.dart +++ b/lib/application/settings/build_information/build_information_state.dart @@ -5,7 +5,7 @@ abstract class BuildInformationState extends Equatable { const factory BuildInformationState.loading() = _Loading; const factory BuildInformationState.fetched(BuildInformation buildInfo) = - _Fetched; + Fetched; @override List get props => []; @@ -15,10 +15,10 @@ class _Loading extends BuildInformationState { const _Loading(); } -class _Fetched extends BuildInformationState { +class Fetched extends BuildInformationState { final BuildInformation buildInfo; - const _Fetched(this.buildInfo); + const Fetched(this.buildInfo); @override List get props => [buildInfo]; diff --git a/lib/application/user/avatar/avatar_state.dart b/lib/application/user/avatar/avatar_state.dart index b054a5ef..d5718e92 100644 --- a/lib/application/user/avatar/avatar_state.dart +++ b/lib/application/user/avatar/avatar_state.dart @@ -2,11 +2,13 @@ part of 'avatar_bloc.dart'; abstract class AvatarState { const AvatarState(); - + const factory AvatarState.initial() = _Initial; const factory AvatarState.uploading() = _Uploading; const factory AvatarState.uploadSuccess() = _UploadSuccess; const factory AvatarState.uploadFailed() = _UploadFailed; + + bool get isUploadSuccess => this is _UploadSuccess; } class _Initial extends AvatarState { diff --git a/lib/application/username/username_state.dart b/lib/application/username/username_state.dart index fbcee9bc..dc5a4cb0 100644 --- a/lib/application/username/username_state.dart +++ b/lib/application/username/username_state.dart @@ -10,6 +10,12 @@ abstract class UsernameState extends Equatable { @override List get props => []; + + bool get isUpdateInProgress => this is _UpdateInProgress; + + bool get isUpdateSuccess => this is _UpdateSuccess; + + String get userFullname => (this as _UpdateSuccess).fullname; } class _Initial extends UsernameState { diff --git a/lib/domain/crowdaction/crowdaction.dart b/lib/domain/crowdaction/crowdaction.dart index d25c52de..be560ad5 100644 --- a/lib/domain/crowdaction/crowdaction.dart +++ b/lib/domain/crowdaction/crowdaction.dart @@ -25,7 +25,6 @@ class CrowdAction extends Equatable { required this.commitments, required this.status, required this.joinStatus, - required this.startAt, required this.endAt, }); @@ -44,7 +43,6 @@ class CrowdAction extends Equatable { .toList(), status: (json['status'] as String).fromStatusJson, joinStatus: (json['joinStatus'] as String).fromJoinStatusJson, - startAt: json['startAt'] as DateTime, endAt: json['endAt'] as DateTime, ); @@ -72,8 +70,6 @@ class CrowdAction extends Equatable { final JoinStatus joinStatus; - final DateTime startAt; - final DateTime endAt; CrowdAction copyWith({ @@ -89,7 +85,6 @@ class CrowdAction extends Equatable { List? commitments, Status? status, JoinStatus? joinStatus, - DateTime? startAt, DateTime? endAt, }) { return CrowdAction( @@ -105,7 +100,6 @@ class CrowdAction extends Equatable { commitments: commitments ?? this.commitments, status: status ?? this.status, joinStatus: joinStatus ?? this.joinStatus, - startAt: startAt ?? this.startAt, endAt: endAt ?? this.endAt, ); } @@ -124,7 +118,6 @@ class CrowdAction extends Equatable { commitments, status, joinStatus, - startAt, endAt, ]; @@ -141,7 +134,6 @@ class CrowdAction extends Equatable { 'commitments': commitments.map((e) => e.toJson()), 'status': status.toJson, 'joinStatus': joinStatus.toJson, - 'startAt': startAt, 'endAt': endAt, }; diff --git a/lib/infrastructure/crowdaction/crowdaction_dto.dart b/lib/infrastructure/crowdaction/crowdaction_dto.dart index e900041e..6440ad2b 100644 --- a/lib/infrastructure/crowdaction/crowdaction_dto.dart +++ b/lib/infrastructure/crowdaction/crowdaction_dto.dart @@ -37,7 +37,6 @@ class CrowdActionDto extends Equatable { status: status, joinStatus: joinStatus, endAt: DateTime.parse(endAt), - startAt: DateTime.parse(startAt), password: password, subcategory: subcategory, ); diff --git a/lib/presentation/auth/auth_screen.dart b/lib/presentation/auth/auth_screen.dart index 551ad4b2..09579dc1 100644 --- a/lib/presentation/auth/auth_screen.dart +++ b/lib/presentation/auth/auth_screen.dart @@ -5,6 +5,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import '../../application/auth/auth_bloc.dart'; import '../../application/user/profile/profile_bloc.dart'; +import '../../domain/auth/auth_failures.dart' as $auth_failure; import '../routes/app_routes.gr.dart'; import '../shared_widgets/custom_app_bars/custom_appbar.dart'; import '../themes/constants.dart'; @@ -40,29 +41,35 @@ class AuthPageState extends State { Widget build(BuildContext context) { return BlocListener( listener: (context, state) { - state.maybeMap( - smsCodeSent: (_) => _toPage(1), - loggedIn: (loggedInState) { - if (loggedInState.isNewUser) { - // TODO: We need to improve this flow on the backend - this makes sure profile is created - BlocProvider.of(context).add(GetUserProfile()); - _toPage(2); - } else { - _authDone(context); - } - }, - authError: (authError) => context.showErrorSnack( - authError.failure.map( - serverError: (_) => "Server Error", - invalidPhone: (_) => "Invalid Phone", - verificationFailed: (_) => "Verification Failed", - networkRequestFailed: (_) => "No Internet connection", - invalidSmsCode: (_) => "Invalid SMS Code", - ), - ), - photoUpdateDone: (_) => _authDone(context), - orElse: () {}, - ); + if (state is SmsCodeSent) { + _toPage(1); + } else if (state is LoggedIn) { + if (state.isNewUser) { + // TODO: We need to improve this flow on the backend - this makes sure profile is created + BlocProvider.of(context).add(GetUserProfile()); + _toPage(2); + } else { + _authDone(context); + } + } else if (state is AuthError) { + String message = 'Error'; + + if (state.failure is $auth_failure.ServerError) { + message = "Server Error"; + } else if (state.failure is $auth_failure.NetworkRequestFailed) { + message = "No Internet connection"; + } else if (state.failure is $auth_failure.InvalidPhone) { + message = "Invalid Phone"; + } else if (state.failure is $auth_failure.InvalidSmsCode) { + message = "Invalid SMS Code"; + } else if (state.failure is $auth_failure.VerificationFailed) { + message = "Verification Failed"; + } + + context.showErrorSnack(message); + } else if (state is ProfilePhotoUpdateDone) { + _authDone(context); + } }, child: Scaffold( resizeToAvoidBottomInset: true, diff --git a/lib/presentation/auth/widgets/enter_username.dart b/lib/presentation/auth/widgets/enter_username.dart index b6d0c16a..e786f495 100644 --- a/lib/presentation/auth/widgets/enter_username.dart +++ b/lib/presentation/auth/widgets/enter_username.dart @@ -32,18 +32,9 @@ class EnterUserNameState extends State { create: (context) => getIt(), child: BlocListener( listener: (context, state) { - state.when( - initial: () {}, - updateInProgress: () { - /// TODO: Loading indication - }, - updateSuccess: (fullname) { - widget.onDone(fullname); - }, - updateFailure: () { - /// TODO: Show error snackbar | Implement failures - }, - ); + if (state.isUpdateSuccess) { + widget.onDone(state.userFullname); + } }, child: BlocBuilder( builder: (context, state) { @@ -175,21 +166,10 @@ class EnterUserNameState extends State { Expanded( child: PillButton( text: 'Next', - isLoading: state.maybeWhen( - orElse: () => false, - updateInProgress: () => true, - ), - isEnabled: state.maybeWhen( - orElse: () => true, - updateInProgress: () => false, - ) && - _isNameValid, + isLoading: state.isUpdateInProgress, + isEnabled: !state.isUpdateInProgress && _isNameValid, onTap: () { - if (_isNameValid && - state.maybeWhen( - orElse: () => true, - updateInProgress: () => false, - )) { + if (_isNameValid && !state.isUpdateInProgress) { FocusScope.of(context).unfocus(); context.read().add( UsernameEvent.updateUsername( diff --git a/lib/presentation/auth/widgets/profile_photo.dart b/lib/presentation/auth/widgets/profile_photo.dart index 0d4ff7ec..35755572 100644 --- a/lib/presentation/auth/widgets/profile_photo.dart +++ b/lib/presentation/auth/widgets/profile_photo.dart @@ -37,18 +37,9 @@ class SelectProfilePhotoState extends State { create: (context) => avatarBloc, child: BlocListener( listener: (context, state) { - state.when( - initial: () {}, - uploading: () { - /// TODO: Loading indication - }, - uploadSuccess: () { - context.router.pop(); - }, - uploadFailed: () { - /// TODO: Show error snackbar | Implement failures - }, - ); + if(state.isUploadSuccess){ + context.router.pop(); + } }, child: BlocBuilder( builder: (context, state) { diff --git a/lib/presentation/auth/widgets/verification_code.dart b/lib/presentation/auth/widgets/verification_code.dart index fa73e62b..42c09949 100644 --- a/lib/presentation/auth/widgets/verification_code.dart +++ b/lib/presentation/auth/widgets/verification_code.dart @@ -21,10 +21,9 @@ class EnterVerificationCodeState extends State { Widget build(BuildContext context) { return BlocConsumer( listener: (context, state) { - state.mapOrNull( - verificationCompleted: (verificationState) => - _pinKey.currentState?.autoComplete(verificationState.smsCode), - ); + if (state is VerificationCompleted) { + _pinKey.currentState?.autoComplete(state.smsCode); + } }, builder: (context, state) { return Column( diff --git a/lib/presentation/contact_form/widgets/contact_form.dart b/lib/presentation/contact_form/widgets/contact_form.dart index a7260a40..bcfa97bf 100644 --- a/lib/presentation/contact_form/widgets/contact_form.dart +++ b/lib/presentation/contact_form/widgets/contact_form.dart @@ -39,11 +39,8 @@ class _ContactFormState extends State { listener: _contactFormBlocListener, bloc: _contactFormBloc, builder: (context, state) { - final isEnabled = state.maybeMap( - initial: (_) => true, - failed: (_) => true, - orElse: () => false, - ); + final isEnabled = state is Initial || state is Failed; + return Form( key: _formKey, child: Column( @@ -177,30 +174,26 @@ class _ContactFormState extends State { void _contactFormBlocListener(BuildContext context, ContactFormState state) { ScaffoldMessenger.of(context).removeCurrentSnackBar(); - state.map( - initial: (_) {}, - submitting: (_) {}, - submissionSuccessful: (_) { - ScaffoldMessenger.of(context) - .showSnackBar( - const SnackBar( - content: - Text('Success! Thank you for contacting us \ud83d\ude42'), - behavior: SnackBarBehavior.floating, - ), - ) - .closed - .then((value) => Navigator.pop(context)); - }, - failed: (_) { - ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text('Error! Failed to submit form.'), - behavior: SnackBarBehavior.floating, - ), - ); - }, - ); + + if (state is SubmissionSuccessful) { + ScaffoldMessenger.of(context) + .showSnackBar( + const SnackBar( + content: + Text('Success! Thank you for contacting us \ud83d\ude42'), + behavior: SnackBarBehavior.floating, + ), + ) + .closed + .then((value) => Navigator.pop(context)); + } else if (state is Failed) { + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar( + content: Text('Error! Failed to submit form.'), + behavior: SnackBarBehavior.floating, + ), + ); + } } String? _validateEmail(String? value) { diff --git a/lib/presentation/core/app_widget.dart b/lib/presentation/core/app_widget.dart index db9b4925..375ecb7f 100644 --- a/lib/presentation/core/app_widget.dart +++ b/lib/presentation/core/app_widget.dart @@ -30,11 +30,9 @@ class AppWidget extends StatelessWidget { BlocProvider.of(context).add(GetUserProfile()); BlocProvider.of(context).add(FetchProfileTabInfo()); - state.whenOrNull( - unauthenticated: () { - _appRouter.replaceAll([const UnauthenticatedRoute()]); - }, - ); + if (state is Authenticated) { + _appRouter.replaceAll([const UnauthenticatedRoute()]); + } }, child: MaterialApp.router( color: Colors.white, diff --git a/lib/presentation/crowdaction/crowdaction_browse/crowdaction_browse_screen.dart b/lib/presentation/crowdaction/crowdaction_browse/crowdaction_browse_screen.dart index 6e73504d..022f3dd5 100644 --- a/lib/presentation/crowdaction/crowdaction_browse/crowdaction_browse_screen.dart +++ b/lib/presentation/crowdaction/crowdaction_browse/crowdaction_browse_screen.dart @@ -22,34 +22,28 @@ class CrowdActionBrowsePage extends StatelessWidget { ..add(const CrowdActionGetterEvent.init()), child: BlocListener( listener: (context, state) { - state.map( - initial: (_) { - pagingController.addPageRequestListener((pageKey) { - BlocProvider.of(context).add( - CrowdActionGetterEvent.getCrowdActions( - pageNumber: pageKey, - ), - ); - }); - + if (state is Initial) { + pagingController.addPageRequestListener((pageKey) { BlocProvider.of(context).add( - const CrowdActionGetterEvent.getCrowdActions( - pageNumber: 1, + CrowdActionGetterEvent.getCrowdActions( + pageNumber: pageKey, ), ); - }, - loading: (_) {}, - success: (state) { - pagingController.appendPage( - state.crowdActions, - state.pageInfo.page + 1, - ); - }, - finished: (state) { - pagingController.appendLastPage(state.crowdActions); - }, - failure: (_) {}, - ); + }); + + BlocProvider.of(context).add( + const CrowdActionGetterEvent.getCrowdActions( + pageNumber: 1, + ), + ); + } else if (state is Success) { + pagingController.appendPage( + state.crowdActions, + state.pageInfo.page + 1, + ); + } else if (state is Finished) { + pagingController.appendLastPage(state.crowdActions); + } }, child: Scaffold( appBar: const CustomAppBar( diff --git a/lib/presentation/crowdaction/crowdaction_details/crowdaction_details_screen.dart b/lib/presentation/crowdaction/crowdaction_details/crowdaction_details_screen.dart index 0cc56950..64152e12 100644 --- a/lib/presentation/crowdaction/crowdaction_details/crowdaction_details_screen.dart +++ b/lib/presentation/crowdaction/crowdaction_details/crowdaction_details_screen.dart @@ -82,18 +82,16 @@ class CrowdActionDetailsPageState extends State { listeners: [ BlocListener( listener: (context, state) { - state.whenOrNull( - participating: (p) { - setState(() { - selectedCommitments.clear(); - for (final id in p.commitments) { - selectedCommitments.add( - crowdAction!.commitments.firstWhere((c) => c.id == id), - ); - } - }); - }, - ); + if (state is Participating) { + setState(() { + selectedCommitments.clear(); + for (final id in state.participation.commitments) { + selectedCommitments.add( + crowdAction!.commitments.firstWhere((c) => c.id == id), + ); + } + }); + } BlocProvider.of(context).add( CrowdActionDetailsEvent.fetchCrowdAction(id: id), @@ -106,20 +104,18 @@ class CrowdActionDetailsPageState extends State { ), BlocListener( listener: (context, state) { - state.maybeWhen( - authenticated: (_) => participate = _participateModal, - orElse: () => participate = _signUpModal, - ); + if (state is Authenticated) { + participate = _participateModal; + } else { + participate = _signUpModal; + } }, ), BlocListener( listener: (context, state) { - state.maybeMap( - loadSuccess: (state) { - crowdAction = state.crowdAction; - }, - orElse: () {}, - ); + if (state is LoadSuccess) { + crowdAction = state.crowdAction; + } }, ), ], @@ -132,18 +128,18 @@ class CrowdActionDetailsPageState extends State { return BlocBuilder( builder: (context, state) { return Scaffold( - floatingActionButton: state.when( - loading: () => const PillButton( - text: "Participate", - isEnabled: false, - isLoading: true, - ), - notParticipating: () => PillButton( - text: "Participate", - onTap: () => participate.call(context), - ), - participating: (_) => const SizedBox.shrink(), - ), + floatingActionButton: state is Loading + ? const PillButton( + text: "Participate", + isEnabled: false, + isLoading: true, + ) + : state is NotParticipating + ? PillButton( + text: "Participate", + onTap: () => participate.call(context), + ) + : const SizedBox.shrink(), floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat, body: NestedScrollView( @@ -246,10 +242,7 @@ class CrowdActionDetailsPageState extends State { child: WithdrawParticipation( participationBloc: participationBloc, crowdAction: crowdAction!, - isParticipating: state.whenOrNull( - participating: (_) => true, - ) ?? - false, + isParticipating: state is Participating, ), ), const SizedBox(height: 70), diff --git a/lib/presentation/crowdaction/crowdaction_details/widgets/confirm_participation.dart b/lib/presentation/crowdaction/crowdaction_details/widgets/confirm_participation.dart index d6cbf014..5aa83ee8 100644 --- a/lib/presentation/crowdaction/crowdaction_details/widgets/confirm_participation.dart +++ b/lib/presentation/crowdaction/crowdaction_details/widgets/confirm_participation.dart @@ -23,14 +23,15 @@ class ConfirmParticipation extends StatelessWidget { return BlocBuilder( bloc: BlocProvider.of(context), builder: (context, state) { - return state.maybeWhen( - orElse: () => ParticipationDialog( + if (state is Participating) { + return ParticipationSuccess(); + } else { + return ParticipationDialog( crowdAction: crowdAction, selectedCommitments: selectedCommitments, - isLoading: state.mapOrNull(loading: (_) => true) ?? false, - ), - participating: (_) => ParticipationSuccess(), - ); + isLoading: state is Loading, + ); + } }, ); } diff --git a/lib/presentation/crowdaction/crowdaction_details/widgets/participation_count_text.dart b/lib/presentation/crowdaction/crowdaction_details/widgets/participation_count_text.dart index 38fe58cb..86629858 100644 --- a/lib/presentation/crowdaction/crowdaction_details/widgets/participation_count_text.dart +++ b/lib/presentation/crowdaction/crowdaction_details/widgets/participation_count_text.dart @@ -37,35 +37,32 @@ class ParticipationCountText extends StatelessWidget { value: getDetailsBloc(context), child: BlocBuilder( builder: (context, state) { - return state.when( - initial: () { - if (crowdAction != null) { - return participantCountText( - context, - crowdAction!.participantCount, - ); - } - - return shimmer(context); - }, - loadInProgress: () { - if (crowdAction == null) { - return shimmer(context); - } - + if (state is Initial) { + if (crowdAction != null) { return participantCountText( context, crowdAction!.participantCount, ); - }, - loadSuccess: (crowdAction) { - return participantCountText( - context, - crowdAction.participantCount, - ); - }, - loadFailure: (_) => shimmer(context), - ); + } + + return shimmer(context); + } else if (state is LoadInProgress) { + if (crowdAction == null) { + return shimmer(context); + } + + return participantCountText( + context, + crowdAction!.participantCount, + ); + } else if (state is LoadSuccess) { + return participantCountText( + context, + state.crowdAction.participantCount, + ); + } else { + return shimmer(context); + } }, ), ); diff --git a/lib/presentation/crowdaction/crowdaction_details/widgets/withdraw_participation.dart b/lib/presentation/crowdaction/crowdaction_details/widgets/withdraw_participation.dart index 513b3f92..c5eeea4d 100644 --- a/lib/presentation/crowdaction/crowdaction_details/widgets/withdraw_participation.dart +++ b/lib/presentation/crowdaction/crowdaction_details/widgets/withdraw_participation.dart @@ -52,130 +52,125 @@ class WithdrawParticipation extends StatelessWidget { return BlocBuilder( bloc: participationBloc, builder: (context, state) { - return state.maybeWhen( - notParticipating: () { - return Container( - padding: const EdgeInsets.symmetric(horizontal: 20), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - const SizedBox( - height: 15, - ), - Container( - width: 60.0, - height: 5.0, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.0), - color: kSecondaryTransparent, - ), - ), - const SizedBox( - height: 20, - ), - Text( - crowdAction.title, - textAlign: TextAlign.center, - style: Theme.of(context) - .textTheme - .titleMedium - ?.copyWith(fontWeight: FontWeight.bold), - ), - const SizedBox( - height: 28, - ), - Text( - "We are sad to see you withdraw!", - textAlign: TextAlign.center, - style: - Theme.of(context).textTheme.titleMedium?.copyWith( - fontWeight: FontWeight.bold, - fontSize: 28, - ), - ), - const SizedBox( - height: 20, - ), - PillButton( - text: "Got It", - onTap: () { - Navigator.pop(context); - }, - margin: EdgeInsets.zero, - ), - const SizedBox(height: 20), - ], - ), - ); - }, - orElse: () { - return Container( - padding: const EdgeInsets.symmetric(horizontal: 20), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - const SizedBox( - height: 15, - ), - Container( - width: 60.0, - height: 5.0, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.0), - color: kSecondaryTransparent, - ), - ), - const SizedBox( - height: 20, - ), - Text( - "We’d love to keep you", - textAlign: TextAlign.center, - style: Theme.of(context) - .textTheme - .titleMedium - ?.copyWith(fontWeight: FontWeight.bold), - ), - const SizedBox( - height: 30, - ), - Text( - "You are about to cancel your participation. You are free to sign up for this CrowdAction again any time before it starts.", - style: Theme.of(context).textTheme.bodySmall?.copyWith( - color: kPrimaryColor400, - ), - ), - const SizedBox( - height: 20, + if (state is NotParticipating) { + return Container( + padding: const EdgeInsets.symmetric(horizontal: 20), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + const SizedBox( + height: 15, + ), + Container( + width: 60.0, + height: 5.0, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10.0), + color: kSecondaryTransparent, ), - PillButton( - text: "Cancel my participation", - isLoading: - state.mapOrNull(loading: (_) => true) ?? false, - onTap: () => participationBloc.add( - ParticipationEvent.toggleParticipation( - crowdActionId: crowdAction.id, + ), + const SizedBox( + height: 20, + ), + Text( + crowdAction.title, + textAlign: TextAlign.center, + style: Theme.of(context) + .textTheme + .titleMedium + ?.copyWith(fontWeight: FontWeight.bold), + ), + const SizedBox( + height: 28, + ), + Text( + "We are sad to see you withdraw!", + textAlign: TextAlign.center, + style: Theme.of(context).textTheme.titleMedium?.copyWith( + fontWeight: FontWeight.bold, + fontSize: 28, ), - ), - margin: EdgeInsets.zero, + ), + const SizedBox( + height: 20, + ), + PillButton( + text: "Got It", + onTap: () { + Navigator.pop(context); + }, + margin: EdgeInsets.zero, + ), + const SizedBox(height: 20), + ], + ), + ); + } else { + return Container( + padding: const EdgeInsets.symmetric(horizontal: 20), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + const SizedBox( + height: 15, + ), + Container( + width: 60.0, + height: 5.0, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10.0), + color: kSecondaryTransparent, ), - const SizedBox(height: 20), - SizedBox( - width: double.infinity, - height: 52, - child: TextButton( - onPressed: () => context.router.pop(), - child: const Text("Cancel"), + ), + const SizedBox( + height: 20, + ), + Text( + "We’d love to keep you", + textAlign: TextAlign.center, + style: Theme.of(context) + .textTheme + .titleMedium + ?.copyWith(fontWeight: FontWeight.bold), + ), + const SizedBox( + height: 30, + ), + Text( + "You are about to cancel your participation. You are free to sign up for this CrowdAction again any time before it starts.", + style: Theme.of(context).textTheme.bodySmall?.copyWith( + color: kPrimaryColor400, + ), + ), + const SizedBox( + height: 20, + ), + PillButton( + text: "Cancel my participation", + isLoading: state is Loading, + onTap: () => participationBloc.add( + ParticipationEvent.toggleParticipation( + crowdActionId: crowdAction.id, ), ), - const SizedBox( - height: 15, + margin: EdgeInsets.zero, + ), + const SizedBox(height: 20), + SizedBox( + width: double.infinity, + height: 52, + child: TextButton( + onPressed: () => context.router.pop(), + child: const Text("Cancel"), ), - ], - ), - ); - }, - ); + ), + const SizedBox( + height: 15, + ), + ], + ), + ); + } }, ); }, diff --git a/lib/presentation/crowdaction/crowdaction_home/widgets/in_spotlight_header.dart b/lib/presentation/crowdaction/crowdaction_home/widgets/in_spotlight_header.dart index 03a69c4c..74a45ba4 100644 --- a/lib/presentation/crowdaction/crowdaction_home/widgets/in_spotlight_header.dart +++ b/lib/presentation/crowdaction/crowdaction_home/widgets/in_spotlight_header.dart @@ -48,20 +48,17 @@ class _InSpotLightHeaderState extends State { ), BlocBuilder( builder: (context, state) { - return state.maybeWhen( - fetchingCrowdSpotLightActions: () { - return const SpotlightEmptyHeader(); - }, - spotLightCrowdActionsError: (_) { - return const ContentPlaceholder( - textColor: Colors.white, - ); - }, - spotLightCrowdActions: (pages) { - return SpotlightCrowdActions(pages: pages); - }, - orElse: () => const SizedBox(), - ); + if (state is FetchingSpotLightCrowdActions) { + return const SpotlightEmptyHeader(); + } else if (state is SpotLightCrowdActionsError) { + return const ContentPlaceholder( + textColor: Colors.white, + ); + } else if (state is SpotLightCrowdActions) { + return SpotlightCrowdActions(pages: state.crowdActions); + } else { + return const SizedBox(); + } }, ), const SizedBox( diff --git a/lib/presentation/crowdaction/crowdaction_participants/crowdaction_participants_screen.dart b/lib/presentation/crowdaction/crowdaction_participants/crowdaction_participants_screen.dart index aaab2124..a99bc273 100644 --- a/lib/presentation/crowdaction/crowdaction_participants/crowdaction_participants_screen.dart +++ b/lib/presentation/crowdaction/crowdaction_participants/crowdaction_participants_screen.dart @@ -27,36 +27,30 @@ class CrowdActionParticipantsPage extends StatelessWidget { child: BlocListener( listener: (context, state) { - state.map( - initial: (_) { - pagingController.addPageRequestListener((pageKey) { - BlocProvider.of(context).add( - CrowdActionParticipantsEvent.getParticipants( - crowdActionId: crowdActionId, - pageNumber: pageKey, - ), - ); - }); - + if (state is Initial) { + pagingController.addPageRequestListener((pageKey) { BlocProvider.of(context).add( CrowdActionParticipantsEvent.getParticipants( crowdActionId: crowdActionId, - pageNumber: 1, + pageNumber: pageKey, ), ); - }, - loading: (_) {}, - success: (state) { - pagingController.appendPage( - state.participants, - state.pageInfo.page + 1, - ); - }, - finished: (state) { - pagingController.appendLastPage(state.participants); - }, - failure: (_) {}, - ); + }); + + BlocProvider.of(context).add( + CrowdActionParticipantsEvent.getParticipants( + crowdActionId: crowdActionId, + pageNumber: 1, + ), + ); + } else if (state is Success) { + pagingController.appendPage( + state.participants, + state.pageInfo.page + 1, + ); + }else if(state is Finished){ + pagingController.appendLastPage(state.participants); + } }, child: Scaffold( appBar: AppBar( diff --git a/lib/presentation/home/widgets/crowdaction_carousel.dart b/lib/presentation/home/widgets/crowdaction_carousel.dart index 73645866..7fa68d34 100644 --- a/lib/presentation/home/widgets/crowdaction_carousel.dart +++ b/lib/presentation/home/widgets/crowdaction_carousel.dart @@ -35,19 +35,14 @@ class CrowdActionCarouselState extends State { return BlocProvider( create: (context) => getIt() ..add(const SpotlightEvent.getSpotLightCrowdActions()), - child: BlocBuilder( - builder: (context, state) => state.when( - initial: () => const CircularProgressIndicator(), - fetchingCrowdSpotLightActions: () { - // TODO: Shimmer - return const Center( - child: CircularProgressIndicator(), - ); - }, - spotLightCrowdActionsError: (failure) { - return const Text('Something went wrong!'); - }, - spotLightCrowdActions: (crowdActions) => Column( + child: + BlocBuilder(builder: (context, state) { + if (state is SpotLightCrowdActionsError) { + return const Text('Something went wrong!'); + } else if (state is SpotLightCrowdActions) { + final crowdActions = state.crowdActions; + + return Column( children: [ ScrollConfiguration( behavior: NoRippleBehavior(), @@ -79,9 +74,13 @@ class CrowdActionCarouselState extends State { }, ) ], - ), - ), - ), + ); + } else { + return const Center( + child: CircularProgressIndicator(), + ); + } + }), ); } } diff --git a/lib/presentation/home/widgets/current_upcoming_layout.dart b/lib/presentation/home/widgets/current_upcoming_layout.dart index 593bddc1..06e051ee 100644 --- a/lib/presentation/home/widgets/current_upcoming_layout.dart +++ b/lib/presentation/home/widgets/current_upcoming_layout.dart @@ -69,16 +69,17 @@ class _CurrentAndUpcomingLayoutState extends State { ], ), ), - state.maybeMap( - fetchingCrowdSpotLightActions: (_) => _loading(), - spotLightCrowdActions: (fetchedData) { - if (fetchedData.crowdActions.isEmpty) { + Builder(builder: (context) { + if (state is FetchingSpotLightCrowdActions) { + return _loading(); + } else if (state is SpotLightCrowdActions) { + if (state.crowdActions.isEmpty) { return _loading(); } return Column( children: [ - ...fetchedData.crowdActions + ...state.crowdActions .map( (crowdAction) => Padding( padding: const EdgeInsets.symmetric( @@ -91,13 +92,14 @@ class _CurrentAndUpcomingLayoutState extends State { .toList(), ], ); - }, - spotLightCrowdActionsError: (failure) => - const ContentPlaceholder( - textColor: Colors.black, - ), - orElse: () => const SizedBox(), - ), + } else if (state is SpotLightCrowdActionsError) { + return const ContentPlaceholder( + textColor: Colors.black, + ); + } else { + return const SizedBox(); + } + }) ], ), ); diff --git a/lib/presentation/settings/settings_screen.dart b/lib/presentation/settings/settings_screen.dart index 1689e386..dfe2b242 100644 --- a/lib/presentation/settings/settings_screen.dart +++ b/lib/presentation/settings/settings_screen.dart @@ -110,11 +110,13 @@ class SettingsPage extends StatelessWidget { bloc: getIt() ..add(const BuildInformationEvent.fetch()), builder: (context, state) { - return state.when( - loading: () => const SizedBox(), - fetched: (buildInfo) => - BuildInformationTile(information: buildInfo), - ); + if (state is Fetched) { + return BuildInformationTile( + information: state.buildInfo, + ); + } + + return const SizedBox(); }, ), ], diff --git a/lib/presentation/shared_widgets/commitments/commitment_card_list.dart b/lib/presentation/shared_widgets/commitments/commitment_card_list.dart index 606901ad..91f41979 100644 --- a/lib/presentation/shared_widgets/commitments/commitment_card_list.dart +++ b/lib/presentation/shared_widgets/commitments/commitment_card_list.dart @@ -41,11 +41,7 @@ class _CommitmentCardListState extends State { ); } - bool isParticipating = false; - - state.mapOrNull( - participating: (_) => isParticipating = true, - ); + bool isParticipating = state is Participating; return ListView.builder( padding: const EdgeInsets.symmetric(horizontal: 20), diff --git a/lib/presentation/shared_widgets/content_placeholder.dart b/lib/presentation/shared_widgets/content_placeholder.dart index fd680513..d43e1638 100644 --- a/lib/presentation/shared_widgets/content_placeholder.dart +++ b/lib/presentation/shared_widgets/content_placeholder.dart @@ -21,11 +21,7 @@ class ContentPlaceholder extends StatelessWidget { getIt()..add(const AuthEvent.authCheckRequested()), child: BlocBuilder( builder: (context, state) { - final signedIn = state.maybeWhen( - orElse: () => false, - authenticated: (_) => true, - unauthenticated: () => false, - ); + final signedIn = state is Authenticated; return Padding( padding: const EdgeInsets.all(8.0), diff --git a/lib/presentation/shared_widgets/participant_avatars.dart b/lib/presentation/shared_widgets/participant_avatars.dart index a357f1cb..ad956dee 100644 --- a/lib/presentation/shared_widgets/participant_avatars.dart +++ b/lib/presentation/shared_widgets/participant_avatars.dart @@ -31,14 +31,16 @@ class TopParticipantAvatars extends StatelessWidget { ), child: BlocBuilder( builder: (context, state) { - return state.map( - initial: (_) => const SizedBox.shrink(), - fetching: (_) => Shimmer.fromColors( + if (state is Fetching) { + return Shimmer.fromColors( baseColor: kPrimaryColor100, highlightColor: kPrimaryColor200, child: const TopParticipantsShimmer(), - ), - fetched: (state) => SizedBox( + ); + } + + if (state is Fetched) { + return SizedBox( width: state.topParticipants.length == 1 ? 40.0 : state.topParticipants.length == 3 @@ -57,9 +59,10 @@ class TopParticipantAvatars extends StatelessWidget { ) .toList(), ), - ), - failure: (_) => const SizedBox.shrink(), - ); + ); + } + + return const SizedBox.shrink(); }, ), ); From 8b9cd42ae8dd2732fdba639babc84f4ca11a202e Mon Sep 17 00:00:00 2001 From: Isaac Obella Date: Mon, 6 Mar 2023 15:30:27 +0300 Subject: [PATCH 7/8] test: Migrate tests Signed-off-by: Isaac Obella --- lib/application/auth/auth_bloc.dart | 10 +- lib/application/auth/auth_event.dart | 4 +- lib/domain/auth/auth_success.dart | 18 +- lib/domain/contact_form/contact_failures.dart | 7 +- .../crowdaction/crowdaction_comment.dart | 21 +- lib/domain/crowdaction/models/commitment.dart | 3 +- lib/domain/participation/participation.dart | 4 +- lib/domain/profile/user_profile.dart | 12 +- .../crowdaction/crowdaction_comment_dto.dart | 8 +- .../crowdaction/crowdaction_dto.dart | 5 - .../crowdaction/models/commitment_dto.dart | 4 +- .../participation/participation_dto.dart | 28 +- pubspec.lock | 1546 +++++++++++++++++ pubspec.yaml | 2 - test/domain/crowdaction/crowdaction_test.dart | 2 +- .../settings/build_information_test.dart | 2 +- 16 files changed, 1614 insertions(+), 62 deletions(-) create mode 100644 pubspec.lock diff --git a/lib/application/auth/auth_bloc.dart b/lib/application/auth/auth_bloc.dart index 233bada4..085a057f 100644 --- a/lib/application/auth/auth_bloc.dart +++ b/lib/application/auth/auth_bloc.dart @@ -7,7 +7,7 @@ import 'package:equatable/equatable.dart'; import 'package:injectable/injectable.dart'; import '../../domain/auth/auth_failures.dart'; -import '../../domain/auth/auth_success.dart'; +import '../../domain/auth/auth_success.dart' as $auth_success; import '../../domain/auth/i_auth_repository.dart'; import '../../domain/user/i_avatar_repository.dart'; import '../../domain/user/i_user_repository.dart'; @@ -23,7 +23,7 @@ class AuthBloc extends Bloc { Credential? _credential; String? _phone; - StreamSubscription>? + StreamSubscription>? _verifyStreamSubscription; StreamSubscription? _authenticationStateSubscription; @@ -140,11 +140,11 @@ class AuthBloc extends Bloc { (r) { _credential = r.credential; - if (r is SmsCodeSent) { + if (r is $auth_success.SmsCodeSent) { return const AuthState.smsCodeSent(); - } else if (r is _CodeRetrievalTimedOut) { + } else if (r is $auth_success.CodeRetrievalTimedOut) { return const AuthState.codeRetrievalTimedOut(); - } else if (r is VerificationCompleted) { + } else if (r is $auth_success.VerificationCompleted) { return AuthState.verificationCompleted( _credential?.smsCode ?? '', ); diff --git a/lib/application/auth/auth_event.dart b/lib/application/auth/auth_event.dart index 0bcde3dc..18d45176 100644 --- a/lib/application/auth/auth_event.dart +++ b/lib/application/auth/auth_event.dart @@ -8,7 +8,7 @@ abstract class AuthEvent extends Equatable { const factory AuthEvent.verifyPhone(String phoneNumber) = _VerifyPhone; const factory AuthEvent.updated( - Either failureOrCredential, + Either failureOrCredential, ) = _Updated; const factory AuthEvent.signInWithPhone(String smsCode) = _SignInWithPhone; @@ -43,7 +43,7 @@ class _VerifyPhone extends AuthEvent { } class _Updated extends AuthEvent { - final Either failureOrCredential; + final Either failureOrCredential; const _Updated(this.failureOrCredential); diff --git a/lib/domain/auth/auth_success.dart b/lib/domain/auth/auth_success.dart index 1209b9f0..03d0c7ff 100644 --- a/lib/domain/auth/auth_success.dart +++ b/lib/domain/auth/auth_success.dart @@ -8,28 +8,28 @@ abstract class AuthSuccess extends Equatable { const AuthSuccess({required this.credential}); const factory AuthSuccess.codeSent({required Credential credential}) = - _SmsCodeSent; + SmsCodeSent; const factory AuthSuccess.codeRetrievalTimedOut({ required Credential credential, - }) = _CodeRetrievalTimedOut; + }) = CodeRetrievalTimedOut; const factory AuthSuccess.verificationCompleted({ required Credential credential, - }) = _VerificationCompleted; + }) = VerificationCompleted; @override List get props => [credential]; } -class _SmsCodeSent extends AuthSuccess { - const _SmsCodeSent({required super.credential}); +class SmsCodeSent extends AuthSuccess { + const SmsCodeSent({required super.credential}); } -class _CodeRetrievalTimedOut extends AuthSuccess { - const _CodeRetrievalTimedOut({required super.credential}); +class CodeRetrievalTimedOut extends AuthSuccess { + const CodeRetrievalTimedOut({required super.credential}); } -class _VerificationCompleted extends AuthSuccess { - const _VerificationCompleted({required super.credential}); +class VerificationCompleted extends AuthSuccess { + const VerificationCompleted({required super.credential}); } diff --git a/lib/domain/contact_form/contact_failures.dart b/lib/domain/contact_form/contact_failures.dart index 0b2ea199..32068a1c 100644 --- a/lib/domain/contact_form/contact_failures.dart +++ b/lib/domain/contact_form/contact_failures.dart @@ -1,8 +1,13 @@ -abstract class ContactFailure { +import 'package:equatable/equatable.dart'; + +abstract class ContactFailure extends Equatable { const ContactFailure(); const factory ContactFailure.serverError() = ServerError; const factory ContactFailure.unexpectedError() = UnexpectedError; + + @override + List get props => []; } class ServerError extends ContactFailure { diff --git a/lib/domain/crowdaction/crowdaction_comment.dart b/lib/domain/crowdaction/crowdaction_comment.dart index 8fbff979..edebe2a7 100644 --- a/lib/domain/crowdaction/crowdaction_comment.dart +++ b/lib/domain/crowdaction/crowdaction_comment.dart @@ -1,8 +1,7 @@ import 'package:equatable/equatable.dart'; class CrowdactionComment extends Equatable { - - const CrowdactionComment({ + const CrowdactionComment({ required this.crowdactionId, required this.content, required this.userId, @@ -14,16 +13,21 @@ class CrowdactionComment extends Equatable { this.flags, }); - factory CrowdactionComment.fromJson(Map json) => CrowdactionComment( + factory CrowdactionComment.fromJson(Map json) => + CrowdactionComment( crowdactionId: json['crowdactionId'] as String, content: json['content'] as String, userId: json['userId'] as String, createdAt: DateTime.tryParse(json['createdAt'] as String? ?? '')!, - comments: json['comments'] as List?, + comments: (json['comments'] as List?) + ?.map((e) => e.toString()) + .toList(), likes: json['likes'] as int, likedByMe: json['likedByMe'] as bool, flagged: json['flagged'] as bool?, - flags: json['flags'] as List?, + flags: (json['flags'] as List?) + ?.map((e) => e.toString()) + .toList(), ); /// A description for crowdactionId @@ -53,7 +57,7 @@ class CrowdactionComment extends Equatable { /// A description for flags final List? flags; - CrowdactionComment copyWith({ + CrowdactionComment copyWith({ String? crowdactionId, String? content, String? userId, @@ -77,8 +81,7 @@ class CrowdactionComment extends Equatable { ); } - - @override + @override List get props => [ crowdactionId, content, @@ -91,7 +94,7 @@ class CrowdactionComment extends Equatable { flags, ]; - Map toJson() => { + Map toJson() => { 'crowdactionId': crowdactionId, 'content': content, 'userId': userId, diff --git a/lib/domain/crowdaction/models/commitment.dart b/lib/domain/crowdaction/models/commitment.dart index 518e0ce3..1ef37417 100644 --- a/lib/domain/crowdaction/models/commitment.dart +++ b/lib/domain/crowdaction/models/commitment.dart @@ -14,7 +14,8 @@ class Commitment extends Equatable { label: json['label'] as String, description: json['description'] as String?, points: json['points'] as int, - blocks: json['blocks'] as List, + blocks: + (json['blocks'] as List).map((e) => e.toString()).toList(), id: json['id'] as String, iconId: json['iconId'] as String?, ); diff --git a/lib/domain/participation/participation.dart b/lib/domain/participation/participation.dart index a9eb3f1e..b83d354b 100644 --- a/lib/domain/participation/participation.dart +++ b/lib/domain/participation/participation.dart @@ -20,7 +20,9 @@ class Participation extends Equatable { fullName: json['fullName'] as String, avatar: json['avatar'] as String, userId: json['userId'] as String, - commitments: json['commitments'] as List, + commitments: (json['commitments'] as List) + .map((e) => e.toString()) + .toList(), joinDate: DateTime.parse(json['joinDate'] as String), dailyCheckIns: json['dailyCheckIns'] as int, ); diff --git a/lib/domain/profile/user_profile.dart b/lib/domain/profile/user_profile.dart index 42b4f50a..553ffc9e 100644 --- a/lib/domain/profile/user_profile.dart +++ b/lib/domain/profile/user_profile.dart @@ -1,5 +1,6 @@ import 'package:equatable/equatable.dart'; +import '../../core/core.dart'; import '../user/user.dart'; import 'profile.dart'; @@ -9,11 +10,6 @@ class UserProfile extends Equatable { required this.profile, }); - // factory UserProfile.fromJson(Map json) => UserProfile( - // user: BaseUser.fromJson(json['user'] as Map), - // profile: Profile.fromJson(json['profile'] as Map), - // ); - final User user; final Profile profile; @@ -34,8 +30,6 @@ class UserProfile extends Equatable { profile, ]; - // Map toJson() => { - // 'user': user.toJson(), - // 'profile': profile.toJson(), - // }; + // User profile avatar url + String? get avatarUrl => '$baseStaticUrl/${profile.avatar}'; } diff --git a/lib/infrastructure/crowdaction/crowdaction_comment_dto.dart b/lib/infrastructure/crowdaction/crowdaction_comment_dto.dart index f93d8521..175f08ad 100644 --- a/lib/infrastructure/crowdaction/crowdaction_comment_dto.dart +++ b/lib/infrastructure/crowdaction/crowdaction_comment_dto.dart @@ -21,11 +21,15 @@ class CrowdactionCommentDto extends Equatable { userId: json['user_id'] as String, createdAt: json['created_at'] as DateTime, content: json['content'] as String, - comments: json['comments'] as List?, + comments: (json['comments'] as List?) + ?.map((e) => e.toString()) + .toList(), likes: json['likes'] as int, likedByMe: json['liked_by_me'] as bool, flagged: json['flagged'] as bool?, - flags: json['flags'] as List?, + flags: (json['flags'] as List?) + ?.map((e) => e.toString()) + .toList(), ); final String crowdactionId; diff --git a/lib/infrastructure/crowdaction/crowdaction_dto.dart b/lib/infrastructure/crowdaction/crowdaction_dto.dart index 6440ad2b..4e862e66 100644 --- a/lib/infrastructure/crowdaction/crowdaction_dto.dart +++ b/lib/infrastructure/crowdaction/crowdaction_dto.dart @@ -21,7 +21,6 @@ class CrowdActionDto extends Equatable { required this.status, required this.joinStatus, required this.endAt, - required this.startAt, }); CrowdAction toDomain() { @@ -60,7 +59,6 @@ class CrowdActionDto extends Equatable { status: (json['status'] as String).fromStatusJson, joinStatus: (json['joinStatus'] as String).fromJoinStatusJson, endAt: json['endAt'] as String, - startAt: json['startAt'] as String, ); final String id; @@ -89,8 +87,6 @@ class CrowdActionDto extends Equatable { final String endAt; - final String startAt; - CrowdActionDto copyWith({ String? id, String? title, @@ -121,7 +117,6 @@ class CrowdActionDto extends Equatable { status: status ?? this.status, joinStatus: joinStatus ?? this.joinStatus, endAt: endAt ?? this.endAt, - startAt: startAt ?? this.startAt, ); } diff --git a/lib/infrastructure/crowdaction/models/commitment_dto.dart b/lib/infrastructure/crowdaction/models/commitment_dto.dart index 16428b00..3d921ac4 100644 --- a/lib/infrastructure/crowdaction/models/commitment_dto.dart +++ b/lib/infrastructure/crowdaction/models/commitment_dto.dart @@ -25,7 +25,9 @@ class CommitmentDto extends Equatable { label: json['label'] as String, description: json['description'] as String?, points: json['points'] as int, - blocks: json['blocks'] as List, + blocks: (json['blocks'] as List) + .map((block) => block.toString()) + .toList(), id: json['_id'] as String, icon: json['icon'] as String?, ); diff --git a/lib/infrastructure/participation/participation_dto.dart b/lib/infrastructure/participation/participation_dto.dart index b9f4285a..b1790687 100644 --- a/lib/infrastructure/participation/participation_dto.dart +++ b/lib/infrastructure/participation/participation_dto.dart @@ -3,7 +3,7 @@ import 'package:equatable/equatable.dart'; import '../../domain/participation/participation.dart'; class ParticipationDto extends Equatable { - const ParticipationDto({ + const ParticipationDto({ required this.id, required this.crowdActionId, required this.fullName, @@ -27,35 +27,37 @@ class ParticipationDto extends Equatable { ); } - factory ParticipationDto.fromJson(Map json) => + factory ParticipationDto.fromJson(Map json) => ParticipationDto( id: json['id'] as String, crowdActionId: json['crowdActionId'] as String, fullName: json['fullName'] as String, avatar: json['avatar'] as String, userId: json['userId'] as String, - commitments: json['commitments'] as List, + commitments: (json['commitments'] as List) + .map((e) => e.toString()) + .toList(), joinDate: json['joinDate'] as String, dailyCheckIns: json['dailyCheckIns'] as int, ); - final String id; + final String id; - final String crowdActionId; + final String crowdActionId; - final String fullName; + final String fullName; - final String avatar; + final String avatar; - final String userId; + final String userId; - final List commitments; + final List commitments; - final String joinDate; + final String joinDate; - final int dailyCheckIns; + final int dailyCheckIns; - ParticipationDto copyWith({ + ParticipationDto copyWith({ String? id, String? crowdActionId, String? fullName, @@ -89,7 +91,7 @@ class ParticipationDto extends Equatable { dailyCheckIns, ]; - Map toJson() => { + Map toJson() => { 'id': id, 'crowdActionId': crowdActionId, 'fullName': fullName, diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 00000000..7bf27ce5 --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,1546 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: "4897882604d919befd350648c7f91926a9d5de99e67b455bf0917cc2362f4bb8" + url: "https://pub.dev" + source: hosted + version: "47.0.0" + _flutterfire_internals: + dependency: transitive + description: + name: _flutterfire_internals + sha256: "64fcb0dbca4386356386c085142fa6e79c00a3326ceaa778a2d25f5d9ba61441" + url: "https://pub.dev" + source: hosted + version: "1.0.16" + adaptive_number: + dependency: transitive + description: + name: adaptive_number + sha256: "3a567544e9b5c9c803006f51140ad544aedc79604fd4f3f2c1380003f97c1d77" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "690e335554a8385bc9d787117d9eb52c0c03ee207a607e593de3c9d71b1cfe80" + url: "https://pub.dev" + source: hosted + version: "4.7.0" + archive: + dependency: transitive + description: + name: archive + sha256: d6347d54a2d8028e0437e3c099f66fdb8ae02c4720c1e7534c9f24c10351f85d + url: "https://pub.dev" + source: hosted + version: "3.3.6" + args: + dependency: transitive + description: + name: args + sha256: "4cab82a83ffef80b262ddedf47a0a8e56ee6fbf7fe21e6e768b02792034dd440" + url: "https://pub.dev" + source: hosted + version: "2.4.0" + async: + dependency: transitive + description: + name: async + sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + url: "https://pub.dev" + source: hosted + version: "2.10.0" + auto_route: + dependency: "direct main" + description: + name: auto_route + sha256: "12047baeca0e01df93165ef33275b32119d72699ab9a49dc64c20e78f586f96d" + url: "https://pub.dev" + source: hosted + version: "5.0.4" + auto_route_generator: + dependency: "direct dev" + description: + name: auto_route_generator + sha256: c66eaa20dbba3211cac656037f88ba836a633dda953d9f4f9f9f5809b57e4278 + url: "https://pub.dev" + source: hosted + version: "5.0.2" + bloc: + dependency: "direct main" + description: + name: bloc + sha256: "658a5ae59edcf1e58aac98b000a71c762ad8f46f1394c34a52050cafb3e11a80" + url: "https://pub.dev" + source: hosted + version: "8.1.1" + bloc_test: + dependency: "direct dev" + description: + name: bloc_test + sha256: ffbb60c17ee3d8e3784cb78071088e353199057233665541e8ac6cd438dca8ad + url: "https://pub.dev" + source: hosted + version: "9.1.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + build: + dependency: transitive + description: + name: build + sha256: "3fbda25365741f8251b39f3917fb3c8e286a96fd068a5a242e11c2012d495777" + url: "https://pub.dev" + source: hosted + version: "2.3.1" + build_config: + dependency: transitive + description: + name: build_config + sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 + url: "https://pub.dev" + source: hosted + version: "1.1.1" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: "757153e5d9cd88253cb13f28c2fb55a537dc31fefd98137549895b5beb7c6169" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + sha256: "687cf90a3951affac1bd5f9ecb5e3e90b60487f3d9cdc359bb310f8876bb02a6" + url: "https://pub.dev" + source: hosted + version: "2.0.10" + build_runner: + dependency: "direct dev" + description: + name: build_runner + sha256: b0a8a7b8a76c493e85f1b84bffa0588859a06197863dba8c9036b15581fd9727 + url: "https://pub.dev" + source: hosted + version: "2.3.3" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + sha256: "14febe0f5bac5ae474117a36099b4de6f1dbc52df6c5e55534b3da9591bf4292" + url: "https://pub.dev" + source: hosted + version: "7.2.7" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.dev" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + sha256: "31b7c748fd4b9adf8d25d72a4c4a59ef119f12876cf414f94f8af5131d5fa2b0" + url: "https://pub.dev" + source: hosted + version: "8.4.4" + cached_network_image: + dependency: "direct main" + description: + name: cached_network_image + sha256: fd3d0dc1d451f9a252b32d95d3f0c3c487bc41a75eba2e6097cb0b9c71491b15 + url: "https://pub.dev" + source: hosted + version: "3.2.3" + cached_network_image_platform_interface: + dependency: transitive + description: + name: cached_network_image_platform_interface + sha256: bb2b8403b4ccdc60ef5f25c70dead1f3d32d24b9d6117cfc087f496b178594a7 + url: "https://pub.dev" + source: hosted + version: "2.0.0" + cached_network_image_web: + dependency: transitive + description: + name: cached_network_image_web + sha256: b8eb814ebfcb4dea049680f8c1ffb2df399e4d03bf7a352c775e26fa06e02fa0 + url: "https://pub.dev" + source: hosted + version: "1.0.2" + characters: + dependency: transitive + description: + name: characters + sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + url: "https://pub.dev" + source: hosted + version: "1.2.1" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: "3d1505d91afa809d177efd4eed5bb0eb65805097a1463abdd2add076effae311" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + cli_util: + dependency: transitive + description: + name: cli_util + sha256: "66f86e916d285c1a93d3b79587d94bd71984a66aac4ff74e524cfa7877f1395c" + url: "https://pub.dev" + source: hosted + version: "0.3.5" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: "0d43dd1288fd145de1ecc9a3948ad4a6d5a82f0a14c4fdd0892260787d975cbe" + url: "https://pub.dev" + source: hosted + version: "4.4.0" + collection: + dependency: transitive + description: + name: collection + sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + url: "https://pub.dev" + source: hosted + version: "1.17.0" + convert: + dependency: transitive + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + country_codes: + dependency: "direct main" + description: + name: country_codes + sha256: d6d1a9c3c12577b24eb7f6160768b06a9d8fd3f73ad6b24dcc5b7e0ac4910056 + url: "https://pub.dev" + source: hosted + version: "2.2.0" + country_icons: + dependency: "direct main" + description: + name: country_icons + sha256: "836435012b42c7dcc6d585d1420ce2310d70396569ef70cf5d74c740919f7320" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + coverage: + dependency: transitive + description: + name: coverage + sha256: "2fb815080e44a09b85e0f2ca8a820b15053982b2e714b59267719e8a9ff17097" + url: "https://pub.dev" + source: hosted + version: "1.6.3" + cross_file: + dependency: transitive + description: + name: cross_file + sha256: "0b0036e8cccbfbe0555fd83c1d31a6f30b77a96b598b35a5d36dd41f718695e9" + url: "https://pub.dev" + source: hosted + version: "0.3.3+4" + crypto: + dependency: transitive + description: + name: crypto + sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67 + url: "https://pub.dev" + source: hosted + version: "3.0.2" + dart_jsonwebtoken: + dependency: transitive + description: + name: dart_jsonwebtoken + sha256: "2a42e97c0b8b4e9a42b24a71453635f445c7b66c7d7c81e3a429f37ead9fe778" + url: "https://pub.dev" + source: hosted + version: "2.7.1" + dart_pubspec_licenses: + dependency: transitive + description: + name: dart_pubspec_licenses + sha256: "38680e2d2fc41df3a0d435d0955b91acc382aeefcb89ef4738f8167c8288a29d" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: "7a03456c3490394c8e7665890333e91ae8a49be43542b616e414449ac358acd4" + url: "https://pub.dev" + source: hosted + version: "2.2.4" + dartz: + dependency: "direct main" + description: + name: dartz + sha256: e6acf34ad2e31b1eb00948692468c30ab48ac8250e0f0df661e29f12dd252168 + url: "https://pub.dev" + source: hosted + version: "0.10.1" + device_frame: + dependency: transitive + description: + name: device_frame + sha256: afe76182aec178d171953d9b4a50a43c57c7cf3c77d8b09a48bf30c8fa04dd9d + url: "https://pub.dev" + source: hosted + version: "1.1.0" + diff_match_patch: + dependency: transitive + description: + name: diff_match_patch + sha256: "2efc9e6e8f449d0abe15be240e2c2a3bcd977c8d126cfd70598aee60af35c0a4" + url: "https://pub.dev" + source: hosted + version: "0.4.1" + dots_indicator: + dependency: "direct main" + description: + name: dots_indicator + sha256: e59dfc90030ee5a4fd4c53144a8ce97cc7a823c2067b8fb9814960cd1ae63f89 + url: "https://pub.dev" + source: hosted + version: "2.1.0" + ed25519_edwards: + dependency: transitive + description: + name: ed25519_edwards + sha256: "6ce0112d131327ec6d42beede1e5dfd526069b18ad45dcf654f15074ad9276cd" + url: "https://pub.dev" + source: hosted + version: "0.3.1" + email_validator: + dependency: "direct main" + description: + name: email_validator + sha256: e9a90f27ab2b915a27d7f9c2a7ddda5dd752d6942616ee83529b686fc086221b + url: "https://pub.dev" + source: hosted + version: "2.1.17" + equatable: + dependency: "direct main" + description: + name: equatable + sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2 + url: "https://pub.dev" + source: hosted + version: "2.0.5" + expandable_page_view: + dependency: "direct main" + description: + name: expandable_page_view + sha256: "210dc6961cfc29f7ed42867824eb699c9a4b9b198a7c04b8bdc1c05844969dc6" + url: "https://pub.dev" + source: hosted + version: "1.0.17" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + sha256: a38574032c5f1dd06c4aee541789906c12ccaab8ba01446e800d9c5b79c4a978 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + file: + dependency: transitive + description: + name: file + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + url: "https://pub.dev" + source: hosted + version: "6.1.4" + firebase_auth: + dependency: "direct main" + description: + name: firebase_auth + sha256: e946a21254784116d32e497e09b851b4d03a3c65880e80d6939a720dfce88aed + url: "https://pub.dev" + source: hosted + version: "4.2.2" + firebase_auth_mocks: + dependency: "direct dev" + description: + name: firebase_auth_mocks + sha256: c4398019066d1bd0e91a0ba6067272a3a60c7ff8b211aa9c2139b273abe98914 + url: "https://pub.dev" + source: hosted + version: "0.10.3" + firebase_auth_platform_interface: + dependency: transitive + description: + name: firebase_auth_platform_interface + sha256: c645fec50b0391aa878288f58fa4fe9762c271380c457aedf5c7c9b718604f68 + url: "https://pub.dev" + source: hosted + version: "6.11.11" + firebase_auth_web: + dependency: transitive + description: + name: firebase_auth_web + sha256: bf8f3093c141abd0a624e0244864154d9db694682ba0cc1fcfdf60ecb6f7f2e3 + url: "https://pub.dev" + source: hosted + version: "5.2.2" + firebase_core: + dependency: "direct main" + description: + name: firebase_core + sha256: fe30ac230f12f8836bb97e6e09197340d3c584526825b1746ea362a82e1e43f7 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + firebase_core_platform_interface: + dependency: transitive + description: + name: firebase_core_platform_interface + sha256: "5615b30c36f55b2777d0533771deda7e5730e769e5d3cb7fda79e9bed86cfa55" + url: "https://pub.dev" + source: hosted + version: "4.5.3" + firebase_core_web: + dependency: transitive + description: + name: firebase_core_web + sha256: "291fbcace608aca6c860652e1358ef89752be8cc3ef227f8bbcd1e62775b833a" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + firebase_crashlytics: + dependency: "direct main" + description: + name: firebase_crashlytics + sha256: "816bbb920316c8fe257b460b8856b01e274e867a729961bf7a3be6322cdf13e1" + url: "https://pub.dev" + source: hosted + version: "3.0.15" + firebase_crashlytics_platform_interface: + dependency: transitive + description: + name: firebase_crashlytics_platform_interface + sha256: "120e47b9bac3654848d1bdc60b8027f3574b53ee0b81b1a2e5e76ddaa58f6645" + url: "https://pub.dev" + source: hosted + version: "3.3.15" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_bloc: + dependency: "direct main" + description: + name: flutter_bloc + sha256: "434951eea948dbe87f737b674281465f610b8259c16c097b8163ce138749a775" + url: "https://pub.dev" + source: hosted + version: "8.1.2" + flutter_blurhash: + dependency: transitive + description: + name: flutter_blurhash + sha256: "05001537bd3fac7644fa6558b09ec8c0a3f2eba78c0765f88912882b1331a5c6" + url: "https://pub.dev" + source: hosted + version: "0.7.0" + flutter_cache_manager: + dependency: transitive + description: + name: flutter_cache_manager + sha256: "32cd900555219333326a2d0653aaaf8671264c29befa65bbd9856d204a4c9fb3" + url: "https://pub.dev" + source: hosted + version: "3.3.0" + flutter_dotenv: + dependency: "direct main" + description: + name: flutter_dotenv + sha256: d9283d92059a22e9834bc0a31336658ffba77089fb6f3cc36751f1fc7c6661a3 + url: "https://pub.dev" + source: hosted + version: "5.0.2" + flutter_launcher_icons: + dependency: "direct dev" + description: + name: flutter_launcher_icons + sha256: ce0e501cfc258907842238e4ca605e74b7fd1cdf04b3b43e86c43f3e40a1592c + url: "https://pub.dev" + source: hosted + version: "0.11.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: aeb0b80a8b3709709c9cc496cdc027c5b3216796bc0af0ce1007eaf24464fd4c + url: "https://pub.dev" + source: hosted + version: "2.0.1" + flutter_oss_licenses: + dependency: "direct dev" + description: + name: flutter_oss_licenses + sha256: eb15e1146b101dca063a177f6d339dfb85b639a9e2d2b71c18188d5fb2144869 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + sha256: c224ac897bed083dabf11f238dd11a239809b446740be0c2044608c50029ffdf + url: "https://pub.dev" + source: hosted + version: "2.0.9" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + freezed_annotation: + dependency: transitive + description: + name: freezed_annotation + sha256: aeac15850ef1b38ee368d4c53ba9a847e900bb2c53a4db3f6881cbb3cb684338 + url: "https://pub.dev" + source: hosted + version: "2.2.0" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" + url: "https://pub.dev" + source: hosted + version: "3.2.0" + get_it: + dependency: "direct main" + description: + name: get_it + sha256: "290fde3a86072e4b37dbb03c07bec6126f0ecc28dad403c12ffe2e5a2d751ab7" + url: "https://pub.dev" + source: hosted + version: "7.2.0" + glob: + dependency: transitive + description: + name: glob + sha256: "4515b5b6ddb505ebdd242a5f2cc5d22d3d6a80013789debfbda7777f47ea308c" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + go_router: + dependency: transitive + description: + name: go_router + sha256: "25ae21384b758eb80daff113fe8bfb785c2dd17b69fe4885008fe764b26fd1ca" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + graphs: + dependency: transitive + description: + name: graphs + sha256: f9e130f3259f52d26f0cfc0e964513796dafed572fa52e45d2f8d6ca14db39b2 + url: "https://pub.dev" + source: hosted + version: "2.2.0" + http: + dependency: "direct main" + description: + name: http + sha256: "6aa2946395183537c8b880962d935877325d6a09a2867c3970c05c0fed6ac482" + url: "https://pub.dev" + source: hosted + version: "0.13.5" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + image: + dependency: "direct main" + description: + name: image + sha256: "8e9d133755c3e84c73288363e6343157c383a0c6c56fc51afcc5d4d7180306d6" + url: "https://pub.dev" + source: hosted + version: "3.3.0" + image_cropper: + dependency: "direct main" + description: + name: image_cropper + sha256: "85324928ee8a8be35a529446435ca53067865b9353c8681983472eeec66d780f" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + image_cropper_for_web: + dependency: transitive + description: + name: image_cropper_for_web + sha256: "09e93a8ec0435adcaa23622ac090442872f18145d70b9ff605ffedcf97d56255" + url: "https://pub.dev" + source: hosted + version: "1.0.3" + image_cropper_platform_interface: + dependency: transitive + description: + name: image_cropper_platform_interface + sha256: "62349e3aab63873ea9b9ab9f69d036ab8a0d74b3004beec4303981386cb9273f" + url: "https://pub.dev" + source: hosted + version: "3.0.3" + image_picker: + dependency: "direct main" + description: + name: image_picker + sha256: "715d68a53d6bcc2eae26005097dc74c375a04c0d7c0e657da84deebbbbbf51ed" + url: "https://pub.dev" + source: hosted + version: "0.8.6+4" + image_picker_android: + dependency: transitive + description: + name: image_picker_android + sha256: ca14b663fecbe7f5ddda83782abfb2e1dd2a23d6da49b6ed344bf8cf3871225a + url: "https://pub.dev" + source: hosted + version: "0.8.5+9" + image_picker_for_web: + dependency: transitive + description: + name: image_picker_for_web + sha256: "66fc6e3877bbde82c33d122f3588777c3784ac5bd7d1cdd79213ef7aecb85b34" + url: "https://pub.dev" + source: hosted + version: "2.1.11" + image_picker_ios: + dependency: transitive + description: + name: image_picker_ios + sha256: "93b4403350b54f45a5061632721ee29a563c8b45b1e22feda9049b8329bd1337" + url: "https://pub.dev" + source: hosted + version: "0.8.7" + image_picker_platform_interface: + dependency: transitive + description: + name: image_picker_platform_interface + sha256: "1991219d9dbc42a99aff77e663af8ca51ced592cd6685c9485e3458302d3d4f8" + url: "https://pub.dev" + source: hosted + version: "2.6.3" + infinite_scroll_pagination: + dependency: "direct main" + description: + name: infinite_scroll_pagination + sha256: "9517328f4e373f08f57dbb11c5aac5b05554142024d6b60c903f3b73476d52db" + url: "https://pub.dev" + source: hosted + version: "3.2.0" + injectable: + dependency: "direct main" + description: + name: injectable + sha256: "7dab7d341feb40a0590d9ff6261aea9495522005e2c6763f9161a4face916f7b" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + injectable_generator: + dependency: "direct dev" + description: + name: injectable_generator + sha256: b206de637c1960007b0beebe447a6ee3cf30c9e5f14542083024a9d0c49a7a09 + url: "https://pub.dev" + source: hosted + version: "2.1.4" + intl: + dependency: "direct main" + description: + name: intl + sha256: a3715e3bc90294e971cb7dc063fbf3cd9ee0ebf8604ffeafabd9e6f16abbdbe6 + url: "https://pub.dev" + source: hosted + version: "0.18.0" + io: + dependency: transitive + description: + name: io + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + ionicons: + dependency: "direct main" + description: + name: ionicons + sha256: "5496bc65a16115ecf05b15b78f494ee4a8869504357668f0a11d689e970523cf" + url: "https://pub.dev" + source: hosted + version: "0.2.2" + js: + dependency: transitive + description: + name: js + sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + url: "https://pub.dev" + source: hosted + version: "0.6.5" + json_annotation: + dependency: "direct main" + description: + name: json_annotation + sha256: "3520fa844009431b5d4491a5a778603520cdc399ab3406332dcc50f93547258c" + url: "https://pub.dev" + source: hosted + version: "4.7.0" + json_serializable: + dependency: "direct dev" + description: + name: json_serializable + sha256: f3c2c18a7889580f71926f30c1937727c8c7d4f3a435f8f5e8b0ddd25253ef5d + url: "https://pub.dev" + source: hosted + version: "6.5.4" + lint: + dependency: "direct dev" + description: + name: lint + sha256: "3e9343b1cededcfb1e8b40d0dbd3592b7a1c6c0121545663a991433390c2bc97" + url: "https://pub.dev" + source: hosted + version: "2.0.1" + lints: + dependency: transitive + description: + name: lints + sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593" + url: "https://pub.dev" + source: hosted + version: "2.0.1" + logging: + dependency: transitive + description: + name: logging + sha256: "04094f2eb032cbb06c6f6e8d3607edcfcb0455e2bb6cbc010cb01171dcb64e6d" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + matcher: + dependency: transitive + description: + name: matcher + sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + url: "https://pub.dev" + source: hosted + version: "0.12.13" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + url: "https://pub.dev" + source: hosted + version: "0.2.0" + meta: + dependency: transitive + description: + name: meta + sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + url: "https://pub.dev" + source: hosted + version: "1.8.0" + mime: + dependency: transitive + description: + name: mime + sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e + url: "https://pub.dev" + source: hosted + version: "1.0.4" + mock_exceptions: + dependency: transitive + description: + name: mock_exceptions + sha256: "6e3e623712d2c6106ffe9e14732912522b565ddaa82a8dcee6cd4441b5984056" + url: "https://pub.dev" + source: hosted + version: "0.8.2" + mocktail: + dependency: "direct main" + description: + name: mocktail + sha256: "80a996cd9a69284b3dc521ce185ffe9150cde69767c2d3a0720147d93c0cef53" + url: "https://pub.dev" + source: hosted + version: "0.3.0" + nested: + dependency: transitive + description: + name: nested + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + node_preamble: + dependency: transitive + description: + name: node_preamble + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + octo_image: + dependency: transitive + description: + name: octo_image + sha256: "107f3ed1330006a3bea63615e81cf637433f5135a52466c7caa0e7152bca9143" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + package_config: + dependency: transitive + description: + name: package_config + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + package_info_plus: + dependency: "direct main" + description: + name: package_info_plus + sha256: "8df5ab0a481d7dc20c0e63809e90a588e496d276ba53358afc4c4443d0a00697" + url: "https://pub.dev" + source: hosted + version: "3.0.3" + package_info_plus_platform_interface: + dependency: transitive + description: + name: package_info_plus_platform_interface + sha256: "9bc8ba46813a4cc42c66ab781470711781940780fd8beddd0c3da62506d3a6c6" + url: "https://pub.dev" + source: hosted + version: "2.0.1" + path: + dependency: transitive + description: + name: path + sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + url: "https://pub.dev" + source: hosted + version: "1.8.2" + path_provider: + dependency: transitive + description: + name: path_provider + sha256: "04890b994ee89bfa80bf3080bfec40d5a92c5c7a785ebb02c13084a099d2b6f9" + url: "https://pub.dev" + source: hosted + version: "2.0.13" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "7623b7d4be0f0f7d9a8b5ee6879fc13e4522d4c875ab86801dee4af32b54b83e" + url: "https://pub.dev" + source: hosted + version: "2.0.23" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: eec003594f19fe2456ea965ae36b3fc967bc5005f508890aafe31fa75e41d972 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: "525ad5e07622d19447ad740b1ed5070031f7a5437f44355ae915ff56e986429a" + url: "https://pub.dev" + source: hosted + version: "2.1.9" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "57585299a729335f1298b43245842678cb9f43a6310351b18fb577d6e33165ec" + url: "https://pub.dev" + source: hosted + version: "2.0.6" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: "642ddf65fde5404f83267e8459ddb4556316d3ee6d511ed193357e25caa3632d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + pedantic: + dependency: transitive + description: + name: pedantic + sha256: "67fc27ed9639506c856c840ccce7594d0bdcd91bc8d53d6e52359449a1d50602" + url: "https://pub.dev" + source: hosted + version: "1.11.1" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: "49392a45ced973e8d94a85fdb21293fbb40ba805fc49f2965101ae748a3683b4" + url: "https://pub.dev" + source: hosted + version: "5.1.0" + phone_number: + dependency: "direct main" + description: + name: phone_number + sha256: "42cac4ca32146d83cc8a9c8432dc2d901d40334f0e2b02a3ec7d8237b80ebec3" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + platform: + dependency: transitive + description: + name: platform + sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" + url: "https://pub.dev" + source: hosted + version: "3.1.0" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "6a2128648c854906c53fa8e33986fc0247a1116122f9534dd20e3ab9e16a32bc" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + pointycastle: + dependency: transitive + description: + name: pointycastle + sha256: db7306cf0249f838d1a24af52b5a5887c5bf7f31d8bb4e827d071dc0939ad346 + url: "https://pub.dev" + source: hosted + version: "3.6.2" + pool: + dependency: transitive + description: + name: pool + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" + source: hosted + version: "1.5.1" + process: + dependency: transitive + description: + name: process + sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" + url: "https://pub.dev" + source: hosted + version: "4.2.4" + provider: + dependency: transitive + description: + name: provider + sha256: cdbe7530b12ecd9eb455bdaa2fcb8d4dad22e80b8afb4798b41479d5ce26847f + url: "https://pub.dev" + source: hosted + version: "6.0.5" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "307de764d305289ff24ad257ad5c5793ce56d04947599ad68b3baa124105fc17" + url: "https://pub.dev" + source: hosted + version: "2.1.3" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: "75f6614d6dde2dc68948dffbaa4fe5dae32cd700eb9fb763fe11dfb45a3c4d0a" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + recase: + dependency: transitive + description: + name: recase + sha256: e4eb4ec2dcdee52dcf99cb4ceabaffc631d7424ee55e56f280bc039737f89213 + url: "https://pub.dev" + source: hosted + version: "4.1.0" + rive: + dependency: "direct main" + description: + name: rive + sha256: "21b9364d578d3f55f36e18da0235f58adf26edc328505e9bac1824f1bb297f33" + url: "https://pub.dev" + source: hosted + version: "0.10.2" + rive_common: + dependency: transitive + description: + name: rive_common + sha256: f98a451a5d6c8c82693b4eab1dd65413800bab69ac7f9f8fad79fd39bb5ba3ab + url: "https://pub.dev" + source: hosted + version: "0.0.2" + rxdart: + dependency: "direct main" + description: + name: rxdart + sha256: "0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb" + url: "https://pub.dev" + source: hosted + version: "0.27.7" + share_plus: + dependency: "direct main" + description: + name: share_plus + sha256: "8c6892037b1824e2d7e8f59d54b3105932899008642e6372e5079c6939b4b625" + url: "https://pub.dev" + source: hosted + version: "6.3.1" + share_plus_platform_interface: + dependency: transitive + description: + name: share_plus_platform_interface + sha256: "82ddd4ab9260c295e6e39612d4ff00390b9a7a21f1bb1da771e2f232d80ab8a1" + url: "https://pub.dev" + source: hosted + version: "3.2.0" + shared_preferences: + dependency: "direct main" + description: + name: shared_preferences + sha256: ee6257848f822b8481691f20c3e6d2bfee2e9eccb2a3d249907fcfb198c55b41 + url: "https://pub.dev" + source: hosted + version: "2.0.18" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + sha256: a51a4f9375097f94df1c6e0a49c0374440d31ab026b59d58a7e7660675879db4 + url: "https://pub.dev" + source: hosted + version: "2.0.16" + shared_preferences_foundation: + dependency: transitive + description: + name: shared_preferences_foundation + sha256: "6b84fdf06b32bb336f972d373cd38b63734f3461ba56ac2ba01b56d052796259" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + sha256: d7fb71e6e20cd3dfffcc823a28da3539b392e53ed5fc5c2b90b55fdaa8a7e8fa + url: "https://pub.dev" + source: hosted + version: "2.1.4" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + sha256: "824bfd02713e37603b2bdade0842e47d56e7db32b1dcdd1cae533fb88e2913fc" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + sha256: "6737b757e49ba93de2a233df229d0b6a87728cea1684da828cbc718b65dcf9d7" + url: "https://pub.dev" + source: hosted + version: "2.0.5" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + sha256: bd014168e8484837c39ef21065b78f305810ceabc1d4f90be6e3b392ce81b46d + url: "https://pub.dev" + source: hosted + version: "2.1.4" + shelf: + dependency: transitive + description: + name: shelf + sha256: c24a96135a2ccd62c64b69315a14adc5c3419df63b4d7c05832a346fdb73682c + url: "https://pub.dev" + source: hosted + version: "1.4.0" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + sha256: aef74dc9195746a384843102142ab65b6a4735bb3beea791e63527b88cc83306 + url: "https://pub.dev" + source: hosted + version: "3.0.1" + shelf_static: + dependency: transitive + description: + name: shelf_static + sha256: e792b76b96a36d4a41b819da593aff4bdd413576b3ba6150df5d8d9996d2e74c + url: "https://pub.dev" + source: hosted + version: "1.1.1" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: a988c0e8d8ffbdb8a28aa7ec8e449c260f3deb808781fe1284d22c5bba7156e8 + url: "https://pub.dev" + source: hosted + version: "1.0.3" + shimmer: + dependency: "direct main" + description: + name: shimmer + sha256: "1f1009b5845a1f88f1c5630212279540486f97409e9fc3f63883e71070d107bf" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + sliver_tools: + dependency: transitive + description: + name: sliver_tools + sha256: bfa69411ebb203cc1a115b1e8bc7935b893eb381fdcf8d453b40c0d4e1db3247 + url: "https://pub.dev" + source: hosted + version: "0.2.9" + source_gen: + dependency: transitive + description: + name: source_gen + sha256: "2d79738b6bbf38a43920e2b8d189e9a3ce6cc201f4b8fc76be5e4fe377b1c38d" + url: "https://pub.dev" + source: hosted + version: "1.2.6" + source_helper: + dependency: transitive + description: + name: source_helper + sha256: "3b67aade1d52416149c633ba1bb36df44d97c6b51830c2198e934e3fca87ca1f" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + sha256: "84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + source_maps: + dependency: transitive + description: + name: source_maps + sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703" + url: "https://pub.dev" + source: hosted + version: "0.10.12" + source_span: + dependency: transitive + description: + name: source_span + sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + url: "https://pub.dev" + source: hosted + version: "1.9.1" + sqflite: + dependency: transitive + description: + name: sqflite + sha256: "851d5040552cf911f4cabda08d003eca76b27da3ed0002978272e27c8fbf8ecc" + url: "https://pub.dev" + source: hosted + version: "2.2.5" + sqflite_common: + dependency: transitive + description: + name: sqflite_common + sha256: bfd6973aaeeb93475bc0d875ac9aefddf7965ef22ce09790eb963992ffc5183f + url: "https://pub.dev" + source: hosted + version: "2.4.2+2" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + url: "https://pub.dev" + source: hosted + version: "1.11.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + synchronized: + dependency: transitive + description: + name: synchronized + sha256: "33b31b6beb98100bf9add464a36a8dd03eb10c7a8cf15aeec535e9b054aaf04b" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test: + dependency: transitive + description: + name: test + sha256: a5fcd2d25eeadbb6589e80198a47d6a464ba3e2049da473943b8af9797900c2d + url: "https://pub.dev" + source: hosted + version: "1.22.0" + test_api: + dependency: transitive + description: + name: test_api + sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 + url: "https://pub.dev" + source: hosted + version: "0.4.16" + test_core: + dependency: transitive + description: + name: test_core + sha256: "0ef9755ec6d746951ba0aabe62f874b707690b5ede0fecc818b138fcc9b14888" + url: "https://pub.dev" + source: hosted + version: "0.4.20" + timing: + dependency: transitive + description: + name: timing + sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + sha256: "75f2846facd11168d007529d6cd8fcb2b750186bea046af9711f10b907e1587e" + url: "https://pub.dev" + source: hosted + version: "6.1.10" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + sha256: "1f4d9ebe86f333c15d318f81dcdc08b01d45da44af74552608455ebdc08d9732" + url: "https://pub.dev" + source: hosted + version: "6.0.24" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + sha256: c9cd648d2f7ab56968e049d4e9116f96a85517f1dd806b96a86ea1018a3a82e5 + url: "https://pub.dev" + source: hosted + version: "6.1.1" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + sha256: e29039160ab3730e42f3d811dc2a6d5f2864b90a70fb765ea60144b03307f682 + url: "https://pub.dev" + source: hosted + version: "3.0.3" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + sha256: "2dddb3291a57b074dade66b5e07e64401dd2487caefd4e9e2f467138d8c7eb06" + url: "https://pub.dev" + source: hosted + version: "3.0.3" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + sha256: "6c9ca697a5ae218ce56cece69d46128169a58aa8653c1b01d26fcd4aad8c4370" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + sha256: "574cfbe2390666003c3a1d129bdc4574aaa6728f0c00a4829a81c316de69dd9b" + url: "https://pub.dev" + source: hosted + version: "2.0.15" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + sha256: "97c9067950a0d09cbd93e2e3f0383d1403989362b97102fbf446473a48079a4b" + url: "https://pub.dev" + source: hosted + version: "3.0.4" + uuid: + dependency: transitive + description: + name: uuid + sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313" + url: "https://pub.dev" + source: hosted + version: "3.0.7" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: e7fb6c2282f7631712b69c19d1bff82f3767eea33a2321c14fa59ad67ea391c7 + url: "https://pub.dev" + source: hosted + version: "9.4.0" + watcher: + dependency: transitive + description: + name: watcher + sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: ca49c0bc209c687b887f30527fb6a9d80040b072cc2990f34b9bec3e7663101b + url: "https://pub.dev" + source: hosted + version: "2.3.0" + webkit_inspection_protocol: + dependency: transitive + description: + name: webkit_inspection_protocol + sha256: "67d3a8b6c79e1987d19d848b0892e582dbb0c66c57cc1fef58a177dd2aa2823d" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + webview_flutter: + dependency: "direct main" + description: + name: webview_flutter + sha256: b6cd42db3ced5411f3d01599906156885b18e4188f7065a8a351eb84bee347e0 + url: "https://pub.dev" + source: hosted + version: "4.0.6" + webview_flutter_android: + dependency: transitive + description: + name: webview_flutter_android + sha256: "5dd3f32b5c2d8f4bf9d05a349e4a65fa718eb137f396f336c3893d558a58fe84" + url: "https://pub.dev" + source: hosted + version: "3.3.2" + webview_flutter_platform_interface: + dependency: transitive + description: + name: webview_flutter_platform_interface + sha256: df6472164b3f4eaf3280422227f361dc8424b106726b7f21d79a8656ba53f71f + url: "https://pub.dev" + source: hosted + version: "2.0.2" + webview_flutter_wkwebview: + dependency: transitive + description: + name: webview_flutter_wkwebview + sha256: "87b6353b40e04f04d5f895a484ad6d92d682d9cce4d2d5b32d2d8aca2448d46e" + url: "https://pub.dev" + source: hosted + version: "3.2.0" + widgetbook: + dependency: "direct dev" + description: + name: widgetbook + sha256: c42a3d414d19c008d90f0b6df669c18bb151c5f3012ed073498d96cf133e9caf + url: "https://pub.dev" + source: hosted + version: "2.4.1" + widgetbook_annotation: + dependency: "direct main" + description: + name: widgetbook_annotation + sha256: "1f12e090865200191ab6b79b7ed4b108a191bf5de3140f92917c8c75e7e3f916" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + widgetbook_generator: + dependency: "direct dev" + description: + name: widgetbook_generator + sha256: b6d00fef564fa5c0b98e26a72a27d52d03400c36409e56be25c0f09cfee3307b + url: "https://pub.dev" + source: hosted + version: "2.4.1" + widgetbook_models: + dependency: transitive + description: + name: widgetbook_models + sha256: "40899314ab0cce1a52b189ee12b79138ba59f445229f850fb326f579c8f63045" + url: "https://pub.dev" + source: hosted + version: "0.0.7" + win32: + dependency: transitive + description: + name: win32 + sha256: c9ebe7ee4ab0c2194e65d3a07d8c54c5d00bb001b76081c4a04cdb8448b59e46 + url: "https://pub.dev" + source: hosted + version: "3.1.3" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: ee1505df1426458f7f60aac270645098d318a8b4766d85fde75f76f2e21807d1 + url: "https://pub.dev" + source: hosted + version: "1.0.0" + xml: + dependency: transitive + description: + name: xml + sha256: "979ee37d622dec6365e2efa4d906c37470995871fe9ae080d967e192d88286b5" + url: "https://pub.dev" + source: hosted + version: "6.2.2" + yaml: + dependency: transitive + description: + name: yaml + sha256: "23812a9b125b48d4007117254bca50abb6c712352927eece9e155207b1db2370" + url: "https://pub.dev" + source: hosted + version: "3.1.1" +sdks: + dart: ">=2.19.0 <3.0.0" + flutter: ">=3.3.0" diff --git a/pubspec.yaml b/pubspec.yaml index f9bced27..87942e0a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -28,7 +28,6 @@ dependencies: sdk: flutter flutter_bloc: ^8.1.1 flutter_dotenv: ^5.0.2 - freezed_annotation: ^2.2.0 get_it: ^7.2.0 http: ^0.13.5 image: ^3.2.2 @@ -61,7 +60,6 @@ dev_dependencies: flutter_oss_licenses: ^2.0.1 flutter_test: sdk: flutter - freezed: ^2.2.0 injectable_generator: ^2.1.3 json_serializable: ^6.5.3 lint: ^2.0.1 diff --git a/test/domain/crowdaction/crowdaction_test.dart b/test/domain/crowdaction/crowdaction_test.dart index a80a3ff8..fb3b6567 100644 --- a/test/domain/crowdaction/crowdaction_test.dart +++ b/test/domain/crowdaction/crowdaction_test.dart @@ -25,7 +25,7 @@ void main() { expect(participantCA.subcategory, null); // tests for CrowdActions with SubCategory - final tCA = participantCA.copyWith(subcategory: 'tSubCategory'); + final tCA = participantCA.copyWith(subcategory: () => 'tSubCategory'); expect(tCA.toChips().length, 2); expect(tCA.category, 'tCategory'); expect(tCA.subcategory, 'tSubCategory'); diff --git a/test/domain/settings/build_information_test.dart b/test/domain/settings/build_information_test.dart index 78e149ca..dda53479 100644 --- a/test/domain/settings/build_information_test.dart +++ b/test/domain/settings/build_information_test.dart @@ -10,7 +10,7 @@ void main() { expect(tBuildInfo.environment, null); final BuildInformation tBuildInfoWEnv = - tBuildInfo.copyWith(environment: 'tEnv'); + tBuildInfo.copyWith(environment: () => 'tEnv'); expect(tBuildInfoWEnv.environment, 'tEnv'); expect(tBuildInfoWEnv.buildNumber, 'tBuildNo'); expect(tBuildInfoWEnv.version, 'tVersion'); From 7e0deeed88cad5f559a22c4dad598464ed8071b7 Mon Sep 17 00:00:00 2001 From: Isaac Obella Date: Mon, 6 Mar 2023 15:49:25 +0300 Subject: [PATCH 8/8] fix: Refactors Signed-off-by: Isaac Obella --- .../contact_form/contact_form_bloc.dart | 1 - .../crowdaction_details_state.dart | 6 +++--- lib/domain/commitment/commitment.dart | 10 +++++----- lib/infrastructure/profile/profile_dto.dart | 18 +++++++++--------- .../auth/widgets/profile_photo.dart | 2 +- .../crowdaction_participants_screen.dart | 2 +- 6 files changed, 19 insertions(+), 20 deletions(-) diff --git a/lib/application/contact_form/contact_form_bloc.dart b/lib/application/contact_form/contact_form_bloc.dart index 230f41e7..fe23f33a 100644 --- a/lib/application/contact_form/contact_form_bloc.dart +++ b/lib/application/contact_form/contact_form_bloc.dart @@ -1,6 +1,5 @@ import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:injectable/injectable.dart'; import '../../domain/contact_form/i_contact_form_repository.dart'; diff --git a/lib/application/crowdaction/crowdaction_details/crowdaction_details_state.dart b/lib/application/crowdaction/crowdaction_details/crowdaction_details_state.dart index fd32c9bc..f7a1528e 100644 --- a/lib/application/crowdaction/crowdaction_details/crowdaction_details_state.dart +++ b/lib/application/crowdaction/crowdaction_details/crowdaction_details_state.dart @@ -11,7 +11,7 @@ abstract class CrowdActionDetailsState extends Equatable { CrowdActionFailure crowdactionFailure, ) = LoadFailure; - @override + @override List get props => []; } @@ -28,7 +28,7 @@ class LoadSuccess extends CrowdActionDetailsState { const LoadSuccess(this.crowdAction); - @override + @override List get props => [crowdAction]; } @@ -37,6 +37,6 @@ class LoadFailure extends CrowdActionDetailsState { const LoadFailure(this.crowdactionFailure); - @override + @override List get props => [crowdactionFailure]; } diff --git a/lib/domain/commitment/commitment.dart b/lib/domain/commitment/commitment.dart index 69874778..ebb04dd4 100644 --- a/lib/domain/commitment/commitment.dart +++ b/lib/domain/commitment/commitment.dart @@ -17,15 +17,15 @@ class Commitment extends Equatable { icon: json['icon'] as String?, ); - final int id; + final int id; - final String title; + final String title; - final String? description; + final String? description; - final bool checked; + final bool checked; - final String? icon; + final String? icon; Commitment copyWith({ int? id, diff --git a/lib/infrastructure/profile/profile_dto.dart b/lib/infrastructure/profile/profile_dto.dart index 018da2bb..c41878c6 100644 --- a/lib/infrastructure/profile/profile_dto.dart +++ b/lib/infrastructure/profile/profile_dto.dart @@ -3,7 +3,7 @@ import 'package:equatable/equatable.dart'; import '../../domain/profile/profile.dart'; class ProfileDto extends Equatable { - const ProfileDto({ + const ProfileDto({ required this.userId, required this.firstName, required this.lastName, @@ -21,7 +21,7 @@ class ProfileDto extends Equatable { ); } - factory ProfileDto.fromJson(Map json) => ProfileDto( + factory ProfileDto.fromJson(Map json) => ProfileDto( userId: json['userId'] as String, firstName: json['firstName'] as String, lastName: json['lastName'] as String, @@ -29,17 +29,17 @@ class ProfileDto extends Equatable { bio: json['bio'] as String?, ); - final String userId; + final String userId; - final String firstName; + final String firstName; - final String lastName; + final String lastName; - final String avatar; + final String avatar; - final String? bio; + final String? bio; - ProfileDto copyWith({ + ProfileDto copyWith({ String? userId, String? firstName, String? lastName, @@ -64,7 +64,7 @@ class ProfileDto extends Equatable { bio, ]; - Map toJson() => { + Map toJson() => { 'userId': userId, 'firstName': firstName, 'lastName': lastName, diff --git a/lib/presentation/auth/widgets/profile_photo.dart b/lib/presentation/auth/widgets/profile_photo.dart index 35755572..e290573c 100644 --- a/lib/presentation/auth/widgets/profile_photo.dart +++ b/lib/presentation/auth/widgets/profile_photo.dart @@ -37,7 +37,7 @@ class SelectProfilePhotoState extends State { create: (context) => avatarBloc, child: BlocListener( listener: (context, state) { - if(state.isUploadSuccess){ + if (state.isUploadSuccess) { context.router.pop(); } }, diff --git a/lib/presentation/crowdaction/crowdaction_participants/crowdaction_participants_screen.dart b/lib/presentation/crowdaction/crowdaction_participants/crowdaction_participants_screen.dart index a99bc273..9be7b028 100644 --- a/lib/presentation/crowdaction/crowdaction_participants/crowdaction_participants_screen.dart +++ b/lib/presentation/crowdaction/crowdaction_participants/crowdaction_participants_screen.dart @@ -48,7 +48,7 @@ class CrowdActionParticipantsPage extends StatelessWidget { state.participants, state.pageInfo.page + 1, ); - }else if(state is Finished){ + } else if (state is Finished) { pagingController.appendLastPage(state.participants); } },