dev #1
@ -1,28 +1,20 @@
|
||||
# This file configures the analyzer, which statically analyzes Dart code to
|
||||
# check for errors, warnings, and lints.
|
||||
#
|
||||
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
|
||||
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
|
||||
# invoked from the command line by running `flutter analyze`.
|
||||
|
||||
# The following line activates a set of recommended lints for Flutter apps,
|
||||
# packages, and plugins designed to encourage good coding practices.
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
linter:
|
||||
# The lint rules applied to this project can be customized in the
|
||||
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
||||
# included above or to enable additional rules. A list of all available lints
|
||||
# and their documentation is published at https://dart.dev/lints.
|
||||
#
|
||||
# Instead of disabling a lint rule for the entire project in the
|
||||
# section below, it can also be suppressed for a single line of code
|
||||
# or a specific dart file by using the `// ignore: name_of_lint` and
|
||||
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
|
||||
# producing the lint.
|
||||
rules:
|
||||
# avoid_print: false # Uncomment to disable the `avoid_print` rule
|
||||
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
|
||||
sort_pub_dependencies: false
|
||||
prefer_relative_imports: true
|
||||
|
||||
# Additional information about this file can be found at
|
||||
# https://dart.dev/guides/language/analysis-options
|
||||
analyzer:
|
||||
errors:
|
||||
missing_required_param: error
|
||||
missing_return: error
|
||||
must_be_immutable: error
|
||||
sort_unnamed_constructors_first: ignore
|
||||
invalid_annotation_target: ignore
|
||||
use_build_context_synchronously: ignore
|
||||
deprecated_member_use: ignore
|
||||
exclude:
|
||||
- test/generated/**
|
||||
- "**/**.g.dart"
|
||||
- "**/**.freezed.dart"
|
||||
|
||||
@ -6,9 +6,9 @@ plugins {
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.example.enaklo"
|
||||
namespace = "com.appskel.enaklo"
|
||||
compileSdk = flutter.compileSdkVersion
|
||||
ndkVersion = flutter.ndkVersion
|
||||
ndkVersion = "27.0.12077973"
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
@ -21,7 +21,7 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId = "com.example.enaklo"
|
||||
applicationId = "com.appskel.enaklo"
|
||||
// You can update the following values to match your application needs.
|
||||
// For more information, see: https://flutter.dev/to/review-gradle-config.
|
||||
minSdk = flutter.minSdkVersion
|
||||
|
||||
@ -1,8 +1,15 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/>
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/>
|
||||
|
||||
<application
|
||||
android:label="enaklo"
|
||||
android:label="Enaklo"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
android:icon="@mipmap/launcher_icon">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.example.enaklo
|
||||
package com.appskel.enaklo
|
||||
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 7.9 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 115 KiB |
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground>
|
||||
<inset
|
||||
android:drawable="@drawable/ic_launcher_foreground"
|
||||
android:inset="16%" />
|
||||
</foreground>
|
||||
</adaptive-icon>
|
||||
BIN
android/app/src/main/res/mipmap-hdpi/launcher_icon.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
android/app/src/main/res/mipmap-mdpi/launcher_icon.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
android/app/src/main/res/mipmap-xhdpi/launcher_icon.png
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
BIN
android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
4
android/app/src/main/res/values/colors.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#ffffff</color>
|
||||
</resources>
|
||||
BIN
assets/audio/bell_ding.mp3
Normal file
BIN
assets/audio/big_win.mp3
Normal file
BIN
assets/audio/button_tap.mp3
Normal file
BIN
assets/audio/carnaval_main_theme.mp3
Normal file
BIN
assets/audio/token_sound.mp3
Normal file
BIN
assets/audio/wheel_spin.mp3
Normal file
BIN
assets/fonts/quicksand/Quicksand-Bold.ttf
Normal file
BIN
assets/fonts/quicksand/Quicksand-Light.ttf
Normal file
BIN
assets/fonts/quicksand/Quicksand-Medium.ttf
Normal file
BIN
assets/fonts/quicksand/Quicksand-Regular.ttf
Normal file
BIN
assets/fonts/quicksand/Quicksand-SemiBold.ttf
Normal file
BIN
assets/images/bakso343.jpeg
Normal file
|
After Width: | Height: | Size: 55 KiB |
BIN
assets/images/launcher.png
Normal file
|
After Width: | Height: | Size: 851 KiB |
BIN
assets/images/logo.png
Normal file
|
After Width: | Height: | Size: 1.4 MiB |
BIN
assets/images/onboarding1.png
Normal file
|
After Width: | Height: | Size: 224 KiB |
BIN
assets/images/onboarding2.png
Normal file
|
After Width: | Height: | Size: 1.3 MiB |
BIN
assets/images/onboarding3.png
Normal file
|
After Width: | Height: | Size: 722 KiB |
BIN
assets/images/ramenmulu.jpeg
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
assets/images/tumulu.jpeg
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
assets/images/woku.jpeg
Normal file
|
After Width: | Height: | Size: 47 KiB |
@ -1 +1,2 @@
|
||||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
|
||||
#include "Generated.xcconfig"
|
||||
|
||||
@ -1 +1,2 @@
|
||||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
|
||||
#include "Generated.xcconfig"
|
||||
|
||||
43
ios/Podfile
Normal file
@ -0,0 +1,43 @@
|
||||
# Uncomment this line to define a global platform for your project
|
||||
# platform :ios, '12.0'
|
||||
|
||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||
|
||||
project 'Runner', {
|
||||
'Debug' => :debug,
|
||||
'Profile' => :release,
|
||||
'Release' => :release,
|
||||
}
|
||||
|
||||
def flutter_root
|
||||
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
|
||||
unless File.exist?(generated_xcode_build_settings_path)
|
||||
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
|
||||
end
|
||||
|
||||
File.foreach(generated_xcode_build_settings_path) do |line|
|
||||
matches = line.match(/FLUTTER_ROOT\=(.*)/)
|
||||
return matches[1].strip if matches
|
||||
end
|
||||
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
|
||||
end
|
||||
|
||||
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
|
||||
|
||||
flutter_ios_podfile_setup
|
||||
|
||||
target 'Runner' do
|
||||
use_frameworks!
|
||||
|
||||
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
|
||||
target 'RunnerTests' do
|
||||
inherit! :search_paths
|
||||
end
|
||||
end
|
||||
|
||||
post_install do |installer|
|
||||
installer.pods_project.targets.each do |target|
|
||||
flutter_additional_ios_build_settings(target)
|
||||
end
|
||||
end
|
||||
@ -368,7 +368,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.enaklo;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.appskel.enaklo;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
@ -384,7 +384,7 @@
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.enaklo.RunnerTests;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.appskel.enaklo.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
@ -401,7 +401,7 @@
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.enaklo.RunnerTests;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.appskel.enaklo.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
|
||||
@ -416,7 +416,7 @@
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.enaklo.RunnerTests;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.appskel.enaklo.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
|
||||
@ -427,7 +427,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = AppIcon;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
@ -484,7 +484,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = AppIcon;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
@ -547,7 +547,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.enaklo;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.appskel.enaklo;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
@ -569,7 +569,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.enaklo;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.appskel.enaklo;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
|
||||
@ -1,122 +1 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-20x20@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-20x20@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-40x40@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-40x40@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-60x60@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-60x60@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-20x20@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-20x20@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-29x29@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-29x29@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-40x40@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-40x40@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-76x76@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-76x76@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "83.5x83.5",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-83.5x83.5@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "1024x1024",
|
||||
"idiom" : "ios-marketing",
|
||||
"filename" : "Icon-App-1024x1024@1x.png",
|
||||
"scale" : "1x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
{"images":[{"size":"20x20","idiom":"iphone","filename":"Icon-App-20x20@2x.png","scale":"2x"},{"size":"20x20","idiom":"iphone","filename":"Icon-App-20x20@3x.png","scale":"3x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@1x.png","scale":"1x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@2x.png","scale":"2x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@3x.png","scale":"3x"},{"size":"40x40","idiom":"iphone","filename":"Icon-App-40x40@2x.png","scale":"2x"},{"size":"40x40","idiom":"iphone","filename":"Icon-App-40x40@3x.png","scale":"3x"},{"size":"57x57","idiom":"iphone","filename":"Icon-App-57x57@1x.png","scale":"1x"},{"size":"57x57","idiom":"iphone","filename":"Icon-App-57x57@2x.png","scale":"2x"},{"size":"60x60","idiom":"iphone","filename":"Icon-App-60x60@2x.png","scale":"2x"},{"size":"60x60","idiom":"iphone","filename":"Icon-App-60x60@3x.png","scale":"3x"},{"size":"20x20","idiom":"ipad","filename":"Icon-App-20x20@1x.png","scale":"1x"},{"size":"20x20","idiom":"ipad","filename":"Icon-App-20x20@2x.png","scale":"2x"},{"size":"29x29","idiom":"ipad","filename":"Icon-App-29x29@1x.png","scale":"1x"},{"size":"29x29","idiom":"ipad","filename":"Icon-App-29x29@2x.png","scale":"2x"},{"size":"40x40","idiom":"ipad","filename":"Icon-App-40x40@1x.png","scale":"1x"},{"size":"40x40","idiom":"ipad","filename":"Icon-App-40x40@2x.png","scale":"2x"},{"size":"50x50","idiom":"ipad","filename":"Icon-App-50x50@1x.png","scale":"1x"},{"size":"50x50","idiom":"ipad","filename":"Icon-App-50x50@2x.png","scale":"2x"},{"size":"72x72","idiom":"ipad","filename":"Icon-App-72x72@1x.png","scale":"1x"},{"size":"72x72","idiom":"ipad","filename":"Icon-App-72x72@2x.png","scale":"2x"},{"size":"76x76","idiom":"ipad","filename":"Icon-App-76x76@1x.png","scale":"1x"},{"size":"76x76","idiom":"ipad","filename":"Icon-App-76x76@2x.png","scale":"2x"},{"size":"83.5x83.5","idiom":"ipad","filename":"Icon-App-83.5x83.5@2x.png","scale":"2x"},{"size":"1024x1024","idiom":"ios-marketing","filename":"Icon-App-1024x1024@1x.png","scale":"1x"}],"info":{"version":1,"author":"xcode"}}
|
||||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 795 KiB |
|
Before Width: | Height: | Size: 295 B After Width: | Height: | Size: 804 B |
|
Before Width: | Height: | Size: 406 B After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 450 B After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 282 B After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 462 B After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 704 B After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 406 B After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 586 B After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 862 B After Width: | Height: | Size: 9.4 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
Before Width: | Height: | Size: 862 B After Width: | Height: | Size: 9.4 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 762 B After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 17 KiB |
17
launcher_icon.yaml
Normal file
@ -0,0 +1,17 @@
|
||||
# Generate: dart run flutter_launcher_icons -f launcher_icon.yaml
|
||||
|
||||
flutter_launcher_icons:
|
||||
android: "launcher_icon"
|
||||
ios: true
|
||||
image_path: "assets/images/launcher.png"
|
||||
remove_alpha_ios: true
|
||||
min_sdk_android: 21 # android min sdk min:16, default 21
|
||||
adaptive_icon_background: "#ffffff"
|
||||
adaptive_icon_foreground: "assets/images/launcher.png"
|
||||
web:
|
||||
generate: true
|
||||
image_path: "assets/images/launcher.png"
|
||||
windows:
|
||||
generate: true
|
||||
image_path: "assets/images/launcher.png"
|
||||
icon_size: 48
|
||||
49
lib/application/auth/auth_bloc.dart
Normal file
@ -0,0 +1,49 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../domain/auth/auth.dart';
|
||||
|
||||
part 'auth_event.dart';
|
||||
part 'auth_state.dart';
|
||||
part 'auth_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
final IAuthRepository _repository;
|
||||
AuthBloc(this._repository) : super(AuthState.initial()) {
|
||||
on<AuthEvent>(_onAuthEvent);
|
||||
}
|
||||
|
||||
Future<void> _onAuthEvent(AuthEvent event, Emitter<AuthState> emit) {
|
||||
return event.map(
|
||||
fetchCurrentUser: (e) async {
|
||||
emit(state.copyWith(failureOption: none()));
|
||||
|
||||
final token = await _repository.hasToken();
|
||||
|
||||
final failureOrAuth = await _repository.currentUser();
|
||||
|
||||
failureOrAuth.fold(
|
||||
(f) => emit(
|
||||
state.copyWith(
|
||||
failureOption: optionOf(f),
|
||||
status: token
|
||||
? AuthStatus.authenticated()
|
||||
: AuthStatus.unauthenticated(),
|
||||
),
|
||||
),
|
||||
(user) => emit(
|
||||
state.copyWith(
|
||||
user: user,
|
||||
status: token
|
||||
? AuthStatus.authenticated()
|
||||
: AuthStatus.unauthenticated(),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
806
lib/application/auth/auth_bloc.freezed.dart
Normal file
@ -0,0 +1,806 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'auth_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
/// @nodoc
|
||||
mixin _$AuthEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() fetchCurrentUser,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? fetchCurrentUser,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? fetchCurrentUser,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_FetchCurrentUser value) fetchCurrentUser,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_FetchCurrentUser value)? fetchCurrentUser,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_FetchCurrentUser value)? fetchCurrentUser,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $AuthEventCopyWith<$Res> {
|
||||
factory $AuthEventCopyWith(AuthEvent value, $Res Function(AuthEvent) then) =
|
||||
_$AuthEventCopyWithImpl<$Res, AuthEvent>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$AuthEventCopyWithImpl<$Res, $Val extends AuthEvent>
|
||||
implements $AuthEventCopyWith<$Res> {
|
||||
_$AuthEventCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of AuthEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$FetchCurrentUserImplCopyWith<$Res> {
|
||||
factory _$$FetchCurrentUserImplCopyWith(
|
||||
_$FetchCurrentUserImpl value,
|
||||
$Res Function(_$FetchCurrentUserImpl) then,
|
||||
) = __$$FetchCurrentUserImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$FetchCurrentUserImplCopyWithImpl<$Res>
|
||||
extends _$AuthEventCopyWithImpl<$Res, _$FetchCurrentUserImpl>
|
||||
implements _$$FetchCurrentUserImplCopyWith<$Res> {
|
||||
__$$FetchCurrentUserImplCopyWithImpl(
|
||||
_$FetchCurrentUserImpl _value,
|
||||
$Res Function(_$FetchCurrentUserImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of AuthEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$FetchCurrentUserImpl implements _FetchCurrentUser {
|
||||
const _$FetchCurrentUserImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AuthEvent.fetchCurrentUser()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$FetchCurrentUserImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() fetchCurrentUser,
|
||||
}) {
|
||||
return fetchCurrentUser();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? fetchCurrentUser,
|
||||
}) {
|
||||
return fetchCurrentUser?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? fetchCurrentUser,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (fetchCurrentUser != null) {
|
||||
return fetchCurrentUser();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_FetchCurrentUser value) fetchCurrentUser,
|
||||
}) {
|
||||
return fetchCurrentUser(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_FetchCurrentUser value)? fetchCurrentUser,
|
||||
}) {
|
||||
return fetchCurrentUser?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_FetchCurrentUser value)? fetchCurrentUser,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (fetchCurrentUser != null) {
|
||||
return fetchCurrentUser(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _FetchCurrentUser implements AuthEvent {
|
||||
const factory _FetchCurrentUser() = _$FetchCurrentUserImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$AuthState {
|
||||
User get user => throw _privateConstructorUsedError;
|
||||
AuthStatus get status => throw _privateConstructorUsedError;
|
||||
Option<AuthFailure> get failureOption => throw _privateConstructorUsedError;
|
||||
bool get isFetching => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of AuthState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$AuthStateCopyWith<AuthState> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $AuthStateCopyWith<$Res> {
|
||||
factory $AuthStateCopyWith(AuthState value, $Res Function(AuthState) then) =
|
||||
_$AuthStateCopyWithImpl<$Res, AuthState>;
|
||||
@useResult
|
||||
$Res call({
|
||||
User user,
|
||||
AuthStatus status,
|
||||
Option<AuthFailure> failureOption,
|
||||
bool isFetching,
|
||||
});
|
||||
|
||||
$UserCopyWith<$Res> get user;
|
||||
$AuthStatusCopyWith<$Res> get status;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$AuthStateCopyWithImpl<$Res, $Val extends AuthState>
|
||||
implements $AuthStateCopyWith<$Res> {
|
||||
_$AuthStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of AuthState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? user = null,
|
||||
Object? status = null,
|
||||
Object? failureOption = null,
|
||||
Object? isFetching = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
user: null == user
|
||||
? _value.user
|
||||
: user // ignore: cast_nullable_to_non_nullable
|
||||
as User,
|
||||
status: null == status
|
||||
? _value.status
|
||||
: status // ignore: cast_nullable_to_non_nullable
|
||||
as AuthStatus,
|
||||
failureOption: null == failureOption
|
||||
? _value.failureOption
|
||||
: failureOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<AuthFailure>,
|
||||
isFetching: null == isFetching
|
||||
? _value.isFetching
|
||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
|
||||
/// Create a copy of AuthState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$UserCopyWith<$Res> get user {
|
||||
return $UserCopyWith<$Res>(_value.user, (value) {
|
||||
return _then(_value.copyWith(user: value) as $Val);
|
||||
});
|
||||
}
|
||||
|
||||
/// Create a copy of AuthState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$AuthStatusCopyWith<$Res> get status {
|
||||
return $AuthStatusCopyWith<$Res>(_value.status, (value) {
|
||||
return _then(_value.copyWith(status: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$AuthStateImplCopyWith<$Res>
|
||||
implements $AuthStateCopyWith<$Res> {
|
||||
factory _$$AuthStateImplCopyWith(
|
||||
_$AuthStateImpl value,
|
||||
$Res Function(_$AuthStateImpl) then,
|
||||
) = __$$AuthStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
User user,
|
||||
AuthStatus status,
|
||||
Option<AuthFailure> failureOption,
|
||||
bool isFetching,
|
||||
});
|
||||
|
||||
@override
|
||||
$UserCopyWith<$Res> get user;
|
||||
@override
|
||||
$AuthStatusCopyWith<$Res> get status;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$AuthStateImplCopyWithImpl<$Res>
|
||||
extends _$AuthStateCopyWithImpl<$Res, _$AuthStateImpl>
|
||||
implements _$$AuthStateImplCopyWith<$Res> {
|
||||
__$$AuthStateImplCopyWithImpl(
|
||||
_$AuthStateImpl _value,
|
||||
$Res Function(_$AuthStateImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of AuthState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? user = null,
|
||||
Object? status = null,
|
||||
Object? failureOption = null,
|
||||
Object? isFetching = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$AuthStateImpl(
|
||||
user: null == user
|
||||
? _value.user
|
||||
: user // ignore: cast_nullable_to_non_nullable
|
||||
as User,
|
||||
status: null == status
|
||||
? _value.status
|
||||
: status // ignore: cast_nullable_to_non_nullable
|
||||
as AuthStatus,
|
||||
failureOption: null == failureOption
|
||||
? _value.failureOption
|
||||
: failureOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<AuthFailure>,
|
||||
isFetching: null == isFetching
|
||||
? _value.isFetching
|
||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$AuthStateImpl extends _AuthState {
|
||||
const _$AuthStateImpl({
|
||||
required this.user,
|
||||
this.status = const AuthStatus.initial(),
|
||||
required this.failureOption,
|
||||
this.isFetching = false,
|
||||
}) : super._();
|
||||
|
||||
@override
|
||||
final User user;
|
||||
@override
|
||||
@JsonKey()
|
||||
final AuthStatus status;
|
||||
@override
|
||||
final Option<AuthFailure> failureOption;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isFetching;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AuthState(user: $user, status: $status, failureOption: $failureOption, isFetching: $isFetching)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$AuthStateImpl &&
|
||||
(identical(other.user, user) || other.user == user) &&
|
||||
(identical(other.status, status) || other.status == status) &&
|
||||
(identical(other.failureOption, failureOption) ||
|
||||
other.failureOption == failureOption) &&
|
||||
(identical(other.isFetching, isFetching) ||
|
||||
other.isFetching == isFetching));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, user, status, failureOption, isFetching);
|
||||
|
||||
/// Create a copy of AuthState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$AuthStateImplCopyWith<_$AuthStateImpl> get copyWith =>
|
||||
__$$AuthStateImplCopyWithImpl<_$AuthStateImpl>(this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _AuthState extends AuthState {
|
||||
const factory _AuthState({
|
||||
required final User user,
|
||||
final AuthStatus status,
|
||||
required final Option<AuthFailure> failureOption,
|
||||
final bool isFetching,
|
||||
}) = _$AuthStateImpl;
|
||||
const _AuthState._() : super._();
|
||||
|
||||
@override
|
||||
User get user;
|
||||
@override
|
||||
AuthStatus get status;
|
||||
@override
|
||||
Option<AuthFailure> get failureOption;
|
||||
@override
|
||||
bool get isFetching;
|
||||
|
||||
/// Create a copy of AuthState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$AuthStateImplCopyWith<_$AuthStateImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$AuthStatus {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() authenticated,
|
||||
required TResult Function() unauthenticated,
|
||||
required TResult Function() initial,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? authenticated,
|
||||
TResult? Function()? unauthenticated,
|
||||
TResult? Function()? initial,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? authenticated,
|
||||
TResult Function()? unauthenticated,
|
||||
TResult Function()? initial,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Authenticated value) authenticated,
|
||||
required TResult Function(_Unauthenticated value) unauthenticated,
|
||||
required TResult Function(_Initial value) initial,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Authenticated value)? authenticated,
|
||||
TResult? Function(_Unauthenticated value)? unauthenticated,
|
||||
TResult? Function(_Initial value)? initial,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Authenticated value)? authenticated,
|
||||
TResult Function(_Unauthenticated value)? unauthenticated,
|
||||
TResult Function(_Initial value)? initial,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $AuthStatusCopyWith<$Res> {
|
||||
factory $AuthStatusCopyWith(
|
||||
AuthStatus value,
|
||||
$Res Function(AuthStatus) then,
|
||||
) = _$AuthStatusCopyWithImpl<$Res, AuthStatus>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$AuthStatusCopyWithImpl<$Res, $Val extends AuthStatus>
|
||||
implements $AuthStatusCopyWith<$Res> {
|
||||
_$AuthStatusCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of AuthStatus
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$AuthenticatedImplCopyWith<$Res> {
|
||||
factory _$$AuthenticatedImplCopyWith(
|
||||
_$AuthenticatedImpl value,
|
||||
$Res Function(_$AuthenticatedImpl) then,
|
||||
) = __$$AuthenticatedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$AuthenticatedImplCopyWithImpl<$Res>
|
||||
extends _$AuthStatusCopyWithImpl<$Res, _$AuthenticatedImpl>
|
||||
implements _$$AuthenticatedImplCopyWith<$Res> {
|
||||
__$$AuthenticatedImplCopyWithImpl(
|
||||
_$AuthenticatedImpl _value,
|
||||
$Res Function(_$AuthenticatedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of AuthStatus
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$AuthenticatedImpl implements _Authenticated {
|
||||
const _$AuthenticatedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AuthStatus.authenticated()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$AuthenticatedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() authenticated,
|
||||
required TResult Function() unauthenticated,
|
||||
required TResult Function() initial,
|
||||
}) {
|
||||
return authenticated();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? authenticated,
|
||||
TResult? Function()? unauthenticated,
|
||||
TResult? Function()? initial,
|
||||
}) {
|
||||
return authenticated?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? authenticated,
|
||||
TResult Function()? unauthenticated,
|
||||
TResult Function()? initial,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (authenticated != null) {
|
||||
return authenticated();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Authenticated value) authenticated,
|
||||
required TResult Function(_Unauthenticated value) unauthenticated,
|
||||
required TResult Function(_Initial value) initial,
|
||||
}) {
|
||||
return authenticated(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Authenticated value)? authenticated,
|
||||
TResult? Function(_Unauthenticated value)? unauthenticated,
|
||||
TResult? Function(_Initial value)? initial,
|
||||
}) {
|
||||
return authenticated?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Authenticated value)? authenticated,
|
||||
TResult Function(_Unauthenticated value)? unauthenticated,
|
||||
TResult Function(_Initial value)? initial,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (authenticated != null) {
|
||||
return authenticated(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Authenticated implements AuthStatus {
|
||||
const factory _Authenticated() = _$AuthenticatedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$UnauthenticatedImplCopyWith<$Res> {
|
||||
factory _$$UnauthenticatedImplCopyWith(
|
||||
_$UnauthenticatedImpl value,
|
||||
$Res Function(_$UnauthenticatedImpl) then,
|
||||
) = __$$UnauthenticatedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$UnauthenticatedImplCopyWithImpl<$Res>
|
||||
extends _$AuthStatusCopyWithImpl<$Res, _$UnauthenticatedImpl>
|
||||
implements _$$UnauthenticatedImplCopyWith<$Res> {
|
||||
__$$UnauthenticatedImplCopyWithImpl(
|
||||
_$UnauthenticatedImpl _value,
|
||||
$Res Function(_$UnauthenticatedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of AuthStatus
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$UnauthenticatedImpl implements _Unauthenticated {
|
||||
const _$UnauthenticatedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AuthStatus.unauthenticated()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$UnauthenticatedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() authenticated,
|
||||
required TResult Function() unauthenticated,
|
||||
required TResult Function() initial,
|
||||
}) {
|
||||
return unauthenticated();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? authenticated,
|
||||
TResult? Function()? unauthenticated,
|
||||
TResult? Function()? initial,
|
||||
}) {
|
||||
return unauthenticated?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? authenticated,
|
||||
TResult Function()? unauthenticated,
|
||||
TResult Function()? initial,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (unauthenticated != null) {
|
||||
return unauthenticated();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Authenticated value) authenticated,
|
||||
required TResult Function(_Unauthenticated value) unauthenticated,
|
||||
required TResult Function(_Initial value) initial,
|
||||
}) {
|
||||
return unauthenticated(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Authenticated value)? authenticated,
|
||||
TResult? Function(_Unauthenticated value)? unauthenticated,
|
||||
TResult? Function(_Initial value)? initial,
|
||||
}) {
|
||||
return unauthenticated?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Authenticated value)? authenticated,
|
||||
TResult Function(_Unauthenticated value)? unauthenticated,
|
||||
TResult Function(_Initial value)? initial,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (unauthenticated != null) {
|
||||
return unauthenticated(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Unauthenticated implements AuthStatus {
|
||||
const factory _Unauthenticated() = _$UnauthenticatedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$InitialImplCopyWith<$Res> {
|
||||
factory _$$InitialImplCopyWith(
|
||||
_$InitialImpl value,
|
||||
$Res Function(_$InitialImpl) then,
|
||||
) = __$$InitialImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$InitialImplCopyWithImpl<$Res>
|
||||
extends _$AuthStatusCopyWithImpl<$Res, _$InitialImpl>
|
||||
implements _$$InitialImplCopyWith<$Res> {
|
||||
__$$InitialImplCopyWithImpl(
|
||||
_$InitialImpl _value,
|
||||
$Res Function(_$InitialImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of AuthStatus
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$InitialImpl implements _Initial {
|
||||
const _$InitialImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AuthStatus.initial()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$InitialImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() authenticated,
|
||||
required TResult Function() unauthenticated,
|
||||
required TResult Function() initial,
|
||||
}) {
|
||||
return initial();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? authenticated,
|
||||
TResult? Function()? unauthenticated,
|
||||
TResult? Function()? initial,
|
||||
}) {
|
||||
return initial?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? authenticated,
|
||||
TResult Function()? unauthenticated,
|
||||
TResult Function()? initial,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (initial != null) {
|
||||
return initial();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Authenticated value) authenticated,
|
||||
required TResult Function(_Unauthenticated value) unauthenticated,
|
||||
required TResult Function(_Initial value) initial,
|
||||
}) {
|
||||
return initial(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Authenticated value)? authenticated,
|
||||
TResult? Function(_Unauthenticated value)? unauthenticated,
|
||||
TResult? Function(_Initial value)? initial,
|
||||
}) {
|
||||
return initial?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Authenticated value)? authenticated,
|
||||
TResult Function(_Unauthenticated value)? unauthenticated,
|
||||
TResult Function(_Initial value)? initial,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (initial != null) {
|
||||
return initial(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Initial implements AuthStatus {
|
||||
const factory _Initial() = _$InitialImpl;
|
||||
}
|
||||
6
lib/application/auth/auth_event.dart
Normal file
@ -0,0 +1,6 @@
|
||||
part of 'auth_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class AuthEvent with _$AuthEvent {
|
||||
const factory AuthEvent.fetchCurrentUser() = _FetchCurrentUser;
|
||||
}
|
||||
26
lib/application/auth/auth_state.dart
Normal file
@ -0,0 +1,26 @@
|
||||
part of 'auth_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class AuthState with _$AuthState {
|
||||
const AuthState._();
|
||||
|
||||
const factory AuthState({
|
||||
required User user,
|
||||
@Default(AuthStatus.initial()) AuthStatus status,
|
||||
required Option<AuthFailure> failureOption,
|
||||
@Default(false) bool isFetching,
|
||||
}) = _AuthState;
|
||||
|
||||
factory AuthState.initial() =>
|
||||
AuthState(user: User.empty(), failureOption: none());
|
||||
|
||||
bool get isAuthenticated => status == const AuthStatus.authenticated();
|
||||
bool get isInitial => status == const AuthStatus.initial();
|
||||
}
|
||||
|
||||
@freezed
|
||||
sealed class AuthStatus with _$AuthStatus {
|
||||
const factory AuthStatus.authenticated() = _Authenticated;
|
||||
const factory AuthStatus.unauthenticated() = _Unauthenticated;
|
||||
const factory AuthStatus.initial() = _Initial;
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../common/function/app_function.dart';
|
||||
import '../../../domain/auth/auth.dart';
|
||||
|
||||
part 'check_phone_form_event.dart';
|
||||
part 'check_phone_form_state.dart';
|
||||
part 'check_phone_form_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class CheckPhoneFormBloc
|
||||
extends Bloc<CheckPhoneFormEvent, CheckPhoneFormState> {
|
||||
final IAuthRepository _repository;
|
||||
CheckPhoneFormBloc(this._repository) : super(CheckPhoneFormState.initial()) {
|
||||
on<CheckPhoneFormEvent>(_onCheckPhoneFormEvent);
|
||||
}
|
||||
|
||||
Future<void> _onCheckPhoneFormEvent(
|
||||
CheckPhoneFormEvent event,
|
||||
Emitter<CheckPhoneFormState> emit,
|
||||
) {
|
||||
return event.map(
|
||||
phoneNumberChanged: (e) async {
|
||||
emit(
|
||||
state.copyWith(
|
||||
phoneNumber: e.phoneNumber,
|
||||
failureOrCheckPhoneOption: none(),
|
||||
),
|
||||
);
|
||||
},
|
||||
submitted: (e) async {
|
||||
Either<AuthFailure, CheckPhone>? failureOrCheckPhone;
|
||||
emit(
|
||||
state.copyWith(isSubmitting: true, failureOrCheckPhoneOption: none()),
|
||||
);
|
||||
|
||||
final phoneNumberValid = state.phoneNumber.isNotEmpty;
|
||||
|
||||
if (phoneNumberValid) {
|
||||
failureOrCheckPhone = await _repository.checkPhone(
|
||||
phoneNumber: getNormalizePhone(state.phoneNumber),
|
||||
);
|
||||
emit(
|
||||
state.copyWith(
|
||||
isSubmitting: false,
|
||||
failureOrCheckPhoneOption: optionOf(failureOrCheckPhone),
|
||||
),
|
||||
);
|
||||
}
|
||||
emit(state.copyWith(showErrorMessages: true, isSubmitting: false));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,552 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'check_phone_form_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
/// @nodoc
|
||||
mixin _$CheckPhoneFormEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String phoneNumber) phoneNumberChanged,
|
||||
required TResult Function() submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $CheckPhoneFormEventCopyWith<$Res> {
|
||||
factory $CheckPhoneFormEventCopyWith(
|
||||
CheckPhoneFormEvent value,
|
||||
$Res Function(CheckPhoneFormEvent) then,
|
||||
) = _$CheckPhoneFormEventCopyWithImpl<$Res, CheckPhoneFormEvent>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$CheckPhoneFormEventCopyWithImpl<$Res, $Val extends CheckPhoneFormEvent>
|
||||
implements $CheckPhoneFormEventCopyWith<$Res> {
|
||||
_$CheckPhoneFormEventCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of CheckPhoneFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$PhoneNumberChangedImplCopyWith<$Res> {
|
||||
factory _$$PhoneNumberChangedImplCopyWith(
|
||||
_$PhoneNumberChangedImpl value,
|
||||
$Res Function(_$PhoneNumberChangedImpl) then,
|
||||
) = __$$PhoneNumberChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String phoneNumber});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$PhoneNumberChangedImplCopyWithImpl<$Res>
|
||||
extends _$CheckPhoneFormEventCopyWithImpl<$Res, _$PhoneNumberChangedImpl>
|
||||
implements _$$PhoneNumberChangedImplCopyWith<$Res> {
|
||||
__$$PhoneNumberChangedImplCopyWithImpl(
|
||||
_$PhoneNumberChangedImpl _value,
|
||||
$Res Function(_$PhoneNumberChangedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of CheckPhoneFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? phoneNumber = null}) {
|
||||
return _then(
|
||||
_$PhoneNumberChangedImpl(
|
||||
null == phoneNumber
|
||||
? _value.phoneNumber
|
||||
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$PhoneNumberChangedImpl implements _PhoneNumberChanged {
|
||||
const _$PhoneNumberChangedImpl(this.phoneNumber);
|
||||
|
||||
@override
|
||||
final String phoneNumber;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CheckPhoneFormEvent.phoneNumberChanged(phoneNumber: $phoneNumber)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$PhoneNumberChangedImpl &&
|
||||
(identical(other.phoneNumber, phoneNumber) ||
|
||||
other.phoneNumber == phoneNumber));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, phoneNumber);
|
||||
|
||||
/// Create a copy of CheckPhoneFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$PhoneNumberChangedImplCopyWith<_$PhoneNumberChangedImpl> get copyWith =>
|
||||
__$$PhoneNumberChangedImplCopyWithImpl<_$PhoneNumberChangedImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String phoneNumber) phoneNumberChanged,
|
||||
required TResult Function() submitted,
|
||||
}) {
|
||||
return phoneNumberChanged(phoneNumber);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) {
|
||||
return phoneNumberChanged?.call(phoneNumber);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (phoneNumberChanged != null) {
|
||||
return phoneNumberChanged(phoneNumber);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) {
|
||||
return phoneNumberChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) {
|
||||
return phoneNumberChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (phoneNumberChanged != null) {
|
||||
return phoneNumberChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _PhoneNumberChanged implements CheckPhoneFormEvent {
|
||||
const factory _PhoneNumberChanged(final String phoneNumber) =
|
||||
_$PhoneNumberChangedImpl;
|
||||
|
||||
String get phoneNumber;
|
||||
|
||||
/// Create a copy of CheckPhoneFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$PhoneNumberChangedImplCopyWith<_$PhoneNumberChangedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SubmittedImplCopyWith<$Res> {
|
||||
factory _$$SubmittedImplCopyWith(
|
||||
_$SubmittedImpl value,
|
||||
$Res Function(_$SubmittedImpl) then,
|
||||
) = __$$SubmittedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SubmittedImplCopyWithImpl<$Res>
|
||||
extends _$CheckPhoneFormEventCopyWithImpl<$Res, _$SubmittedImpl>
|
||||
implements _$$SubmittedImplCopyWith<$Res> {
|
||||
__$$SubmittedImplCopyWithImpl(
|
||||
_$SubmittedImpl _value,
|
||||
$Res Function(_$SubmittedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of CheckPhoneFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SubmittedImpl implements _Submitted {
|
||||
const _$SubmittedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CheckPhoneFormEvent.submitted()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$SubmittedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String phoneNumber) phoneNumberChanged,
|
||||
required TResult Function() submitted,
|
||||
}) {
|
||||
return submitted();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) {
|
||||
return submitted?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (submitted != null) {
|
||||
return submitted();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) {
|
||||
return submitted(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) {
|
||||
return submitted?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (submitted != null) {
|
||||
return submitted(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Submitted implements CheckPhoneFormEvent {
|
||||
const factory _Submitted() = _$SubmittedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$CheckPhoneFormState {
|
||||
String get phoneNumber => throw _privateConstructorUsedError;
|
||||
Option<Either<AuthFailure, CheckPhone>> get failureOrCheckPhoneOption =>
|
||||
throw _privateConstructorUsedError;
|
||||
bool get isSubmitting => throw _privateConstructorUsedError;
|
||||
bool get showErrorMessages => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of CheckPhoneFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$CheckPhoneFormStateCopyWith<CheckPhoneFormState> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $CheckPhoneFormStateCopyWith<$Res> {
|
||||
factory $CheckPhoneFormStateCopyWith(
|
||||
CheckPhoneFormState value,
|
||||
$Res Function(CheckPhoneFormState) then,
|
||||
) = _$CheckPhoneFormStateCopyWithImpl<$Res, CheckPhoneFormState>;
|
||||
@useResult
|
||||
$Res call({
|
||||
String phoneNumber,
|
||||
Option<Either<AuthFailure, CheckPhone>> failureOrCheckPhoneOption,
|
||||
bool isSubmitting,
|
||||
bool showErrorMessages,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$CheckPhoneFormStateCopyWithImpl<$Res, $Val extends CheckPhoneFormState>
|
||||
implements $CheckPhoneFormStateCopyWith<$Res> {
|
||||
_$CheckPhoneFormStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of CheckPhoneFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? phoneNumber = null,
|
||||
Object? failureOrCheckPhoneOption = null,
|
||||
Object? isSubmitting = null,
|
||||
Object? showErrorMessages = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
phoneNumber: null == phoneNumber
|
||||
? _value.phoneNumber
|
||||
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
failureOrCheckPhoneOption: null == failureOrCheckPhoneOption
|
||||
? _value.failureOrCheckPhoneOption
|
||||
: failureOrCheckPhoneOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<Either<AuthFailure, CheckPhone>>,
|
||||
isSubmitting: null == isSubmitting
|
||||
? _value.isSubmitting
|
||||
: isSubmitting // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
showErrorMessages: null == showErrorMessages
|
||||
? _value.showErrorMessages
|
||||
: showErrorMessages // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$CheckPhoneFormStateImplCopyWith<$Res>
|
||||
implements $CheckPhoneFormStateCopyWith<$Res> {
|
||||
factory _$$CheckPhoneFormStateImplCopyWith(
|
||||
_$CheckPhoneFormStateImpl value,
|
||||
$Res Function(_$CheckPhoneFormStateImpl) then,
|
||||
) = __$$CheckPhoneFormStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
String phoneNumber,
|
||||
Option<Either<AuthFailure, CheckPhone>> failureOrCheckPhoneOption,
|
||||
bool isSubmitting,
|
||||
bool showErrorMessages,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$CheckPhoneFormStateImplCopyWithImpl<$Res>
|
||||
extends _$CheckPhoneFormStateCopyWithImpl<$Res, _$CheckPhoneFormStateImpl>
|
||||
implements _$$CheckPhoneFormStateImplCopyWith<$Res> {
|
||||
__$$CheckPhoneFormStateImplCopyWithImpl(
|
||||
_$CheckPhoneFormStateImpl _value,
|
||||
$Res Function(_$CheckPhoneFormStateImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of CheckPhoneFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? phoneNumber = null,
|
||||
Object? failureOrCheckPhoneOption = null,
|
||||
Object? isSubmitting = null,
|
||||
Object? showErrorMessages = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$CheckPhoneFormStateImpl(
|
||||
phoneNumber: null == phoneNumber
|
||||
? _value.phoneNumber
|
||||
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
failureOrCheckPhoneOption: null == failureOrCheckPhoneOption
|
||||
? _value.failureOrCheckPhoneOption
|
||||
: failureOrCheckPhoneOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<Either<AuthFailure, CheckPhone>>,
|
||||
isSubmitting: null == isSubmitting
|
||||
? _value.isSubmitting
|
||||
: isSubmitting // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
showErrorMessages: null == showErrorMessages
|
||||
? _value.showErrorMessages
|
||||
: showErrorMessages // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$CheckPhoneFormStateImpl implements _CheckPhoneFormState {
|
||||
const _$CheckPhoneFormStateImpl({
|
||||
required this.phoneNumber,
|
||||
required this.failureOrCheckPhoneOption,
|
||||
this.isSubmitting = false,
|
||||
this.showErrorMessages = false,
|
||||
});
|
||||
|
||||
@override
|
||||
final String phoneNumber;
|
||||
@override
|
||||
final Option<Either<AuthFailure, CheckPhone>> failureOrCheckPhoneOption;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isSubmitting;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool showErrorMessages;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CheckPhoneFormState(phoneNumber: $phoneNumber, failureOrCheckPhoneOption: $failureOrCheckPhoneOption, isSubmitting: $isSubmitting, showErrorMessages: $showErrorMessages)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$CheckPhoneFormStateImpl &&
|
||||
(identical(other.phoneNumber, phoneNumber) ||
|
||||
other.phoneNumber == phoneNumber) &&
|
||||
(identical(
|
||||
other.failureOrCheckPhoneOption,
|
||||
failureOrCheckPhoneOption,
|
||||
) ||
|
||||
other.failureOrCheckPhoneOption == failureOrCheckPhoneOption) &&
|
||||
(identical(other.isSubmitting, isSubmitting) ||
|
||||
other.isSubmitting == isSubmitting) &&
|
||||
(identical(other.showErrorMessages, showErrorMessages) ||
|
||||
other.showErrorMessages == showErrorMessages));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
phoneNumber,
|
||||
failureOrCheckPhoneOption,
|
||||
isSubmitting,
|
||||
showErrorMessages,
|
||||
);
|
||||
|
||||
/// Create a copy of CheckPhoneFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$CheckPhoneFormStateImplCopyWith<_$CheckPhoneFormStateImpl> get copyWith =>
|
||||
__$$CheckPhoneFormStateImplCopyWithImpl<_$CheckPhoneFormStateImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
}
|
||||
|
||||
abstract class _CheckPhoneFormState implements CheckPhoneFormState {
|
||||
const factory _CheckPhoneFormState({
|
||||
required final String phoneNumber,
|
||||
required final Option<Either<AuthFailure, CheckPhone>>
|
||||
failureOrCheckPhoneOption,
|
||||
final bool isSubmitting,
|
||||
final bool showErrorMessages,
|
||||
}) = _$CheckPhoneFormStateImpl;
|
||||
|
||||
@override
|
||||
String get phoneNumber;
|
||||
@override
|
||||
Option<Either<AuthFailure, CheckPhone>> get failureOrCheckPhoneOption;
|
||||
@override
|
||||
bool get isSubmitting;
|
||||
@override
|
||||
bool get showErrorMessages;
|
||||
|
||||
/// Create a copy of CheckPhoneFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$CheckPhoneFormStateImplCopyWith<_$CheckPhoneFormStateImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
part of 'check_phone_form_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class CheckPhoneFormEvent with _$CheckPhoneFormEvent {
|
||||
const factory CheckPhoneFormEvent.phoneNumberChanged(String phoneNumber) =
|
||||
_PhoneNumberChanged;
|
||||
const factory CheckPhoneFormEvent.submitted() = _Submitted;
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
part of 'check_phone_form_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class CheckPhoneFormState with _$CheckPhoneFormState {
|
||||
const factory CheckPhoneFormState({
|
||||
required String phoneNumber,
|
||||
required Option<Either<AuthFailure, CheckPhone>> failureOrCheckPhoneOption,
|
||||
@Default(false) bool isSubmitting,
|
||||
@Default(false) bool showErrorMessages,
|
||||
}) = _CheckPhoneFormState;
|
||||
|
||||
factory CheckPhoneFormState.initial() =>
|
||||
CheckPhoneFormState(phoneNumber: '', failureOrCheckPhoneOption: none());
|
||||
}
|
||||
67
lib/application/auth/login_form/login_form_bloc.dart
Normal file
@ -0,0 +1,67 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../domain/auth/auth.dart';
|
||||
|
||||
part 'login_form_event.dart';
|
||||
part 'login_form_state.dart';
|
||||
part 'login_form_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class LoginFormBloc extends Bloc<LoginFormEvent, LoginFormState> {
|
||||
final IAuthRepository _authRepository;
|
||||
LoginFormBloc(this._authRepository) : super(LoginFormState.initial()) {
|
||||
on<LoginFormEvent>(_onLoginFormEvent);
|
||||
}
|
||||
|
||||
Future<void> _onLoginFormEvent(
|
||||
LoginFormEvent event,
|
||||
Emitter<LoginFormState> emit,
|
||||
) {
|
||||
return event.map(
|
||||
phoneNumberChanged: (e) async {
|
||||
emit(
|
||||
state.copyWith(
|
||||
phoneNumber: e.phoneNumber,
|
||||
failureOrLoginOption: none(),
|
||||
),
|
||||
);
|
||||
},
|
||||
passwordChanged: (e) async {
|
||||
emit(
|
||||
state.copyWith(password: e.password, failureOrLoginOption: none()),
|
||||
);
|
||||
},
|
||||
submitted: (e) async {
|
||||
Either<AuthFailure, Login>? failureOrLogin;
|
||||
emit(state.copyWith(isSubmitting: true, failureOrLoginOption: none()));
|
||||
|
||||
final phoneNumberValid = state.phoneNumber.isNotEmpty;
|
||||
final passwordValid = state.password.isNotEmpty;
|
||||
|
||||
log(
|
||||
'phoneNumberValid: $phoneNumberValid, passwordValid: $passwordValid, phoneNumber: ${state.phoneNumber}, password: ${state.password}',
|
||||
);
|
||||
|
||||
if (phoneNumberValid && passwordValid) {
|
||||
failureOrLogin = await _authRepository.login(
|
||||
phoneNumber: state.phoneNumber,
|
||||
password: state.password,
|
||||
);
|
||||
|
||||
emit(
|
||||
state.copyWith(
|
||||
isSubmitting: false,
|
||||
failureOrLoginOption: optionOf(failureOrLogin),
|
||||
),
|
||||
);
|
||||
}
|
||||
emit(state.copyWith(showErrorMessages: true, isSubmitting: false));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
740
lib/application/auth/login_form/login_form_bloc.freezed.dart
Normal file
@ -0,0 +1,740 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'login_form_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
/// @nodoc
|
||||
mixin _$LoginFormEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String phoneNumber) phoneNumberChanged,
|
||||
required TResult Function(String password) passwordChanged,
|
||||
required TResult Function() submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult? Function(String password)? passwordChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult Function(String password)? passwordChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||
required TResult Function(_PasswordChanged value) passwordChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult? Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $LoginFormEventCopyWith<$Res> {
|
||||
factory $LoginFormEventCopyWith(
|
||||
LoginFormEvent value,
|
||||
$Res Function(LoginFormEvent) then,
|
||||
) = _$LoginFormEventCopyWithImpl<$Res, LoginFormEvent>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$LoginFormEventCopyWithImpl<$Res, $Val extends LoginFormEvent>
|
||||
implements $LoginFormEventCopyWith<$Res> {
|
||||
_$LoginFormEventCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of LoginFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$PhoneNumberChangedImplCopyWith<$Res> {
|
||||
factory _$$PhoneNumberChangedImplCopyWith(
|
||||
_$PhoneNumberChangedImpl value,
|
||||
$Res Function(_$PhoneNumberChangedImpl) then,
|
||||
) = __$$PhoneNumberChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String phoneNumber});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$PhoneNumberChangedImplCopyWithImpl<$Res>
|
||||
extends _$LoginFormEventCopyWithImpl<$Res, _$PhoneNumberChangedImpl>
|
||||
implements _$$PhoneNumberChangedImplCopyWith<$Res> {
|
||||
__$$PhoneNumberChangedImplCopyWithImpl(
|
||||
_$PhoneNumberChangedImpl _value,
|
||||
$Res Function(_$PhoneNumberChangedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of LoginFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? phoneNumber = null}) {
|
||||
return _then(
|
||||
_$PhoneNumberChangedImpl(
|
||||
null == phoneNumber
|
||||
? _value.phoneNumber
|
||||
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$PhoneNumberChangedImpl implements _PhoneNumberChanged {
|
||||
const _$PhoneNumberChangedImpl(this.phoneNumber);
|
||||
|
||||
@override
|
||||
final String phoneNumber;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LoginFormEvent.phoneNumberChanged(phoneNumber: $phoneNumber)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$PhoneNumberChangedImpl &&
|
||||
(identical(other.phoneNumber, phoneNumber) ||
|
||||
other.phoneNumber == phoneNumber));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, phoneNumber);
|
||||
|
||||
/// Create a copy of LoginFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$PhoneNumberChangedImplCopyWith<_$PhoneNumberChangedImpl> get copyWith =>
|
||||
__$$PhoneNumberChangedImplCopyWithImpl<_$PhoneNumberChangedImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String phoneNumber) phoneNumberChanged,
|
||||
required TResult Function(String password) passwordChanged,
|
||||
required TResult Function() submitted,
|
||||
}) {
|
||||
return phoneNumberChanged(phoneNumber);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult? Function(String password)? passwordChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) {
|
||||
return phoneNumberChanged?.call(phoneNumber);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult Function(String password)? passwordChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (phoneNumberChanged != null) {
|
||||
return phoneNumberChanged(phoneNumber);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||
required TResult Function(_PasswordChanged value) passwordChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) {
|
||||
return phoneNumberChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult? Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) {
|
||||
return phoneNumberChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (phoneNumberChanged != null) {
|
||||
return phoneNumberChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _PhoneNumberChanged implements LoginFormEvent {
|
||||
const factory _PhoneNumberChanged(final String phoneNumber) =
|
||||
_$PhoneNumberChangedImpl;
|
||||
|
||||
String get phoneNumber;
|
||||
|
||||
/// Create a copy of LoginFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$PhoneNumberChangedImplCopyWith<_$PhoneNumberChangedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$PasswordChangedImplCopyWith<$Res> {
|
||||
factory _$$PasswordChangedImplCopyWith(
|
||||
_$PasswordChangedImpl value,
|
||||
$Res Function(_$PasswordChangedImpl) then,
|
||||
) = __$$PasswordChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String password});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$PasswordChangedImplCopyWithImpl<$Res>
|
||||
extends _$LoginFormEventCopyWithImpl<$Res, _$PasswordChangedImpl>
|
||||
implements _$$PasswordChangedImplCopyWith<$Res> {
|
||||
__$$PasswordChangedImplCopyWithImpl(
|
||||
_$PasswordChangedImpl _value,
|
||||
$Res Function(_$PasswordChangedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of LoginFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? password = null}) {
|
||||
return _then(
|
||||
_$PasswordChangedImpl(
|
||||
null == password
|
||||
? _value.password
|
||||
: password // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$PasswordChangedImpl implements _PasswordChanged {
|
||||
const _$PasswordChangedImpl(this.password);
|
||||
|
||||
@override
|
||||
final String password;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LoginFormEvent.passwordChanged(password: $password)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$PasswordChangedImpl &&
|
||||
(identical(other.password, password) ||
|
||||
other.password == password));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, password);
|
||||
|
||||
/// Create a copy of LoginFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$PasswordChangedImplCopyWith<_$PasswordChangedImpl> get copyWith =>
|
||||
__$$PasswordChangedImplCopyWithImpl<_$PasswordChangedImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String phoneNumber) phoneNumberChanged,
|
||||
required TResult Function(String password) passwordChanged,
|
||||
required TResult Function() submitted,
|
||||
}) {
|
||||
return passwordChanged(password);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult? Function(String password)? passwordChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) {
|
||||
return passwordChanged?.call(password);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult Function(String password)? passwordChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (passwordChanged != null) {
|
||||
return passwordChanged(password);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||
required TResult Function(_PasswordChanged value) passwordChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) {
|
||||
return passwordChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult? Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) {
|
||||
return passwordChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (passwordChanged != null) {
|
||||
return passwordChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _PasswordChanged implements LoginFormEvent {
|
||||
const factory _PasswordChanged(final String password) = _$PasswordChangedImpl;
|
||||
|
||||
String get password;
|
||||
|
||||
/// Create a copy of LoginFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$PasswordChangedImplCopyWith<_$PasswordChangedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SubmittedImplCopyWith<$Res> {
|
||||
factory _$$SubmittedImplCopyWith(
|
||||
_$SubmittedImpl value,
|
||||
$Res Function(_$SubmittedImpl) then,
|
||||
) = __$$SubmittedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SubmittedImplCopyWithImpl<$Res>
|
||||
extends _$LoginFormEventCopyWithImpl<$Res, _$SubmittedImpl>
|
||||
implements _$$SubmittedImplCopyWith<$Res> {
|
||||
__$$SubmittedImplCopyWithImpl(
|
||||
_$SubmittedImpl _value,
|
||||
$Res Function(_$SubmittedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of LoginFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SubmittedImpl implements _Submitted {
|
||||
const _$SubmittedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LoginFormEvent.submitted()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$SubmittedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String phoneNumber) phoneNumberChanged,
|
||||
required TResult Function(String password) passwordChanged,
|
||||
required TResult Function() submitted,
|
||||
}) {
|
||||
return submitted();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult? Function(String password)? passwordChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) {
|
||||
return submitted?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult Function(String password)? passwordChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (submitted != null) {
|
||||
return submitted();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||
required TResult Function(_PasswordChanged value) passwordChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) {
|
||||
return submitted(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult? Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) {
|
||||
return submitted?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (submitted != null) {
|
||||
return submitted(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Submitted implements LoginFormEvent {
|
||||
const factory _Submitted() = _$SubmittedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$LoginFormState {
|
||||
String get phoneNumber => throw _privateConstructorUsedError;
|
||||
String get password => throw _privateConstructorUsedError;
|
||||
Option<Either<AuthFailure, Login>> get failureOrLoginOption =>
|
||||
throw _privateConstructorUsedError;
|
||||
bool get isSubmitting => throw _privateConstructorUsedError;
|
||||
bool get showErrorMessages => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of LoginFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$LoginFormStateCopyWith<LoginFormState> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $LoginFormStateCopyWith<$Res> {
|
||||
factory $LoginFormStateCopyWith(
|
||||
LoginFormState value,
|
||||
$Res Function(LoginFormState) then,
|
||||
) = _$LoginFormStateCopyWithImpl<$Res, LoginFormState>;
|
||||
@useResult
|
||||
$Res call({
|
||||
String phoneNumber,
|
||||
String password,
|
||||
Option<Either<AuthFailure, Login>> failureOrLoginOption,
|
||||
bool isSubmitting,
|
||||
bool showErrorMessages,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$LoginFormStateCopyWithImpl<$Res, $Val extends LoginFormState>
|
||||
implements $LoginFormStateCopyWith<$Res> {
|
||||
_$LoginFormStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of LoginFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? phoneNumber = null,
|
||||
Object? password = null,
|
||||
Object? failureOrLoginOption = null,
|
||||
Object? isSubmitting = null,
|
||||
Object? showErrorMessages = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
phoneNumber: null == phoneNumber
|
||||
? _value.phoneNumber
|
||||
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
password: null == password
|
||||
? _value.password
|
||||
: password // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
failureOrLoginOption: null == failureOrLoginOption
|
||||
? _value.failureOrLoginOption
|
||||
: failureOrLoginOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<Either<AuthFailure, Login>>,
|
||||
isSubmitting: null == isSubmitting
|
||||
? _value.isSubmitting
|
||||
: isSubmitting // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
showErrorMessages: null == showErrorMessages
|
||||
? _value.showErrorMessages
|
||||
: showErrorMessages // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$LoginFormStateImplCopyWith<$Res>
|
||||
implements $LoginFormStateCopyWith<$Res> {
|
||||
factory _$$LoginFormStateImplCopyWith(
|
||||
_$LoginFormStateImpl value,
|
||||
$Res Function(_$LoginFormStateImpl) then,
|
||||
) = __$$LoginFormStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
String phoneNumber,
|
||||
String password,
|
||||
Option<Either<AuthFailure, Login>> failureOrLoginOption,
|
||||
bool isSubmitting,
|
||||
bool showErrorMessages,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$LoginFormStateImplCopyWithImpl<$Res>
|
||||
extends _$LoginFormStateCopyWithImpl<$Res, _$LoginFormStateImpl>
|
||||
implements _$$LoginFormStateImplCopyWith<$Res> {
|
||||
__$$LoginFormStateImplCopyWithImpl(
|
||||
_$LoginFormStateImpl _value,
|
||||
$Res Function(_$LoginFormStateImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of LoginFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? phoneNumber = null,
|
||||
Object? password = null,
|
||||
Object? failureOrLoginOption = null,
|
||||
Object? isSubmitting = null,
|
||||
Object? showErrorMessages = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$LoginFormStateImpl(
|
||||
phoneNumber: null == phoneNumber
|
||||
? _value.phoneNumber
|
||||
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
password: null == password
|
||||
? _value.password
|
||||
: password // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
failureOrLoginOption: null == failureOrLoginOption
|
||||
? _value.failureOrLoginOption
|
||||
: failureOrLoginOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<Either<AuthFailure, Login>>,
|
||||
isSubmitting: null == isSubmitting
|
||||
? _value.isSubmitting
|
||||
: isSubmitting // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
showErrorMessages: null == showErrorMessages
|
||||
? _value.showErrorMessages
|
||||
: showErrorMessages // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$LoginFormStateImpl implements _LoginFormState {
|
||||
const _$LoginFormStateImpl({
|
||||
required this.phoneNumber,
|
||||
required this.password,
|
||||
required this.failureOrLoginOption,
|
||||
this.isSubmitting = false,
|
||||
this.showErrorMessages = false,
|
||||
});
|
||||
|
||||
@override
|
||||
final String phoneNumber;
|
||||
@override
|
||||
final String password;
|
||||
@override
|
||||
final Option<Either<AuthFailure, Login>> failureOrLoginOption;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isSubmitting;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool showErrorMessages;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LoginFormState(phoneNumber: $phoneNumber, password: $password, failureOrLoginOption: $failureOrLoginOption, isSubmitting: $isSubmitting, showErrorMessages: $showErrorMessages)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$LoginFormStateImpl &&
|
||||
(identical(other.phoneNumber, phoneNumber) ||
|
||||
other.phoneNumber == phoneNumber) &&
|
||||
(identical(other.password, password) ||
|
||||
other.password == password) &&
|
||||
(identical(other.failureOrLoginOption, failureOrLoginOption) ||
|
||||
other.failureOrLoginOption == failureOrLoginOption) &&
|
||||
(identical(other.isSubmitting, isSubmitting) ||
|
||||
other.isSubmitting == isSubmitting) &&
|
||||
(identical(other.showErrorMessages, showErrorMessages) ||
|
||||
other.showErrorMessages == showErrorMessages));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
phoneNumber,
|
||||
password,
|
||||
failureOrLoginOption,
|
||||
isSubmitting,
|
||||
showErrorMessages,
|
||||
);
|
||||
|
||||
/// Create a copy of LoginFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$LoginFormStateImplCopyWith<_$LoginFormStateImpl> get copyWith =>
|
||||
__$$LoginFormStateImplCopyWithImpl<_$LoginFormStateImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
}
|
||||
|
||||
abstract class _LoginFormState implements LoginFormState {
|
||||
const factory _LoginFormState({
|
||||
required final String phoneNumber,
|
||||
required final String password,
|
||||
required final Option<Either<AuthFailure, Login>> failureOrLoginOption,
|
||||
final bool isSubmitting,
|
||||
final bool showErrorMessages,
|
||||
}) = _$LoginFormStateImpl;
|
||||
|
||||
@override
|
||||
String get phoneNumber;
|
||||
@override
|
||||
String get password;
|
||||
@override
|
||||
Option<Either<AuthFailure, Login>> get failureOrLoginOption;
|
||||
@override
|
||||
bool get isSubmitting;
|
||||
@override
|
||||
bool get showErrorMessages;
|
||||
|
||||
/// Create a copy of LoginFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$LoginFormStateImplCopyWith<_$LoginFormStateImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
10
lib/application/auth/login_form/login_form_event.dart
Normal file
@ -0,0 +1,10 @@
|
||||
part of 'login_form_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class LoginFormEvent with _$LoginFormEvent {
|
||||
const factory LoginFormEvent.phoneNumberChanged(String phoneNumber) =
|
||||
_PhoneNumberChanged;
|
||||
const factory LoginFormEvent.passwordChanged(String password) =
|
||||
_PasswordChanged;
|
||||
const factory LoginFormEvent.submitted() = _Submitted;
|
||||
}
|
||||
18
lib/application/auth/login_form/login_form_state.dart
Normal file
@ -0,0 +1,18 @@
|
||||
part of 'login_form_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class LoginFormState with _$LoginFormState {
|
||||
const factory LoginFormState({
|
||||
required String phoneNumber,
|
||||
required String password,
|
||||
required Option<Either<AuthFailure, Login>> failureOrLoginOption,
|
||||
@Default(false) bool isSubmitting,
|
||||
@Default(false) bool showErrorMessages,
|
||||
}) = _LoginFormState;
|
||||
|
||||
factory LoginFormState.initial() => LoginFormState(
|
||||
phoneNumber: '',
|
||||
password: '',
|
||||
failureOrLoginOption: none(),
|
||||
);
|
||||
}
|
||||
37
lib/application/auth/logout_form/logout_form_bloc.dart
Normal file
@ -0,0 +1,37 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../domain/auth/auth.dart';
|
||||
|
||||
part 'logout_form_event.dart';
|
||||
part 'logout_form_state.dart';
|
||||
part 'logout_form_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class LogoutFormBloc extends Bloc<LogoutFormEvent, LogoutFormState> {
|
||||
final IAuthRepository _repository;
|
||||
|
||||
LogoutFormBloc(this._repository) : super(LogoutFormState.initial()) {
|
||||
on<LogoutFormEvent>(_onLogoutFormEvent);
|
||||
}
|
||||
|
||||
Future<void> _onLogoutFormEvent(
|
||||
LogoutFormEvent event,
|
||||
Emitter<LogoutFormState> emit,
|
||||
) {
|
||||
return event.map(
|
||||
submitted: (e) async {
|
||||
emit(state.copyWith(isSubmitting: true, failureOrAuthOption: none()));
|
||||
final failureOrAuth = await _repository.logout();
|
||||
emit(
|
||||
state.copyWith(
|
||||
isSubmitting: false,
|
||||
failureOrAuthOption: optionOf(failureOrAuth),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
335
lib/application/auth/logout_form/logout_form_bloc.freezed.dart
Normal file
@ -0,0 +1,335 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'logout_form_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
/// @nodoc
|
||||
mixin _$LogoutFormEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $LogoutFormEventCopyWith<$Res> {
|
||||
factory $LogoutFormEventCopyWith(
|
||||
LogoutFormEvent value,
|
||||
$Res Function(LogoutFormEvent) then,
|
||||
) = _$LogoutFormEventCopyWithImpl<$Res, LogoutFormEvent>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$LogoutFormEventCopyWithImpl<$Res, $Val extends LogoutFormEvent>
|
||||
implements $LogoutFormEventCopyWith<$Res> {
|
||||
_$LogoutFormEventCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of LogoutFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SubmittedImplCopyWith<$Res> {
|
||||
factory _$$SubmittedImplCopyWith(
|
||||
_$SubmittedImpl value,
|
||||
$Res Function(_$SubmittedImpl) then,
|
||||
) = __$$SubmittedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SubmittedImplCopyWithImpl<$Res>
|
||||
extends _$LogoutFormEventCopyWithImpl<$Res, _$SubmittedImpl>
|
||||
implements _$$SubmittedImplCopyWith<$Res> {
|
||||
__$$SubmittedImplCopyWithImpl(
|
||||
_$SubmittedImpl _value,
|
||||
$Res Function(_$SubmittedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of LogoutFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SubmittedImpl implements _Submitted {
|
||||
const _$SubmittedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LogoutFormEvent.submitted()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$SubmittedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() submitted,
|
||||
}) {
|
||||
return submitted();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? submitted,
|
||||
}) {
|
||||
return submitted?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (submitted != null) {
|
||||
return submitted();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) {
|
||||
return submitted(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) {
|
||||
return submitted?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (submitted != null) {
|
||||
return submitted(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Submitted implements LogoutFormEvent {
|
||||
const factory _Submitted() = _$SubmittedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$LogoutFormState {
|
||||
Option<Either<AuthFailure, Unit>> get failureOrAuthOption =>
|
||||
throw _privateConstructorUsedError;
|
||||
bool get isSubmitting => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of LogoutFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$LogoutFormStateCopyWith<LogoutFormState> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $LogoutFormStateCopyWith<$Res> {
|
||||
factory $LogoutFormStateCopyWith(
|
||||
LogoutFormState value,
|
||||
$Res Function(LogoutFormState) then,
|
||||
) = _$LogoutFormStateCopyWithImpl<$Res, LogoutFormState>;
|
||||
@useResult
|
||||
$Res call({
|
||||
Option<Either<AuthFailure, Unit>> failureOrAuthOption,
|
||||
bool isSubmitting,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$LogoutFormStateCopyWithImpl<$Res, $Val extends LogoutFormState>
|
||||
implements $LogoutFormStateCopyWith<$Res> {
|
||||
_$LogoutFormStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of LogoutFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? failureOrAuthOption = null, Object? isSubmitting = null}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
failureOrAuthOption: null == failureOrAuthOption
|
||||
? _value.failureOrAuthOption
|
||||
: failureOrAuthOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<Either<AuthFailure, Unit>>,
|
||||
isSubmitting: null == isSubmitting
|
||||
? _value.isSubmitting
|
||||
: isSubmitting // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$LogoutFormStateImplCopyWith<$Res>
|
||||
implements $LogoutFormStateCopyWith<$Res> {
|
||||
factory _$$LogoutFormStateImplCopyWith(
|
||||
_$LogoutFormStateImpl value,
|
||||
$Res Function(_$LogoutFormStateImpl) then,
|
||||
) = __$$LogoutFormStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
Option<Either<AuthFailure, Unit>> failureOrAuthOption,
|
||||
bool isSubmitting,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$LogoutFormStateImplCopyWithImpl<$Res>
|
||||
extends _$LogoutFormStateCopyWithImpl<$Res, _$LogoutFormStateImpl>
|
||||
implements _$$LogoutFormStateImplCopyWith<$Res> {
|
||||
__$$LogoutFormStateImplCopyWithImpl(
|
||||
_$LogoutFormStateImpl _value,
|
||||
$Res Function(_$LogoutFormStateImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of LogoutFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? failureOrAuthOption = null, Object? isSubmitting = null}) {
|
||||
return _then(
|
||||
_$LogoutFormStateImpl(
|
||||
failureOrAuthOption: null == failureOrAuthOption
|
||||
? _value.failureOrAuthOption
|
||||
: failureOrAuthOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<Either<AuthFailure, Unit>>,
|
||||
isSubmitting: null == isSubmitting
|
||||
? _value.isSubmitting
|
||||
: isSubmitting // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$LogoutFormStateImpl implements _LogoutFormState {
|
||||
const _$LogoutFormStateImpl({
|
||||
required this.failureOrAuthOption,
|
||||
this.isSubmitting = false,
|
||||
});
|
||||
|
||||
@override
|
||||
final Option<Either<AuthFailure, Unit>> failureOrAuthOption;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isSubmitting;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LogoutFormState(failureOrAuthOption: $failureOrAuthOption, isSubmitting: $isSubmitting)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$LogoutFormStateImpl &&
|
||||
(identical(other.failureOrAuthOption, failureOrAuthOption) ||
|
||||
other.failureOrAuthOption == failureOrAuthOption) &&
|
||||
(identical(other.isSubmitting, isSubmitting) ||
|
||||
other.isSubmitting == isSubmitting));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, failureOrAuthOption, isSubmitting);
|
||||
|
||||
/// Create a copy of LogoutFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$LogoutFormStateImplCopyWith<_$LogoutFormStateImpl> get copyWith =>
|
||||
__$$LogoutFormStateImplCopyWithImpl<_$LogoutFormStateImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
}
|
||||
|
||||
abstract class _LogoutFormState implements LogoutFormState {
|
||||
const factory _LogoutFormState({
|
||||
required final Option<Either<AuthFailure, Unit>> failureOrAuthOption,
|
||||
final bool isSubmitting,
|
||||
}) = _$LogoutFormStateImpl;
|
||||
|
||||
@override
|
||||
Option<Either<AuthFailure, Unit>> get failureOrAuthOption;
|
||||
@override
|
||||
bool get isSubmitting;
|
||||
|
||||
/// Create a copy of LogoutFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$LogoutFormStateImplCopyWith<_$LogoutFormStateImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
6
lib/application/auth/logout_form/logout_form_event.dart
Normal file
@ -0,0 +1,6 @@
|
||||
part of 'logout_form_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class LogoutFormEvent with _$LogoutFormEvent {
|
||||
const factory LogoutFormEvent.submitted() = _Submitted;
|
||||
}
|
||||
12
lib/application/auth/logout_form/logout_form_state.dart
Normal file
@ -0,0 +1,12 @@
|
||||
part of 'logout_form_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class LogoutFormState with _$LogoutFormState {
|
||||
const factory LogoutFormState({
|
||||
required Option<Either<AuthFailure, Unit>> failureOrAuthOption,
|
||||
@Default(false) bool isSubmitting,
|
||||
}) = _LogoutFormState;
|
||||
|
||||
factory LogoutFormState.initial() =>
|
||||
LogoutFormState(failureOrAuthOption: none(), isSubmitting: false);
|
||||
}
|
||||
69
lib/application/auth/register_form/register_form_bloc.dart
Normal file
@ -0,0 +1,69 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../domain/auth/auth.dart';
|
||||
|
||||
part 'register_form_event.dart';
|
||||
part 'register_form_state.dart';
|
||||
part 'register_form_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class RegisterFormBloc extends Bloc<RegisterFormEvent, RegisterFormState> {
|
||||
final IAuthRepository _repository;
|
||||
RegisterFormBloc(this._repository) : super(RegisterFormState.initial()) {
|
||||
on<RegisterFormEvent>(_onRegisterFormEvent);
|
||||
}
|
||||
|
||||
Future<void> _onRegisterFormEvent(
|
||||
RegisterFormEvent event,
|
||||
Emitter<RegisterFormState> emit,
|
||||
) {
|
||||
return event.map(
|
||||
phoneNumberChanged: (e) async {
|
||||
emit(
|
||||
state.copyWith(
|
||||
phoneNumber: e.phoneNumber,
|
||||
failureOrRegisterOption: none(),
|
||||
),
|
||||
);
|
||||
},
|
||||
nameChanged: (e) async {
|
||||
emit(state.copyWith(name: e.name, failureOrRegisterOption: none()));
|
||||
},
|
||||
birthDateChanged: (e) async {
|
||||
emit(
|
||||
state.copyWith(
|
||||
birthDate: e.birthDate,
|
||||
failureOrRegisterOption: none(),
|
||||
),
|
||||
);
|
||||
},
|
||||
submitted: (e) async {
|
||||
Either<AuthFailure, Register>? failureOrRegister;
|
||||
emit(
|
||||
state.copyWith(isSubmitting: true, failureOrRegisterOption: none()),
|
||||
);
|
||||
|
||||
final phoneNumberValid = state.phoneNumber.isNotEmpty;
|
||||
final nameValid = state.name.isNotEmpty;
|
||||
|
||||
if (phoneNumberValid && nameValid) {
|
||||
failureOrRegister = await _repository.register(
|
||||
phoneNumber: state.phoneNumber,
|
||||
name: state.name,
|
||||
birthDate: state.birthDate,
|
||||
);
|
||||
emit(
|
||||
state.copyWith(
|
||||
isSubmitting: false,
|
||||
failureOrRegisterOption: optionOf(failureOrRegister),
|
||||
),
|
||||
);
|
||||
}
|
||||
emit(state.copyWith(showErrorMessages: true, isSubmitting: false));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,944 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'register_form_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
/// @nodoc
|
||||
mixin _$RegisterFormEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String phoneNumber) phoneNumberChanged,
|
||||
required TResult Function(String name) nameChanged,
|
||||
required TResult Function(DateTime birthDate) birthDateChanged,
|
||||
required TResult Function() submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult? Function(String name)? nameChanged,
|
||||
TResult? Function(DateTime birthDate)? birthDateChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult Function(String name)? nameChanged,
|
||||
TResult Function(DateTime birthDate)? birthDateChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||
required TResult Function(_NameChanged value) nameChanged,
|
||||
required TResult Function(_BirthDateChanged value) birthDateChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult? Function(_NameChanged value)? nameChanged,
|
||||
TResult? Function(_BirthDateChanged value)? birthDateChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult Function(_NameChanged value)? nameChanged,
|
||||
TResult Function(_BirthDateChanged value)? birthDateChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $RegisterFormEventCopyWith<$Res> {
|
||||
factory $RegisterFormEventCopyWith(
|
||||
RegisterFormEvent value,
|
||||
$Res Function(RegisterFormEvent) then,
|
||||
) = _$RegisterFormEventCopyWithImpl<$Res, RegisterFormEvent>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$RegisterFormEventCopyWithImpl<$Res, $Val extends RegisterFormEvent>
|
||||
implements $RegisterFormEventCopyWith<$Res> {
|
||||
_$RegisterFormEventCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of RegisterFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$PhoneNumberChangedImplCopyWith<$Res> {
|
||||
factory _$$PhoneNumberChangedImplCopyWith(
|
||||
_$PhoneNumberChangedImpl value,
|
||||
$Res Function(_$PhoneNumberChangedImpl) then,
|
||||
) = __$$PhoneNumberChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String phoneNumber});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$PhoneNumberChangedImplCopyWithImpl<$Res>
|
||||
extends _$RegisterFormEventCopyWithImpl<$Res, _$PhoneNumberChangedImpl>
|
||||
implements _$$PhoneNumberChangedImplCopyWith<$Res> {
|
||||
__$$PhoneNumberChangedImplCopyWithImpl(
|
||||
_$PhoneNumberChangedImpl _value,
|
||||
$Res Function(_$PhoneNumberChangedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of RegisterFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? phoneNumber = null}) {
|
||||
return _then(
|
||||
_$PhoneNumberChangedImpl(
|
||||
null == phoneNumber
|
||||
? _value.phoneNumber
|
||||
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$PhoneNumberChangedImpl implements _PhoneNumberChanged {
|
||||
const _$PhoneNumberChangedImpl(this.phoneNumber);
|
||||
|
||||
@override
|
||||
final String phoneNumber;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'RegisterFormEvent.phoneNumberChanged(phoneNumber: $phoneNumber)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$PhoneNumberChangedImpl &&
|
||||
(identical(other.phoneNumber, phoneNumber) ||
|
||||
other.phoneNumber == phoneNumber));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, phoneNumber);
|
||||
|
||||
/// Create a copy of RegisterFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$PhoneNumberChangedImplCopyWith<_$PhoneNumberChangedImpl> get copyWith =>
|
||||
__$$PhoneNumberChangedImplCopyWithImpl<_$PhoneNumberChangedImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String phoneNumber) phoneNumberChanged,
|
||||
required TResult Function(String name) nameChanged,
|
||||
required TResult Function(DateTime birthDate) birthDateChanged,
|
||||
required TResult Function() submitted,
|
||||
}) {
|
||||
return phoneNumberChanged(phoneNumber);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult? Function(String name)? nameChanged,
|
||||
TResult? Function(DateTime birthDate)? birthDateChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) {
|
||||
return phoneNumberChanged?.call(phoneNumber);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult Function(String name)? nameChanged,
|
||||
TResult Function(DateTime birthDate)? birthDateChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (phoneNumberChanged != null) {
|
||||
return phoneNumberChanged(phoneNumber);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||
required TResult Function(_NameChanged value) nameChanged,
|
||||
required TResult Function(_BirthDateChanged value) birthDateChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) {
|
||||
return phoneNumberChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult? Function(_NameChanged value)? nameChanged,
|
||||
TResult? Function(_BirthDateChanged value)? birthDateChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) {
|
||||
return phoneNumberChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult Function(_NameChanged value)? nameChanged,
|
||||
TResult Function(_BirthDateChanged value)? birthDateChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (phoneNumberChanged != null) {
|
||||
return phoneNumberChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _PhoneNumberChanged implements RegisterFormEvent {
|
||||
const factory _PhoneNumberChanged(final String phoneNumber) =
|
||||
_$PhoneNumberChangedImpl;
|
||||
|
||||
String get phoneNumber;
|
||||
|
||||
/// Create a copy of RegisterFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$PhoneNumberChangedImplCopyWith<_$PhoneNumberChangedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$NameChangedImplCopyWith<$Res> {
|
||||
factory _$$NameChangedImplCopyWith(
|
||||
_$NameChangedImpl value,
|
||||
$Res Function(_$NameChangedImpl) then,
|
||||
) = __$$NameChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String name});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$NameChangedImplCopyWithImpl<$Res>
|
||||
extends _$RegisterFormEventCopyWithImpl<$Res, _$NameChangedImpl>
|
||||
implements _$$NameChangedImplCopyWith<$Res> {
|
||||
__$$NameChangedImplCopyWithImpl(
|
||||
_$NameChangedImpl _value,
|
||||
$Res Function(_$NameChangedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of RegisterFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? name = null}) {
|
||||
return _then(
|
||||
_$NameChangedImpl(
|
||||
null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$NameChangedImpl implements _NameChanged {
|
||||
const _$NameChangedImpl(this.name);
|
||||
|
||||
@override
|
||||
final String name;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'RegisterFormEvent.nameChanged(name: $name)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$NameChangedImpl &&
|
||||
(identical(other.name, name) || other.name == name));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, name);
|
||||
|
||||
/// Create a copy of RegisterFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$NameChangedImplCopyWith<_$NameChangedImpl> get copyWith =>
|
||||
__$$NameChangedImplCopyWithImpl<_$NameChangedImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String phoneNumber) phoneNumberChanged,
|
||||
required TResult Function(String name) nameChanged,
|
||||
required TResult Function(DateTime birthDate) birthDateChanged,
|
||||
required TResult Function() submitted,
|
||||
}) {
|
||||
return nameChanged(name);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult? Function(String name)? nameChanged,
|
||||
TResult? Function(DateTime birthDate)? birthDateChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) {
|
||||
return nameChanged?.call(name);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult Function(String name)? nameChanged,
|
||||
TResult Function(DateTime birthDate)? birthDateChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (nameChanged != null) {
|
||||
return nameChanged(name);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||
required TResult Function(_NameChanged value) nameChanged,
|
||||
required TResult Function(_BirthDateChanged value) birthDateChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) {
|
||||
return nameChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult? Function(_NameChanged value)? nameChanged,
|
||||
TResult? Function(_BirthDateChanged value)? birthDateChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) {
|
||||
return nameChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult Function(_NameChanged value)? nameChanged,
|
||||
TResult Function(_BirthDateChanged value)? birthDateChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (nameChanged != null) {
|
||||
return nameChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _NameChanged implements RegisterFormEvent {
|
||||
const factory _NameChanged(final String name) = _$NameChangedImpl;
|
||||
|
||||
String get name;
|
||||
|
||||
/// Create a copy of RegisterFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$NameChangedImplCopyWith<_$NameChangedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$BirthDateChangedImplCopyWith<$Res> {
|
||||
factory _$$BirthDateChangedImplCopyWith(
|
||||
_$BirthDateChangedImpl value,
|
||||
$Res Function(_$BirthDateChangedImpl) then,
|
||||
) = __$$BirthDateChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({DateTime birthDate});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$BirthDateChangedImplCopyWithImpl<$Res>
|
||||
extends _$RegisterFormEventCopyWithImpl<$Res, _$BirthDateChangedImpl>
|
||||
implements _$$BirthDateChangedImplCopyWith<$Res> {
|
||||
__$$BirthDateChangedImplCopyWithImpl(
|
||||
_$BirthDateChangedImpl _value,
|
||||
$Res Function(_$BirthDateChangedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of RegisterFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? birthDate = null}) {
|
||||
return _then(
|
||||
_$BirthDateChangedImpl(
|
||||
null == birthDate
|
||||
? _value.birthDate
|
||||
: birthDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$BirthDateChangedImpl implements _BirthDateChanged {
|
||||
const _$BirthDateChangedImpl(this.birthDate);
|
||||
|
||||
@override
|
||||
final DateTime birthDate;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'RegisterFormEvent.birthDateChanged(birthDate: $birthDate)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$BirthDateChangedImpl &&
|
||||
(identical(other.birthDate, birthDate) ||
|
||||
other.birthDate == birthDate));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, birthDate);
|
||||
|
||||
/// Create a copy of RegisterFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$BirthDateChangedImplCopyWith<_$BirthDateChangedImpl> get copyWith =>
|
||||
__$$BirthDateChangedImplCopyWithImpl<_$BirthDateChangedImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String phoneNumber) phoneNumberChanged,
|
||||
required TResult Function(String name) nameChanged,
|
||||
required TResult Function(DateTime birthDate) birthDateChanged,
|
||||
required TResult Function() submitted,
|
||||
}) {
|
||||
return birthDateChanged(birthDate);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult? Function(String name)? nameChanged,
|
||||
TResult? Function(DateTime birthDate)? birthDateChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) {
|
||||
return birthDateChanged?.call(birthDate);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult Function(String name)? nameChanged,
|
||||
TResult Function(DateTime birthDate)? birthDateChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (birthDateChanged != null) {
|
||||
return birthDateChanged(birthDate);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||
required TResult Function(_NameChanged value) nameChanged,
|
||||
required TResult Function(_BirthDateChanged value) birthDateChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) {
|
||||
return birthDateChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult? Function(_NameChanged value)? nameChanged,
|
||||
TResult? Function(_BirthDateChanged value)? birthDateChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) {
|
||||
return birthDateChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult Function(_NameChanged value)? nameChanged,
|
||||
TResult Function(_BirthDateChanged value)? birthDateChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (birthDateChanged != null) {
|
||||
return birthDateChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _BirthDateChanged implements RegisterFormEvent {
|
||||
const factory _BirthDateChanged(final DateTime birthDate) =
|
||||
_$BirthDateChangedImpl;
|
||||
|
||||
DateTime get birthDate;
|
||||
|
||||
/// Create a copy of RegisterFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$BirthDateChangedImplCopyWith<_$BirthDateChangedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SubmittedImplCopyWith<$Res> {
|
||||
factory _$$SubmittedImplCopyWith(
|
||||
_$SubmittedImpl value,
|
||||
$Res Function(_$SubmittedImpl) then,
|
||||
) = __$$SubmittedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SubmittedImplCopyWithImpl<$Res>
|
||||
extends _$RegisterFormEventCopyWithImpl<$Res, _$SubmittedImpl>
|
||||
implements _$$SubmittedImplCopyWith<$Res> {
|
||||
__$$SubmittedImplCopyWithImpl(
|
||||
_$SubmittedImpl _value,
|
||||
$Res Function(_$SubmittedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of RegisterFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SubmittedImpl implements _Submitted {
|
||||
const _$SubmittedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'RegisterFormEvent.submitted()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$SubmittedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String phoneNumber) phoneNumberChanged,
|
||||
required TResult Function(String name) nameChanged,
|
||||
required TResult Function(DateTime birthDate) birthDateChanged,
|
||||
required TResult Function() submitted,
|
||||
}) {
|
||||
return submitted();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult? Function(String name)? nameChanged,
|
||||
TResult? Function(DateTime birthDate)? birthDateChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) {
|
||||
return submitted?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult Function(String name)? nameChanged,
|
||||
TResult Function(DateTime birthDate)? birthDateChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (submitted != null) {
|
||||
return submitted();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||
required TResult Function(_NameChanged value) nameChanged,
|
||||
required TResult Function(_BirthDateChanged value) birthDateChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) {
|
||||
return submitted(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult? Function(_NameChanged value)? nameChanged,
|
||||
TResult? Function(_BirthDateChanged value)? birthDateChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) {
|
||||
return submitted?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult Function(_NameChanged value)? nameChanged,
|
||||
TResult Function(_BirthDateChanged value)? birthDateChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (submitted != null) {
|
||||
return submitted(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Submitted implements RegisterFormEvent {
|
||||
const factory _Submitted() = _$SubmittedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$RegisterFormState {
|
||||
String get phoneNumber => throw _privateConstructorUsedError;
|
||||
String get name => throw _privateConstructorUsedError;
|
||||
DateTime get birthDate => throw _privateConstructorUsedError;
|
||||
Option<Either<AuthFailure, Register>> get failureOrRegisterOption =>
|
||||
throw _privateConstructorUsedError;
|
||||
bool get isSubmitting => throw _privateConstructorUsedError;
|
||||
bool get showErrorMessages => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of RegisterFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$RegisterFormStateCopyWith<RegisterFormState> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $RegisterFormStateCopyWith<$Res> {
|
||||
factory $RegisterFormStateCopyWith(
|
||||
RegisterFormState value,
|
||||
$Res Function(RegisterFormState) then,
|
||||
) = _$RegisterFormStateCopyWithImpl<$Res, RegisterFormState>;
|
||||
@useResult
|
||||
$Res call({
|
||||
String phoneNumber,
|
||||
String name,
|
||||
DateTime birthDate,
|
||||
Option<Either<AuthFailure, Register>> failureOrRegisterOption,
|
||||
bool isSubmitting,
|
||||
bool showErrorMessages,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$RegisterFormStateCopyWithImpl<$Res, $Val extends RegisterFormState>
|
||||
implements $RegisterFormStateCopyWith<$Res> {
|
||||
_$RegisterFormStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of RegisterFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? phoneNumber = null,
|
||||
Object? name = null,
|
||||
Object? birthDate = null,
|
||||
Object? failureOrRegisterOption = null,
|
||||
Object? isSubmitting = null,
|
||||
Object? showErrorMessages = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
phoneNumber: null == phoneNumber
|
||||
? _value.phoneNumber
|
||||
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
birthDate: null == birthDate
|
||||
? _value.birthDate
|
||||
: birthDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
failureOrRegisterOption: null == failureOrRegisterOption
|
||||
? _value.failureOrRegisterOption
|
||||
: failureOrRegisterOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<Either<AuthFailure, Register>>,
|
||||
isSubmitting: null == isSubmitting
|
||||
? _value.isSubmitting
|
||||
: isSubmitting // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
showErrorMessages: null == showErrorMessages
|
||||
? _value.showErrorMessages
|
||||
: showErrorMessages // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$RegisterFormStateImplCopyWith<$Res>
|
||||
implements $RegisterFormStateCopyWith<$Res> {
|
||||
factory _$$RegisterFormStateImplCopyWith(
|
||||
_$RegisterFormStateImpl value,
|
||||
$Res Function(_$RegisterFormStateImpl) then,
|
||||
) = __$$RegisterFormStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
String phoneNumber,
|
||||
String name,
|
||||
DateTime birthDate,
|
||||
Option<Either<AuthFailure, Register>> failureOrRegisterOption,
|
||||
bool isSubmitting,
|
||||
bool showErrorMessages,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$RegisterFormStateImplCopyWithImpl<$Res>
|
||||
extends _$RegisterFormStateCopyWithImpl<$Res, _$RegisterFormStateImpl>
|
||||
implements _$$RegisterFormStateImplCopyWith<$Res> {
|
||||
__$$RegisterFormStateImplCopyWithImpl(
|
||||
_$RegisterFormStateImpl _value,
|
||||
$Res Function(_$RegisterFormStateImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of RegisterFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? phoneNumber = null,
|
||||
Object? name = null,
|
||||
Object? birthDate = null,
|
||||
Object? failureOrRegisterOption = null,
|
||||
Object? isSubmitting = null,
|
||||
Object? showErrorMessages = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$RegisterFormStateImpl(
|
||||
phoneNumber: null == phoneNumber
|
||||
? _value.phoneNumber
|
||||
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
birthDate: null == birthDate
|
||||
? _value.birthDate
|
||||
: birthDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
failureOrRegisterOption: null == failureOrRegisterOption
|
||||
? _value.failureOrRegisterOption
|
||||
: failureOrRegisterOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<Either<AuthFailure, Register>>,
|
||||
isSubmitting: null == isSubmitting
|
||||
? _value.isSubmitting
|
||||
: isSubmitting // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
showErrorMessages: null == showErrorMessages
|
||||
? _value.showErrorMessages
|
||||
: showErrorMessages // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$RegisterFormStateImpl implements _RegisterFormState {
|
||||
const _$RegisterFormStateImpl({
|
||||
required this.phoneNumber,
|
||||
required this.name,
|
||||
required this.birthDate,
|
||||
required this.failureOrRegisterOption,
|
||||
this.isSubmitting = false,
|
||||
this.showErrorMessages = false,
|
||||
});
|
||||
|
||||
@override
|
||||
final String phoneNumber;
|
||||
@override
|
||||
final String name;
|
||||
@override
|
||||
final DateTime birthDate;
|
||||
@override
|
||||
final Option<Either<AuthFailure, Register>> failureOrRegisterOption;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isSubmitting;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool showErrorMessages;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'RegisterFormState(phoneNumber: $phoneNumber, name: $name, birthDate: $birthDate, failureOrRegisterOption: $failureOrRegisterOption, isSubmitting: $isSubmitting, showErrorMessages: $showErrorMessages)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$RegisterFormStateImpl &&
|
||||
(identical(other.phoneNumber, phoneNumber) ||
|
||||
other.phoneNumber == phoneNumber) &&
|
||||
(identical(other.name, name) || other.name == name) &&
|
||||
(identical(other.birthDate, birthDate) ||
|
||||
other.birthDate == birthDate) &&
|
||||
(identical(
|
||||
other.failureOrRegisterOption,
|
||||
failureOrRegisterOption,
|
||||
) ||
|
||||
other.failureOrRegisterOption == failureOrRegisterOption) &&
|
||||
(identical(other.isSubmitting, isSubmitting) ||
|
||||
other.isSubmitting == isSubmitting) &&
|
||||
(identical(other.showErrorMessages, showErrorMessages) ||
|
||||
other.showErrorMessages == showErrorMessages));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
phoneNumber,
|
||||
name,
|
||||
birthDate,
|
||||
failureOrRegisterOption,
|
||||
isSubmitting,
|
||||
showErrorMessages,
|
||||
);
|
||||
|
||||
/// Create a copy of RegisterFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$RegisterFormStateImplCopyWith<_$RegisterFormStateImpl> get copyWith =>
|
||||
__$$RegisterFormStateImplCopyWithImpl<_$RegisterFormStateImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
}
|
||||
|
||||
abstract class _RegisterFormState implements RegisterFormState {
|
||||
const factory _RegisterFormState({
|
||||
required final String phoneNumber,
|
||||
required final String name,
|
||||
required final DateTime birthDate,
|
||||
required final Option<Either<AuthFailure, Register>>
|
||||
failureOrRegisterOption,
|
||||
final bool isSubmitting,
|
||||
final bool showErrorMessages,
|
||||
}) = _$RegisterFormStateImpl;
|
||||
|
||||
@override
|
||||
String get phoneNumber;
|
||||
@override
|
||||
String get name;
|
||||
@override
|
||||
DateTime get birthDate;
|
||||
@override
|
||||
Option<Either<AuthFailure, Register>> get failureOrRegisterOption;
|
||||
@override
|
||||
bool get isSubmitting;
|
||||
@override
|
||||
bool get showErrorMessages;
|
||||
|
||||
/// Create a copy of RegisterFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$RegisterFormStateImplCopyWith<_$RegisterFormStateImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
11
lib/application/auth/register_form/register_form_event.dart
Normal file
@ -0,0 +1,11 @@
|
||||
part of 'register_form_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class RegisterFormEvent with _$RegisterFormEvent {
|
||||
const factory RegisterFormEvent.phoneNumberChanged(String phoneNumber) =
|
||||
_PhoneNumberChanged;
|
||||
const factory RegisterFormEvent.nameChanged(String name) = _NameChanged;
|
||||
const factory RegisterFormEvent.birthDateChanged(DateTime birthDate) =
|
||||
_BirthDateChanged;
|
||||
const factory RegisterFormEvent.submitted() = _Submitted;
|
||||
}
|
||||
20
lib/application/auth/register_form/register_form_state.dart
Normal file
@ -0,0 +1,20 @@
|
||||
part of 'register_form_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class RegisterFormState with _$RegisterFormState {
|
||||
const factory RegisterFormState({
|
||||
required String phoneNumber,
|
||||
required String name,
|
||||
required DateTime birthDate,
|
||||
required Option<Either<AuthFailure, Register>> failureOrRegisterOption,
|
||||
@Default(false) bool isSubmitting,
|
||||
@Default(false) bool showErrorMessages,
|
||||
}) = _RegisterFormState;
|
||||
|
||||
factory RegisterFormState.initial() => RegisterFormState(
|
||||
phoneNumber: '',
|
||||
failureOrRegisterOption: none(),
|
||||
name: '',
|
||||
birthDate: DateTime.now(),
|
||||
);
|
||||
}
|
||||
59
lib/application/auth/resend_form/resend_form_bloc.dart
Normal file
@ -0,0 +1,59 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../domain/auth/auth.dart';
|
||||
|
||||
part 'resend_form_event.dart';
|
||||
part 'resend_form_state.dart';
|
||||
part 'resend_form_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class ResendFormBloc extends Bloc<ResendFormEvent, ResendFormState> {
|
||||
final IAuthRepository _repository;
|
||||
ResendFormBloc(this._repository) : super(ResendFormState.initial()) {
|
||||
on<ResendFormEvent>(_onResendFormEvent);
|
||||
}
|
||||
|
||||
Future<void> _onResendFormEvent(
|
||||
ResendFormEvent event,
|
||||
Emitter<ResendFormState> emit,
|
||||
) {
|
||||
return event.map(
|
||||
phoneNumberChanged: (e) async {
|
||||
emit(
|
||||
state.copyWith(
|
||||
phoneNumber: e.phoneNumber,
|
||||
failureOrResendOption: none(),
|
||||
),
|
||||
);
|
||||
},
|
||||
purposeChanged: (e) async {
|
||||
emit(state.copyWith(purpose: e.purpose, failureOrResendOption: none()));
|
||||
},
|
||||
submitted: (e) async {
|
||||
Either<AuthFailure, Resend>? failureOrResend;
|
||||
emit(state.copyWith(isSubmitting: true, failureOrResendOption: none()));
|
||||
|
||||
final phoneNumberValid = state.phoneNumber.isNotEmpty;
|
||||
final purposeValid = state.purpose.isNotEmpty;
|
||||
|
||||
if (phoneNumberValid && purposeValid) {
|
||||
failureOrResend = await _repository.resend(
|
||||
phoneNumber: state.phoneNumber,
|
||||
purpose: state.purpose,
|
||||
);
|
||||
|
||||
emit(
|
||||
state.copyWith(
|
||||
isSubmitting: false,
|
||||
failureOrResendOption: optionOf(failureOrResend),
|
||||
),
|
||||
);
|
||||
}
|
||||
emit(state.copyWith(showErrorMessages: true, isSubmitting: false));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
738
lib/application/auth/resend_form/resend_form_bloc.freezed.dart
Normal file
@ -0,0 +1,738 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'resend_form_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ResendFormEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String phoneNumber) phoneNumberChanged,
|
||||
required TResult Function(String purpose) purposeChanged,
|
||||
required TResult Function() submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult? Function(String purpose)? purposeChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult Function(String purpose)? purposeChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||
required TResult Function(_PurposeChanged value) purposeChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult? Function(_PurposeChanged value)? purposeChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult Function(_PurposeChanged value)? purposeChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $ResendFormEventCopyWith<$Res> {
|
||||
factory $ResendFormEventCopyWith(
|
||||
ResendFormEvent value,
|
||||
$Res Function(ResendFormEvent) then,
|
||||
) = _$ResendFormEventCopyWithImpl<$Res, ResendFormEvent>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$ResendFormEventCopyWithImpl<$Res, $Val extends ResendFormEvent>
|
||||
implements $ResendFormEventCopyWith<$Res> {
|
||||
_$ResendFormEventCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of ResendFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$PhoneNumberChangedImplCopyWith<$Res> {
|
||||
factory _$$PhoneNumberChangedImplCopyWith(
|
||||
_$PhoneNumberChangedImpl value,
|
||||
$Res Function(_$PhoneNumberChangedImpl) then,
|
||||
) = __$$PhoneNumberChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String phoneNumber});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$PhoneNumberChangedImplCopyWithImpl<$Res>
|
||||
extends _$ResendFormEventCopyWithImpl<$Res, _$PhoneNumberChangedImpl>
|
||||
implements _$$PhoneNumberChangedImplCopyWith<$Res> {
|
||||
__$$PhoneNumberChangedImplCopyWithImpl(
|
||||
_$PhoneNumberChangedImpl _value,
|
||||
$Res Function(_$PhoneNumberChangedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of ResendFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? phoneNumber = null}) {
|
||||
return _then(
|
||||
_$PhoneNumberChangedImpl(
|
||||
null == phoneNumber
|
||||
? _value.phoneNumber
|
||||
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$PhoneNumberChangedImpl implements _PhoneNumberChanged {
|
||||
const _$PhoneNumberChangedImpl(this.phoneNumber);
|
||||
|
||||
@override
|
||||
final String phoneNumber;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ResendFormEvent.phoneNumberChanged(phoneNumber: $phoneNumber)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$PhoneNumberChangedImpl &&
|
||||
(identical(other.phoneNumber, phoneNumber) ||
|
||||
other.phoneNumber == phoneNumber));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, phoneNumber);
|
||||
|
||||
/// Create a copy of ResendFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$PhoneNumberChangedImplCopyWith<_$PhoneNumberChangedImpl> get copyWith =>
|
||||
__$$PhoneNumberChangedImplCopyWithImpl<_$PhoneNumberChangedImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String phoneNumber) phoneNumberChanged,
|
||||
required TResult Function(String purpose) purposeChanged,
|
||||
required TResult Function() submitted,
|
||||
}) {
|
||||
return phoneNumberChanged(phoneNumber);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult? Function(String purpose)? purposeChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) {
|
||||
return phoneNumberChanged?.call(phoneNumber);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult Function(String purpose)? purposeChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (phoneNumberChanged != null) {
|
||||
return phoneNumberChanged(phoneNumber);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||
required TResult Function(_PurposeChanged value) purposeChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) {
|
||||
return phoneNumberChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult? Function(_PurposeChanged value)? purposeChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) {
|
||||
return phoneNumberChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult Function(_PurposeChanged value)? purposeChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (phoneNumberChanged != null) {
|
||||
return phoneNumberChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _PhoneNumberChanged implements ResendFormEvent {
|
||||
const factory _PhoneNumberChanged(final String phoneNumber) =
|
||||
_$PhoneNumberChangedImpl;
|
||||
|
||||
String get phoneNumber;
|
||||
|
||||
/// Create a copy of ResendFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$PhoneNumberChangedImplCopyWith<_$PhoneNumberChangedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$PurposeChangedImplCopyWith<$Res> {
|
||||
factory _$$PurposeChangedImplCopyWith(
|
||||
_$PurposeChangedImpl value,
|
||||
$Res Function(_$PurposeChangedImpl) then,
|
||||
) = __$$PurposeChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String purpose});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$PurposeChangedImplCopyWithImpl<$Res>
|
||||
extends _$ResendFormEventCopyWithImpl<$Res, _$PurposeChangedImpl>
|
||||
implements _$$PurposeChangedImplCopyWith<$Res> {
|
||||
__$$PurposeChangedImplCopyWithImpl(
|
||||
_$PurposeChangedImpl _value,
|
||||
$Res Function(_$PurposeChangedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of ResendFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? purpose = null}) {
|
||||
return _then(
|
||||
_$PurposeChangedImpl(
|
||||
null == purpose
|
||||
? _value.purpose
|
||||
: purpose // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$PurposeChangedImpl implements _PurposeChanged {
|
||||
const _$PurposeChangedImpl(this.purpose);
|
||||
|
||||
@override
|
||||
final String purpose;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ResendFormEvent.purposeChanged(purpose: $purpose)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$PurposeChangedImpl &&
|
||||
(identical(other.purpose, purpose) || other.purpose == purpose));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, purpose);
|
||||
|
||||
/// Create a copy of ResendFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$PurposeChangedImplCopyWith<_$PurposeChangedImpl> get copyWith =>
|
||||
__$$PurposeChangedImplCopyWithImpl<_$PurposeChangedImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String phoneNumber) phoneNumberChanged,
|
||||
required TResult Function(String purpose) purposeChanged,
|
||||
required TResult Function() submitted,
|
||||
}) {
|
||||
return purposeChanged(purpose);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult? Function(String purpose)? purposeChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) {
|
||||
return purposeChanged?.call(purpose);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult Function(String purpose)? purposeChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (purposeChanged != null) {
|
||||
return purposeChanged(purpose);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||
required TResult Function(_PurposeChanged value) purposeChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) {
|
||||
return purposeChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult? Function(_PurposeChanged value)? purposeChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) {
|
||||
return purposeChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult Function(_PurposeChanged value)? purposeChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (purposeChanged != null) {
|
||||
return purposeChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _PurposeChanged implements ResendFormEvent {
|
||||
const factory _PurposeChanged(final String purpose) = _$PurposeChangedImpl;
|
||||
|
||||
String get purpose;
|
||||
|
||||
/// Create a copy of ResendFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$PurposeChangedImplCopyWith<_$PurposeChangedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SubmittedImplCopyWith<$Res> {
|
||||
factory _$$SubmittedImplCopyWith(
|
||||
_$SubmittedImpl value,
|
||||
$Res Function(_$SubmittedImpl) then,
|
||||
) = __$$SubmittedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SubmittedImplCopyWithImpl<$Res>
|
||||
extends _$ResendFormEventCopyWithImpl<$Res, _$SubmittedImpl>
|
||||
implements _$$SubmittedImplCopyWith<$Res> {
|
||||
__$$SubmittedImplCopyWithImpl(
|
||||
_$SubmittedImpl _value,
|
||||
$Res Function(_$SubmittedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of ResendFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SubmittedImpl implements _Submitted {
|
||||
const _$SubmittedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ResendFormEvent.submitted()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$SubmittedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String phoneNumber) phoneNumberChanged,
|
||||
required TResult Function(String purpose) purposeChanged,
|
||||
required TResult Function() submitted,
|
||||
}) {
|
||||
return submitted();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult? Function(String purpose)? purposeChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) {
|
||||
return submitted?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String phoneNumber)? phoneNumberChanged,
|
||||
TResult Function(String purpose)? purposeChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (submitted != null) {
|
||||
return submitted();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_PhoneNumberChanged value) phoneNumberChanged,
|
||||
required TResult Function(_PurposeChanged value) purposeChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) {
|
||||
return submitted(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult? Function(_PurposeChanged value)? purposeChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) {
|
||||
return submitted?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_PhoneNumberChanged value)? phoneNumberChanged,
|
||||
TResult Function(_PurposeChanged value)? purposeChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (submitted != null) {
|
||||
return submitted(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Submitted implements ResendFormEvent {
|
||||
const factory _Submitted() = _$SubmittedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ResendFormState {
|
||||
String get phoneNumber => throw _privateConstructorUsedError;
|
||||
String get purpose => throw _privateConstructorUsedError;
|
||||
Option<Either<AuthFailure, Resend>> get failureOrResendOption =>
|
||||
throw _privateConstructorUsedError;
|
||||
bool get isSubmitting => throw _privateConstructorUsedError;
|
||||
bool get showErrorMessages => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of ResendFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$ResendFormStateCopyWith<ResendFormState> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $ResendFormStateCopyWith<$Res> {
|
||||
factory $ResendFormStateCopyWith(
|
||||
ResendFormState value,
|
||||
$Res Function(ResendFormState) then,
|
||||
) = _$ResendFormStateCopyWithImpl<$Res, ResendFormState>;
|
||||
@useResult
|
||||
$Res call({
|
||||
String phoneNumber,
|
||||
String purpose,
|
||||
Option<Either<AuthFailure, Resend>> failureOrResendOption,
|
||||
bool isSubmitting,
|
||||
bool showErrorMessages,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$ResendFormStateCopyWithImpl<$Res, $Val extends ResendFormState>
|
||||
implements $ResendFormStateCopyWith<$Res> {
|
||||
_$ResendFormStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of ResendFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? phoneNumber = null,
|
||||
Object? purpose = null,
|
||||
Object? failureOrResendOption = null,
|
||||
Object? isSubmitting = null,
|
||||
Object? showErrorMessages = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
phoneNumber: null == phoneNumber
|
||||
? _value.phoneNumber
|
||||
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
purpose: null == purpose
|
||||
? _value.purpose
|
||||
: purpose // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
failureOrResendOption: null == failureOrResendOption
|
||||
? _value.failureOrResendOption
|
||||
: failureOrResendOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<Either<AuthFailure, Resend>>,
|
||||
isSubmitting: null == isSubmitting
|
||||
? _value.isSubmitting
|
||||
: isSubmitting // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
showErrorMessages: null == showErrorMessages
|
||||
? _value.showErrorMessages
|
||||
: showErrorMessages // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ResendFormStateImplCopyWith<$Res>
|
||||
implements $ResendFormStateCopyWith<$Res> {
|
||||
factory _$$ResendFormStateImplCopyWith(
|
||||
_$ResendFormStateImpl value,
|
||||
$Res Function(_$ResendFormStateImpl) then,
|
||||
) = __$$ResendFormStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
String phoneNumber,
|
||||
String purpose,
|
||||
Option<Either<AuthFailure, Resend>> failureOrResendOption,
|
||||
bool isSubmitting,
|
||||
bool showErrorMessages,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ResendFormStateImplCopyWithImpl<$Res>
|
||||
extends _$ResendFormStateCopyWithImpl<$Res, _$ResendFormStateImpl>
|
||||
implements _$$ResendFormStateImplCopyWith<$Res> {
|
||||
__$$ResendFormStateImplCopyWithImpl(
|
||||
_$ResendFormStateImpl _value,
|
||||
$Res Function(_$ResendFormStateImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of ResendFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? phoneNumber = null,
|
||||
Object? purpose = null,
|
||||
Object? failureOrResendOption = null,
|
||||
Object? isSubmitting = null,
|
||||
Object? showErrorMessages = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$ResendFormStateImpl(
|
||||
phoneNumber: null == phoneNumber
|
||||
? _value.phoneNumber
|
||||
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
purpose: null == purpose
|
||||
? _value.purpose
|
||||
: purpose // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
failureOrResendOption: null == failureOrResendOption
|
||||
? _value.failureOrResendOption
|
||||
: failureOrResendOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<Either<AuthFailure, Resend>>,
|
||||
isSubmitting: null == isSubmitting
|
||||
? _value.isSubmitting
|
||||
: isSubmitting // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
showErrorMessages: null == showErrorMessages
|
||||
? _value.showErrorMessages
|
||||
: showErrorMessages // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$ResendFormStateImpl implements _ResendFormState {
|
||||
const _$ResendFormStateImpl({
|
||||
required this.phoneNumber,
|
||||
required this.purpose,
|
||||
required this.failureOrResendOption,
|
||||
this.isSubmitting = false,
|
||||
this.showErrorMessages = false,
|
||||
});
|
||||
|
||||
@override
|
||||
final String phoneNumber;
|
||||
@override
|
||||
final String purpose;
|
||||
@override
|
||||
final Option<Either<AuthFailure, Resend>> failureOrResendOption;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isSubmitting;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool showErrorMessages;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ResendFormState(phoneNumber: $phoneNumber, purpose: $purpose, failureOrResendOption: $failureOrResendOption, isSubmitting: $isSubmitting, showErrorMessages: $showErrorMessages)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ResendFormStateImpl &&
|
||||
(identical(other.phoneNumber, phoneNumber) ||
|
||||
other.phoneNumber == phoneNumber) &&
|
||||
(identical(other.purpose, purpose) || other.purpose == purpose) &&
|
||||
(identical(other.failureOrResendOption, failureOrResendOption) ||
|
||||
other.failureOrResendOption == failureOrResendOption) &&
|
||||
(identical(other.isSubmitting, isSubmitting) ||
|
||||
other.isSubmitting == isSubmitting) &&
|
||||
(identical(other.showErrorMessages, showErrorMessages) ||
|
||||
other.showErrorMessages == showErrorMessages));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
phoneNumber,
|
||||
purpose,
|
||||
failureOrResendOption,
|
||||
isSubmitting,
|
||||
showErrorMessages,
|
||||
);
|
||||
|
||||
/// Create a copy of ResendFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ResendFormStateImplCopyWith<_$ResendFormStateImpl> get copyWith =>
|
||||
__$$ResendFormStateImplCopyWithImpl<_$ResendFormStateImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
}
|
||||
|
||||
abstract class _ResendFormState implements ResendFormState {
|
||||
const factory _ResendFormState({
|
||||
required final String phoneNumber,
|
||||
required final String purpose,
|
||||
required final Option<Either<AuthFailure, Resend>> failureOrResendOption,
|
||||
final bool isSubmitting,
|
||||
final bool showErrorMessages,
|
||||
}) = _$ResendFormStateImpl;
|
||||
|
||||
@override
|
||||
String get phoneNumber;
|
||||
@override
|
||||
String get purpose;
|
||||
@override
|
||||
Option<Either<AuthFailure, Resend>> get failureOrResendOption;
|
||||
@override
|
||||
bool get isSubmitting;
|
||||
@override
|
||||
bool get showErrorMessages;
|
||||
|
||||
/// Create a copy of ResendFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$ResendFormStateImplCopyWith<_$ResendFormStateImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
10
lib/application/auth/resend_form/resend_form_event.dart
Normal file
@ -0,0 +1,10 @@
|
||||
part of 'resend_form_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class ResendFormEvent with _$ResendFormEvent {
|
||||
const factory ResendFormEvent.phoneNumberChanged(String phoneNumber) =
|
||||
_PhoneNumberChanged;
|
||||
const factory ResendFormEvent.purposeChanged(String purpose) =
|
||||
_PurposeChanged;
|
||||
const factory ResendFormEvent.submitted() = _Submitted;
|
||||
}
|
||||
18
lib/application/auth/resend_form/resend_form_state.dart
Normal file
@ -0,0 +1,18 @@
|
||||
part of 'resend_form_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class ResendFormState with _$ResendFormState {
|
||||
const factory ResendFormState({
|
||||
required String phoneNumber,
|
||||
required String purpose,
|
||||
required Option<Either<AuthFailure, Resend>> failureOrResendOption,
|
||||
@Default(false) bool isSubmitting,
|
||||
@Default(false) bool showErrorMessages,
|
||||
}) = _ResendFormState;
|
||||
|
||||
factory ResendFormState.initial() => ResendFormState(
|
||||
phoneNumber: '',
|
||||
purpose: '',
|
||||
failureOrResendOption: none(),
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../domain/auth/auth.dart';
|
||||
|
||||
part 'set_password_form_event.dart';
|
||||
part 'set_password_form_state.dart';
|
||||
part 'set_password_form_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class SetPasswordFormBloc
|
||||
extends Bloc<SetPasswordFormEvent, SetPasswordFormState> {
|
||||
final IAuthRepository _repository;
|
||||
SetPasswordFormBloc(this._repository)
|
||||
: super(SetPasswordFormState.initial()) {
|
||||
on<SetPasswordFormEvent>(_onSetPasswordFormEvent);
|
||||
}
|
||||
|
||||
Future<void> _onSetPasswordFormEvent(
|
||||
SetPasswordFormEvent event,
|
||||
Emitter<SetPasswordFormState> emit,
|
||||
) {
|
||||
return event.map(
|
||||
registrationTokenChanged: (e) async {
|
||||
emit(
|
||||
state.copyWith(
|
||||
registrationToken: e.registrationToken,
|
||||
failureOrSetPasswordOption: none(),
|
||||
),
|
||||
);
|
||||
},
|
||||
passwordChanged: (e) async {
|
||||
emit(
|
||||
state.copyWith(
|
||||
password: e.password,
|
||||
failureOrSetPasswordOption: none(),
|
||||
),
|
||||
);
|
||||
},
|
||||
confirmPasswordChanged: (e) async {
|
||||
emit(
|
||||
state.copyWith(
|
||||
confirmPassword: e.confirmPassword,
|
||||
failureOrSetPasswordOption: none(),
|
||||
),
|
||||
);
|
||||
},
|
||||
submitted: (e) async {
|
||||
Either<AuthFailure, Login>? failureOrSetPassword;
|
||||
emit(
|
||||
state.copyWith(
|
||||
isSubmitting: true,
|
||||
failureOrSetPasswordOption: none(),
|
||||
),
|
||||
);
|
||||
|
||||
final registrationTokenValid = state.registrationToken.isNotEmpty;
|
||||
final passwordValid = state.password.isNotEmpty;
|
||||
final confirmPasswordValid = state.confirmPassword.isNotEmpty;
|
||||
|
||||
if (registrationTokenValid && passwordValid && confirmPasswordValid) {
|
||||
failureOrSetPassword = await _repository.setPassword(
|
||||
registrationToken: state.registrationToken,
|
||||
password: state.password,
|
||||
confirmPassword: state.confirmPassword,
|
||||
);
|
||||
|
||||
emit(
|
||||
state.copyWith(
|
||||
isSubmitting: false,
|
||||
failureOrSetPasswordOption: optionOf(failureOrSetPassword),
|
||||
),
|
||||
);
|
||||
}
|
||||
emit(state.copyWith(showErrorMessages: true, isSubmitting: false));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,980 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'set_password_form_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
/// @nodoc
|
||||
mixin _$SetPasswordFormEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String registrationToken)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(String password) passwordChanged,
|
||||
required TResult Function(String confirmPassword) confirmPasswordChanged,
|
||||
required TResult Function() submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult? Function(String password)? passwordChanged,
|
||||
TResult? Function(String confirmPassword)? confirmPasswordChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult Function(String password)? passwordChanged,
|
||||
TResult Function(String confirmPassword)? confirmPasswordChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RegistrationTokenChanged value)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(_PasswordChanged value) passwordChanged,
|
||||
required TResult Function(_ConfirmPasswordChanged value)
|
||||
confirmPasswordChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RegistrationTokenChanged value)?
|
||||
registrationTokenChanged,
|
||||
TResult? Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult? Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
|
||||
TResult Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $SetPasswordFormEventCopyWith<$Res> {
|
||||
factory $SetPasswordFormEventCopyWith(
|
||||
SetPasswordFormEvent value,
|
||||
$Res Function(SetPasswordFormEvent) then,
|
||||
) = _$SetPasswordFormEventCopyWithImpl<$Res, SetPasswordFormEvent>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$SetPasswordFormEventCopyWithImpl<
|
||||
$Res,
|
||||
$Val extends SetPasswordFormEvent
|
||||
>
|
||||
implements $SetPasswordFormEventCopyWith<$Res> {
|
||||
_$SetPasswordFormEventCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of SetPasswordFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$RegistrationTokenChangedImplCopyWith<$Res> {
|
||||
factory _$$RegistrationTokenChangedImplCopyWith(
|
||||
_$RegistrationTokenChangedImpl value,
|
||||
$Res Function(_$RegistrationTokenChangedImpl) then,
|
||||
) = __$$RegistrationTokenChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String registrationToken});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$RegistrationTokenChangedImplCopyWithImpl<$Res>
|
||||
extends
|
||||
_$SetPasswordFormEventCopyWithImpl<$Res, _$RegistrationTokenChangedImpl>
|
||||
implements _$$RegistrationTokenChangedImplCopyWith<$Res> {
|
||||
__$$RegistrationTokenChangedImplCopyWithImpl(
|
||||
_$RegistrationTokenChangedImpl _value,
|
||||
$Res Function(_$RegistrationTokenChangedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of SetPasswordFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? registrationToken = null}) {
|
||||
return _then(
|
||||
_$RegistrationTokenChangedImpl(
|
||||
null == registrationToken
|
||||
? _value.registrationToken
|
||||
: registrationToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$RegistrationTokenChangedImpl implements _RegistrationTokenChanged {
|
||||
const _$RegistrationTokenChangedImpl(this.registrationToken);
|
||||
|
||||
@override
|
||||
final String registrationToken;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SetPasswordFormEvent.registrationTokenChanged(registrationToken: $registrationToken)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$RegistrationTokenChangedImpl &&
|
||||
(identical(other.registrationToken, registrationToken) ||
|
||||
other.registrationToken == registrationToken));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, registrationToken);
|
||||
|
||||
/// Create a copy of SetPasswordFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$RegistrationTokenChangedImplCopyWith<_$RegistrationTokenChangedImpl>
|
||||
get copyWith =>
|
||||
__$$RegistrationTokenChangedImplCopyWithImpl<
|
||||
_$RegistrationTokenChangedImpl
|
||||
>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String registrationToken)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(String password) passwordChanged,
|
||||
required TResult Function(String confirmPassword) confirmPasswordChanged,
|
||||
required TResult Function() submitted,
|
||||
}) {
|
||||
return registrationTokenChanged(registrationToken);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult? Function(String password)? passwordChanged,
|
||||
TResult? Function(String confirmPassword)? confirmPasswordChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) {
|
||||
return registrationTokenChanged?.call(registrationToken);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult Function(String password)? passwordChanged,
|
||||
TResult Function(String confirmPassword)? confirmPasswordChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (registrationTokenChanged != null) {
|
||||
return registrationTokenChanged(registrationToken);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RegistrationTokenChanged value)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(_PasswordChanged value) passwordChanged,
|
||||
required TResult Function(_ConfirmPasswordChanged value)
|
||||
confirmPasswordChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) {
|
||||
return registrationTokenChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RegistrationTokenChanged value)?
|
||||
registrationTokenChanged,
|
||||
TResult? Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult? Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) {
|
||||
return registrationTokenChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
|
||||
TResult Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (registrationTokenChanged != null) {
|
||||
return registrationTokenChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _RegistrationTokenChanged implements SetPasswordFormEvent {
|
||||
const factory _RegistrationTokenChanged(final String registrationToken) =
|
||||
_$RegistrationTokenChangedImpl;
|
||||
|
||||
String get registrationToken;
|
||||
|
||||
/// Create a copy of SetPasswordFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$RegistrationTokenChangedImplCopyWith<_$RegistrationTokenChangedImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$PasswordChangedImplCopyWith<$Res> {
|
||||
factory _$$PasswordChangedImplCopyWith(
|
||||
_$PasswordChangedImpl value,
|
||||
$Res Function(_$PasswordChangedImpl) then,
|
||||
) = __$$PasswordChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String password});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$PasswordChangedImplCopyWithImpl<$Res>
|
||||
extends _$SetPasswordFormEventCopyWithImpl<$Res, _$PasswordChangedImpl>
|
||||
implements _$$PasswordChangedImplCopyWith<$Res> {
|
||||
__$$PasswordChangedImplCopyWithImpl(
|
||||
_$PasswordChangedImpl _value,
|
||||
$Res Function(_$PasswordChangedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of SetPasswordFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? password = null}) {
|
||||
return _then(
|
||||
_$PasswordChangedImpl(
|
||||
null == password
|
||||
? _value.password
|
||||
: password // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$PasswordChangedImpl implements _PasswordChanged {
|
||||
const _$PasswordChangedImpl(this.password);
|
||||
|
||||
@override
|
||||
final String password;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SetPasswordFormEvent.passwordChanged(password: $password)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$PasswordChangedImpl &&
|
||||
(identical(other.password, password) ||
|
||||
other.password == password));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, password);
|
||||
|
||||
/// Create a copy of SetPasswordFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$PasswordChangedImplCopyWith<_$PasswordChangedImpl> get copyWith =>
|
||||
__$$PasswordChangedImplCopyWithImpl<_$PasswordChangedImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String registrationToken)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(String password) passwordChanged,
|
||||
required TResult Function(String confirmPassword) confirmPasswordChanged,
|
||||
required TResult Function() submitted,
|
||||
}) {
|
||||
return passwordChanged(password);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult? Function(String password)? passwordChanged,
|
||||
TResult? Function(String confirmPassword)? confirmPasswordChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) {
|
||||
return passwordChanged?.call(password);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult Function(String password)? passwordChanged,
|
||||
TResult Function(String confirmPassword)? confirmPasswordChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (passwordChanged != null) {
|
||||
return passwordChanged(password);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RegistrationTokenChanged value)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(_PasswordChanged value) passwordChanged,
|
||||
required TResult Function(_ConfirmPasswordChanged value)
|
||||
confirmPasswordChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) {
|
||||
return passwordChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RegistrationTokenChanged value)?
|
||||
registrationTokenChanged,
|
||||
TResult? Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult? Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) {
|
||||
return passwordChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
|
||||
TResult Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (passwordChanged != null) {
|
||||
return passwordChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _PasswordChanged implements SetPasswordFormEvent {
|
||||
const factory _PasswordChanged(final String password) = _$PasswordChangedImpl;
|
||||
|
||||
String get password;
|
||||
|
||||
/// Create a copy of SetPasswordFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$PasswordChangedImplCopyWith<_$PasswordChangedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ConfirmPasswordChangedImplCopyWith<$Res> {
|
||||
factory _$$ConfirmPasswordChangedImplCopyWith(
|
||||
_$ConfirmPasswordChangedImpl value,
|
||||
$Res Function(_$ConfirmPasswordChangedImpl) then,
|
||||
) = __$$ConfirmPasswordChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String confirmPassword});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ConfirmPasswordChangedImplCopyWithImpl<$Res>
|
||||
extends
|
||||
_$SetPasswordFormEventCopyWithImpl<$Res, _$ConfirmPasswordChangedImpl>
|
||||
implements _$$ConfirmPasswordChangedImplCopyWith<$Res> {
|
||||
__$$ConfirmPasswordChangedImplCopyWithImpl(
|
||||
_$ConfirmPasswordChangedImpl _value,
|
||||
$Res Function(_$ConfirmPasswordChangedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of SetPasswordFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? confirmPassword = null}) {
|
||||
return _then(
|
||||
_$ConfirmPasswordChangedImpl(
|
||||
null == confirmPassword
|
||||
? _value.confirmPassword
|
||||
: confirmPassword // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$ConfirmPasswordChangedImpl implements _ConfirmPasswordChanged {
|
||||
const _$ConfirmPasswordChangedImpl(this.confirmPassword);
|
||||
|
||||
@override
|
||||
final String confirmPassword;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SetPasswordFormEvent.confirmPasswordChanged(confirmPassword: $confirmPassword)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ConfirmPasswordChangedImpl &&
|
||||
(identical(other.confirmPassword, confirmPassword) ||
|
||||
other.confirmPassword == confirmPassword));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, confirmPassword);
|
||||
|
||||
/// Create a copy of SetPasswordFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ConfirmPasswordChangedImplCopyWith<_$ConfirmPasswordChangedImpl>
|
||||
get copyWith =>
|
||||
__$$ConfirmPasswordChangedImplCopyWithImpl<_$ConfirmPasswordChangedImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String registrationToken)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(String password) passwordChanged,
|
||||
required TResult Function(String confirmPassword) confirmPasswordChanged,
|
||||
required TResult Function() submitted,
|
||||
}) {
|
||||
return confirmPasswordChanged(confirmPassword);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult? Function(String password)? passwordChanged,
|
||||
TResult? Function(String confirmPassword)? confirmPasswordChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) {
|
||||
return confirmPasswordChanged?.call(confirmPassword);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult Function(String password)? passwordChanged,
|
||||
TResult Function(String confirmPassword)? confirmPasswordChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (confirmPasswordChanged != null) {
|
||||
return confirmPasswordChanged(confirmPassword);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RegistrationTokenChanged value)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(_PasswordChanged value) passwordChanged,
|
||||
required TResult Function(_ConfirmPasswordChanged value)
|
||||
confirmPasswordChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) {
|
||||
return confirmPasswordChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RegistrationTokenChanged value)?
|
||||
registrationTokenChanged,
|
||||
TResult? Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult? Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) {
|
||||
return confirmPasswordChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
|
||||
TResult Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (confirmPasswordChanged != null) {
|
||||
return confirmPasswordChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _ConfirmPasswordChanged implements SetPasswordFormEvent {
|
||||
const factory _ConfirmPasswordChanged(final String confirmPassword) =
|
||||
_$ConfirmPasswordChangedImpl;
|
||||
|
||||
String get confirmPassword;
|
||||
|
||||
/// Create a copy of SetPasswordFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$ConfirmPasswordChangedImplCopyWith<_$ConfirmPasswordChangedImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SubmittedImplCopyWith<$Res> {
|
||||
factory _$$SubmittedImplCopyWith(
|
||||
_$SubmittedImpl value,
|
||||
$Res Function(_$SubmittedImpl) then,
|
||||
) = __$$SubmittedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SubmittedImplCopyWithImpl<$Res>
|
||||
extends _$SetPasswordFormEventCopyWithImpl<$Res, _$SubmittedImpl>
|
||||
implements _$$SubmittedImplCopyWith<$Res> {
|
||||
__$$SubmittedImplCopyWithImpl(
|
||||
_$SubmittedImpl _value,
|
||||
$Res Function(_$SubmittedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of SetPasswordFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SubmittedImpl implements _Submitted {
|
||||
const _$SubmittedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SetPasswordFormEvent.submitted()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$SubmittedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String registrationToken)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(String password) passwordChanged,
|
||||
required TResult Function(String confirmPassword) confirmPasswordChanged,
|
||||
required TResult Function() submitted,
|
||||
}) {
|
||||
return submitted();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult? Function(String password)? passwordChanged,
|
||||
TResult? Function(String confirmPassword)? confirmPasswordChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) {
|
||||
return submitted?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult Function(String password)? passwordChanged,
|
||||
TResult Function(String confirmPassword)? confirmPasswordChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (submitted != null) {
|
||||
return submitted();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RegistrationTokenChanged value)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(_PasswordChanged value) passwordChanged,
|
||||
required TResult Function(_ConfirmPasswordChanged value)
|
||||
confirmPasswordChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) {
|
||||
return submitted(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RegistrationTokenChanged value)?
|
||||
registrationTokenChanged,
|
||||
TResult? Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult? Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) {
|
||||
return submitted?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
|
||||
TResult Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (submitted != null) {
|
||||
return submitted(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Submitted implements SetPasswordFormEvent {
|
||||
const factory _Submitted() = _$SubmittedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$SetPasswordFormState {
|
||||
String get registrationToken => throw _privateConstructorUsedError;
|
||||
String get password => throw _privateConstructorUsedError;
|
||||
String get confirmPassword => throw _privateConstructorUsedError;
|
||||
Option<Either<AuthFailure, Login>> get failureOrSetPasswordOption =>
|
||||
throw _privateConstructorUsedError;
|
||||
bool get isSubmitting => throw _privateConstructorUsedError;
|
||||
bool get showErrorMessages => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of SetPasswordFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$SetPasswordFormStateCopyWith<SetPasswordFormState> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $SetPasswordFormStateCopyWith<$Res> {
|
||||
factory $SetPasswordFormStateCopyWith(
|
||||
SetPasswordFormState value,
|
||||
$Res Function(SetPasswordFormState) then,
|
||||
) = _$SetPasswordFormStateCopyWithImpl<$Res, SetPasswordFormState>;
|
||||
@useResult
|
||||
$Res call({
|
||||
String registrationToken,
|
||||
String password,
|
||||
String confirmPassword,
|
||||
Option<Either<AuthFailure, Login>> failureOrSetPasswordOption,
|
||||
bool isSubmitting,
|
||||
bool showErrorMessages,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$SetPasswordFormStateCopyWithImpl<
|
||||
$Res,
|
||||
$Val extends SetPasswordFormState
|
||||
>
|
||||
implements $SetPasswordFormStateCopyWith<$Res> {
|
||||
_$SetPasswordFormStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of SetPasswordFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? registrationToken = null,
|
||||
Object? password = null,
|
||||
Object? confirmPassword = null,
|
||||
Object? failureOrSetPasswordOption = null,
|
||||
Object? isSubmitting = null,
|
||||
Object? showErrorMessages = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
registrationToken: null == registrationToken
|
||||
? _value.registrationToken
|
||||
: registrationToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
password: null == password
|
||||
? _value.password
|
||||
: password // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
confirmPassword: null == confirmPassword
|
||||
? _value.confirmPassword
|
||||
: confirmPassword // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
failureOrSetPasswordOption: null == failureOrSetPasswordOption
|
||||
? _value.failureOrSetPasswordOption
|
||||
: failureOrSetPasswordOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<Either<AuthFailure, Login>>,
|
||||
isSubmitting: null == isSubmitting
|
||||
? _value.isSubmitting
|
||||
: isSubmitting // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
showErrorMessages: null == showErrorMessages
|
||||
? _value.showErrorMessages
|
||||
: showErrorMessages // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SetPasswordFormStateImplCopyWith<$Res>
|
||||
implements $SetPasswordFormStateCopyWith<$Res> {
|
||||
factory _$$SetPasswordFormStateImplCopyWith(
|
||||
_$SetPasswordFormStateImpl value,
|
||||
$Res Function(_$SetPasswordFormStateImpl) then,
|
||||
) = __$$SetPasswordFormStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
String registrationToken,
|
||||
String password,
|
||||
String confirmPassword,
|
||||
Option<Either<AuthFailure, Login>> failureOrSetPasswordOption,
|
||||
bool isSubmitting,
|
||||
bool showErrorMessages,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SetPasswordFormStateImplCopyWithImpl<$Res>
|
||||
extends _$SetPasswordFormStateCopyWithImpl<$Res, _$SetPasswordFormStateImpl>
|
||||
implements _$$SetPasswordFormStateImplCopyWith<$Res> {
|
||||
__$$SetPasswordFormStateImplCopyWithImpl(
|
||||
_$SetPasswordFormStateImpl _value,
|
||||
$Res Function(_$SetPasswordFormStateImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of SetPasswordFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? registrationToken = null,
|
||||
Object? password = null,
|
||||
Object? confirmPassword = null,
|
||||
Object? failureOrSetPasswordOption = null,
|
||||
Object? isSubmitting = null,
|
||||
Object? showErrorMessages = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$SetPasswordFormStateImpl(
|
||||
registrationToken: null == registrationToken
|
||||
? _value.registrationToken
|
||||
: registrationToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
password: null == password
|
||||
? _value.password
|
||||
: password // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
confirmPassword: null == confirmPassword
|
||||
? _value.confirmPassword
|
||||
: confirmPassword // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
failureOrSetPasswordOption: null == failureOrSetPasswordOption
|
||||
? _value.failureOrSetPasswordOption
|
||||
: failureOrSetPasswordOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<Either<AuthFailure, Login>>,
|
||||
isSubmitting: null == isSubmitting
|
||||
? _value.isSubmitting
|
||||
: isSubmitting // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
showErrorMessages: null == showErrorMessages
|
||||
? _value.showErrorMessages
|
||||
: showErrorMessages // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SetPasswordFormStateImpl implements _SetPasswordFormState {
|
||||
const _$SetPasswordFormStateImpl({
|
||||
required this.registrationToken,
|
||||
required this.password,
|
||||
required this.confirmPassword,
|
||||
required this.failureOrSetPasswordOption,
|
||||
this.isSubmitting = false,
|
||||
this.showErrorMessages = false,
|
||||
});
|
||||
|
||||
@override
|
||||
final String registrationToken;
|
||||
@override
|
||||
final String password;
|
||||
@override
|
||||
final String confirmPassword;
|
||||
@override
|
||||
final Option<Either<AuthFailure, Login>> failureOrSetPasswordOption;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isSubmitting;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool showErrorMessages;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SetPasswordFormState(registrationToken: $registrationToken, password: $password, confirmPassword: $confirmPassword, failureOrSetPasswordOption: $failureOrSetPasswordOption, isSubmitting: $isSubmitting, showErrorMessages: $showErrorMessages)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$SetPasswordFormStateImpl &&
|
||||
(identical(other.registrationToken, registrationToken) ||
|
||||
other.registrationToken == registrationToken) &&
|
||||
(identical(other.password, password) ||
|
||||
other.password == password) &&
|
||||
(identical(other.confirmPassword, confirmPassword) ||
|
||||
other.confirmPassword == confirmPassword) &&
|
||||
(identical(
|
||||
other.failureOrSetPasswordOption,
|
||||
failureOrSetPasswordOption,
|
||||
) ||
|
||||
other.failureOrSetPasswordOption ==
|
||||
failureOrSetPasswordOption) &&
|
||||
(identical(other.isSubmitting, isSubmitting) ||
|
||||
other.isSubmitting == isSubmitting) &&
|
||||
(identical(other.showErrorMessages, showErrorMessages) ||
|
||||
other.showErrorMessages == showErrorMessages));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
registrationToken,
|
||||
password,
|
||||
confirmPassword,
|
||||
failureOrSetPasswordOption,
|
||||
isSubmitting,
|
||||
showErrorMessages,
|
||||
);
|
||||
|
||||
/// Create a copy of SetPasswordFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$SetPasswordFormStateImplCopyWith<_$SetPasswordFormStateImpl>
|
||||
get copyWith =>
|
||||
__$$SetPasswordFormStateImplCopyWithImpl<_$SetPasswordFormStateImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
}
|
||||
|
||||
abstract class _SetPasswordFormState implements SetPasswordFormState {
|
||||
const factory _SetPasswordFormState({
|
||||
required final String registrationToken,
|
||||
required final String password,
|
||||
required final String confirmPassword,
|
||||
required final Option<Either<AuthFailure, Login>>
|
||||
failureOrSetPasswordOption,
|
||||
final bool isSubmitting,
|
||||
final bool showErrorMessages,
|
||||
}) = _$SetPasswordFormStateImpl;
|
||||
|
||||
@override
|
||||
String get registrationToken;
|
||||
@override
|
||||
String get password;
|
||||
@override
|
||||
String get confirmPassword;
|
||||
@override
|
||||
Option<Either<AuthFailure, Login>> get failureOrSetPasswordOption;
|
||||
@override
|
||||
bool get isSubmitting;
|
||||
@override
|
||||
bool get showErrorMessages;
|
||||
|
||||
/// Create a copy of SetPasswordFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$SetPasswordFormStateImplCopyWith<_$SetPasswordFormStateImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
part of 'set_password_form_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class SetPasswordFormEvent with _$SetPasswordFormEvent {
|
||||
const factory SetPasswordFormEvent.registrationTokenChanged(
|
||||
String registrationToken,
|
||||
) = _RegistrationTokenChanged;
|
||||
const factory SetPasswordFormEvent.passwordChanged(String password) =
|
||||
_PasswordChanged;
|
||||
const factory SetPasswordFormEvent.confirmPasswordChanged(
|
||||
String confirmPassword,
|
||||
) = _ConfirmPasswordChanged;
|
||||
const factory SetPasswordFormEvent.submitted() = _Submitted;
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
part of 'set_password_form_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class SetPasswordFormState with _$SetPasswordFormState {
|
||||
const factory SetPasswordFormState({
|
||||
required String registrationToken,
|
||||
required String password,
|
||||
required String confirmPassword,
|
||||
required Option<Either<AuthFailure, Login>> failureOrSetPasswordOption,
|
||||
@Default(false) bool isSubmitting,
|
||||
@Default(false) bool showErrorMessages,
|
||||
}) = _SetPasswordFormState;
|
||||
|
||||
factory SetPasswordFormState.initial() => SetPasswordFormState(
|
||||
registrationToken: '',
|
||||
password: '',
|
||||
confirmPassword: '',
|
||||
failureOrSetPasswordOption: none(),
|
||||
);
|
||||
}
|
||||
58
lib/application/auth/verify_form/verify_form_bloc.dart
Normal file
@ -0,0 +1,58 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../domain/auth/auth.dart';
|
||||
|
||||
part 'verify_form_event.dart';
|
||||
part 'verify_form_state.dart';
|
||||
part 'verify_form_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class VerifyFormBloc extends Bloc<VerifyFormEvent, VerifyFormState> {
|
||||
final IAuthRepository _repository;
|
||||
VerifyFormBloc(this._repository) : super(VerifyFormState.initial()) {
|
||||
on<VerifyFormEvent>(_onVerifyFormEvent);
|
||||
}
|
||||
|
||||
Future<void> _onVerifyFormEvent(
|
||||
VerifyFormEvent event,
|
||||
Emitter<VerifyFormState> emit,
|
||||
) {
|
||||
return event.map(
|
||||
registrationTokenChanged: (e) async {
|
||||
emit(
|
||||
state.copyWith(
|
||||
registrationToken: e.registrationToken,
|
||||
failureOrVerifyOption: none(),
|
||||
),
|
||||
);
|
||||
},
|
||||
otpCodeChanged: (e) async {
|
||||
emit(state.copyWith(otpCode: e.otpCode, failureOrVerifyOption: none()));
|
||||
},
|
||||
submitted: (e) async {
|
||||
Either<AuthFailure, Verify>? failureOrVerify;
|
||||
emit(state.copyWith(isSubmitting: true, failureOrVerifyOption: none()));
|
||||
|
||||
final otpCodeValid = state.otpCode.isNotEmpty;
|
||||
final registrationTokenValid = state.registrationToken.isNotEmpty;
|
||||
|
||||
if (registrationTokenValid && otpCodeValid) {
|
||||
failureOrVerify = await _repository.verify(
|
||||
registrationToken: state.registrationToken,
|
||||
otpCode: state.otpCode,
|
||||
);
|
||||
emit(
|
||||
state.copyWith(
|
||||
isSubmitting: false,
|
||||
failureOrVerifyOption: optionOf(failureOrVerify),
|
||||
),
|
||||
);
|
||||
}
|
||||
emit(state.copyWith(showErrorMessages: true, isSubmitting: false));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
750
lib/application/auth/verify_form/verify_form_bloc.freezed.dart
Normal file
@ -0,0 +1,750 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'verify_form_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
/// @nodoc
|
||||
mixin _$VerifyFormEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String registrationToken)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(String otpCode) otpCodeChanged,
|
||||
required TResult Function() submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult? Function(String otpCode)? otpCodeChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult Function(String otpCode)? otpCodeChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RegistrationTokenChanged value)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(_OtpCodeChanged value) otpCodeChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RegistrationTokenChanged value)?
|
||||
registrationTokenChanged,
|
||||
TResult? Function(_OtpCodeChanged value)? otpCodeChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
|
||||
TResult Function(_OtpCodeChanged value)? otpCodeChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $VerifyFormEventCopyWith<$Res> {
|
||||
factory $VerifyFormEventCopyWith(
|
||||
VerifyFormEvent value,
|
||||
$Res Function(VerifyFormEvent) then,
|
||||
) = _$VerifyFormEventCopyWithImpl<$Res, VerifyFormEvent>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$VerifyFormEventCopyWithImpl<$Res, $Val extends VerifyFormEvent>
|
||||
implements $VerifyFormEventCopyWith<$Res> {
|
||||
_$VerifyFormEventCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of VerifyFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$RegistrationTokenChangedImplCopyWith<$Res> {
|
||||
factory _$$RegistrationTokenChangedImplCopyWith(
|
||||
_$RegistrationTokenChangedImpl value,
|
||||
$Res Function(_$RegistrationTokenChangedImpl) then,
|
||||
) = __$$RegistrationTokenChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String registrationToken});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$RegistrationTokenChangedImplCopyWithImpl<$Res>
|
||||
extends _$VerifyFormEventCopyWithImpl<$Res, _$RegistrationTokenChangedImpl>
|
||||
implements _$$RegistrationTokenChangedImplCopyWith<$Res> {
|
||||
__$$RegistrationTokenChangedImplCopyWithImpl(
|
||||
_$RegistrationTokenChangedImpl _value,
|
||||
$Res Function(_$RegistrationTokenChangedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of VerifyFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? registrationToken = null}) {
|
||||
return _then(
|
||||
_$RegistrationTokenChangedImpl(
|
||||
null == registrationToken
|
||||
? _value.registrationToken
|
||||
: registrationToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$RegistrationTokenChangedImpl implements _RegistrationTokenChanged {
|
||||
const _$RegistrationTokenChangedImpl(this.registrationToken);
|
||||
|
||||
@override
|
||||
final String registrationToken;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'VerifyFormEvent.registrationTokenChanged(registrationToken: $registrationToken)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$RegistrationTokenChangedImpl &&
|
||||
(identical(other.registrationToken, registrationToken) ||
|
||||
other.registrationToken == registrationToken));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, registrationToken);
|
||||
|
||||
/// Create a copy of VerifyFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$RegistrationTokenChangedImplCopyWith<_$RegistrationTokenChangedImpl>
|
||||
get copyWith =>
|
||||
__$$RegistrationTokenChangedImplCopyWithImpl<
|
||||
_$RegistrationTokenChangedImpl
|
||||
>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String registrationToken)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(String otpCode) otpCodeChanged,
|
||||
required TResult Function() submitted,
|
||||
}) {
|
||||
return registrationTokenChanged(registrationToken);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult? Function(String otpCode)? otpCodeChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) {
|
||||
return registrationTokenChanged?.call(registrationToken);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult Function(String otpCode)? otpCodeChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (registrationTokenChanged != null) {
|
||||
return registrationTokenChanged(registrationToken);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RegistrationTokenChanged value)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(_OtpCodeChanged value) otpCodeChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) {
|
||||
return registrationTokenChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RegistrationTokenChanged value)?
|
||||
registrationTokenChanged,
|
||||
TResult? Function(_OtpCodeChanged value)? otpCodeChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) {
|
||||
return registrationTokenChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
|
||||
TResult Function(_OtpCodeChanged value)? otpCodeChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (registrationTokenChanged != null) {
|
||||
return registrationTokenChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _RegistrationTokenChanged implements VerifyFormEvent {
|
||||
const factory _RegistrationTokenChanged(final String registrationToken) =
|
||||
_$RegistrationTokenChangedImpl;
|
||||
|
||||
String get registrationToken;
|
||||
|
||||
/// Create a copy of VerifyFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$RegistrationTokenChangedImplCopyWith<_$RegistrationTokenChangedImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$OtpCodeChangedImplCopyWith<$Res> {
|
||||
factory _$$OtpCodeChangedImplCopyWith(
|
||||
_$OtpCodeChangedImpl value,
|
||||
$Res Function(_$OtpCodeChangedImpl) then,
|
||||
) = __$$OtpCodeChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String otpCode});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$OtpCodeChangedImplCopyWithImpl<$Res>
|
||||
extends _$VerifyFormEventCopyWithImpl<$Res, _$OtpCodeChangedImpl>
|
||||
implements _$$OtpCodeChangedImplCopyWith<$Res> {
|
||||
__$$OtpCodeChangedImplCopyWithImpl(
|
||||
_$OtpCodeChangedImpl _value,
|
||||
$Res Function(_$OtpCodeChangedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of VerifyFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? otpCode = null}) {
|
||||
return _then(
|
||||
_$OtpCodeChangedImpl(
|
||||
null == otpCode
|
||||
? _value.otpCode
|
||||
: otpCode // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$OtpCodeChangedImpl implements _OtpCodeChanged {
|
||||
const _$OtpCodeChangedImpl(this.otpCode);
|
||||
|
||||
@override
|
||||
final String otpCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'VerifyFormEvent.otpCodeChanged(otpCode: $otpCode)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$OtpCodeChangedImpl &&
|
||||
(identical(other.otpCode, otpCode) || other.otpCode == otpCode));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, otpCode);
|
||||
|
||||
/// Create a copy of VerifyFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$OtpCodeChangedImplCopyWith<_$OtpCodeChangedImpl> get copyWith =>
|
||||
__$$OtpCodeChangedImplCopyWithImpl<_$OtpCodeChangedImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String registrationToken)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(String otpCode) otpCodeChanged,
|
||||
required TResult Function() submitted,
|
||||
}) {
|
||||
return otpCodeChanged(otpCode);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult? Function(String otpCode)? otpCodeChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) {
|
||||
return otpCodeChanged?.call(otpCode);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult Function(String otpCode)? otpCodeChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (otpCodeChanged != null) {
|
||||
return otpCodeChanged(otpCode);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RegistrationTokenChanged value)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(_OtpCodeChanged value) otpCodeChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) {
|
||||
return otpCodeChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RegistrationTokenChanged value)?
|
||||
registrationTokenChanged,
|
||||
TResult? Function(_OtpCodeChanged value)? otpCodeChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) {
|
||||
return otpCodeChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
|
||||
TResult Function(_OtpCodeChanged value)? otpCodeChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (otpCodeChanged != null) {
|
||||
return otpCodeChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _OtpCodeChanged implements VerifyFormEvent {
|
||||
const factory _OtpCodeChanged(final String otpCode) = _$OtpCodeChangedImpl;
|
||||
|
||||
String get otpCode;
|
||||
|
||||
/// Create a copy of VerifyFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$OtpCodeChangedImplCopyWith<_$OtpCodeChangedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SubmittedImplCopyWith<$Res> {
|
||||
factory _$$SubmittedImplCopyWith(
|
||||
_$SubmittedImpl value,
|
||||
$Res Function(_$SubmittedImpl) then,
|
||||
) = __$$SubmittedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SubmittedImplCopyWithImpl<$Res>
|
||||
extends _$VerifyFormEventCopyWithImpl<$Res, _$SubmittedImpl>
|
||||
implements _$$SubmittedImplCopyWith<$Res> {
|
||||
__$$SubmittedImplCopyWithImpl(
|
||||
_$SubmittedImpl _value,
|
||||
$Res Function(_$SubmittedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of VerifyFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SubmittedImpl implements _Submitted {
|
||||
const _$SubmittedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'VerifyFormEvent.submitted()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$SubmittedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String registrationToken)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(String otpCode) otpCodeChanged,
|
||||
required TResult Function() submitted,
|
||||
}) {
|
||||
return submitted();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult? Function(String otpCode)? otpCodeChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) {
|
||||
return submitted?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult Function(String otpCode)? otpCodeChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (submitted != null) {
|
||||
return submitted();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RegistrationTokenChanged value)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(_OtpCodeChanged value) otpCodeChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) {
|
||||
return submitted(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RegistrationTokenChanged value)?
|
||||
registrationTokenChanged,
|
||||
TResult? Function(_OtpCodeChanged value)? otpCodeChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) {
|
||||
return submitted?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
|
||||
TResult Function(_OtpCodeChanged value)? otpCodeChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (submitted != null) {
|
||||
return submitted(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Submitted implements VerifyFormEvent {
|
||||
const factory _Submitted() = _$SubmittedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$VerifyFormState {
|
||||
String get registrationToken => throw _privateConstructorUsedError;
|
||||
String get otpCode => throw _privateConstructorUsedError;
|
||||
Option<Either<AuthFailure, Verify>> get failureOrVerifyOption =>
|
||||
throw _privateConstructorUsedError;
|
||||
bool get isSubmitting => throw _privateConstructorUsedError;
|
||||
bool get showErrorMessages => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of VerifyFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$VerifyFormStateCopyWith<VerifyFormState> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $VerifyFormStateCopyWith<$Res> {
|
||||
factory $VerifyFormStateCopyWith(
|
||||
VerifyFormState value,
|
||||
$Res Function(VerifyFormState) then,
|
||||
) = _$VerifyFormStateCopyWithImpl<$Res, VerifyFormState>;
|
||||
@useResult
|
||||
$Res call({
|
||||
String registrationToken,
|
||||
String otpCode,
|
||||
Option<Either<AuthFailure, Verify>> failureOrVerifyOption,
|
||||
bool isSubmitting,
|
||||
bool showErrorMessages,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$VerifyFormStateCopyWithImpl<$Res, $Val extends VerifyFormState>
|
||||
implements $VerifyFormStateCopyWith<$Res> {
|
||||
_$VerifyFormStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of VerifyFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? registrationToken = null,
|
||||
Object? otpCode = null,
|
||||
Object? failureOrVerifyOption = null,
|
||||
Object? isSubmitting = null,
|
||||
Object? showErrorMessages = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
registrationToken: null == registrationToken
|
||||
? _value.registrationToken
|
||||
: registrationToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
otpCode: null == otpCode
|
||||
? _value.otpCode
|
||||
: otpCode // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
failureOrVerifyOption: null == failureOrVerifyOption
|
||||
? _value.failureOrVerifyOption
|
||||
: failureOrVerifyOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<Either<AuthFailure, Verify>>,
|
||||
isSubmitting: null == isSubmitting
|
||||
? _value.isSubmitting
|
||||
: isSubmitting // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
showErrorMessages: null == showErrorMessages
|
||||
? _value.showErrorMessages
|
||||
: showErrorMessages // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$VerifyFormStateImplCopyWith<$Res>
|
||||
implements $VerifyFormStateCopyWith<$Res> {
|
||||
factory _$$VerifyFormStateImplCopyWith(
|
||||
_$VerifyFormStateImpl value,
|
||||
$Res Function(_$VerifyFormStateImpl) then,
|
||||
) = __$$VerifyFormStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
String registrationToken,
|
||||
String otpCode,
|
||||
Option<Either<AuthFailure, Verify>> failureOrVerifyOption,
|
||||
bool isSubmitting,
|
||||
bool showErrorMessages,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$VerifyFormStateImplCopyWithImpl<$Res>
|
||||
extends _$VerifyFormStateCopyWithImpl<$Res, _$VerifyFormStateImpl>
|
||||
implements _$$VerifyFormStateImplCopyWith<$Res> {
|
||||
__$$VerifyFormStateImplCopyWithImpl(
|
||||
_$VerifyFormStateImpl _value,
|
||||
$Res Function(_$VerifyFormStateImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of VerifyFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? registrationToken = null,
|
||||
Object? otpCode = null,
|
||||
Object? failureOrVerifyOption = null,
|
||||
Object? isSubmitting = null,
|
||||
Object? showErrorMessages = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$VerifyFormStateImpl(
|
||||
registrationToken: null == registrationToken
|
||||
? _value.registrationToken
|
||||
: registrationToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
otpCode: null == otpCode
|
||||
? _value.otpCode
|
||||
: otpCode // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
failureOrVerifyOption: null == failureOrVerifyOption
|
||||
? _value.failureOrVerifyOption
|
||||
: failureOrVerifyOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<Either<AuthFailure, Verify>>,
|
||||
isSubmitting: null == isSubmitting
|
||||
? _value.isSubmitting
|
||||
: isSubmitting // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
showErrorMessages: null == showErrorMessages
|
||||
? _value.showErrorMessages
|
||||
: showErrorMessages // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$VerifyFormStateImpl implements _VerifyFormState {
|
||||
const _$VerifyFormStateImpl({
|
||||
required this.registrationToken,
|
||||
required this.otpCode,
|
||||
required this.failureOrVerifyOption,
|
||||
this.isSubmitting = false,
|
||||
this.showErrorMessages = false,
|
||||
});
|
||||
|
||||
@override
|
||||
final String registrationToken;
|
||||
@override
|
||||
final String otpCode;
|
||||
@override
|
||||
final Option<Either<AuthFailure, Verify>> failureOrVerifyOption;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isSubmitting;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool showErrorMessages;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'VerifyFormState(registrationToken: $registrationToken, otpCode: $otpCode, failureOrVerifyOption: $failureOrVerifyOption, isSubmitting: $isSubmitting, showErrorMessages: $showErrorMessages)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$VerifyFormStateImpl &&
|
||||
(identical(other.registrationToken, registrationToken) ||
|
||||
other.registrationToken == registrationToken) &&
|
||||
(identical(other.otpCode, otpCode) || other.otpCode == otpCode) &&
|
||||
(identical(other.failureOrVerifyOption, failureOrVerifyOption) ||
|
||||
other.failureOrVerifyOption == failureOrVerifyOption) &&
|
||||
(identical(other.isSubmitting, isSubmitting) ||
|
||||
other.isSubmitting == isSubmitting) &&
|
||||
(identical(other.showErrorMessages, showErrorMessages) ||
|
||||
other.showErrorMessages == showErrorMessages));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
registrationToken,
|
||||
otpCode,
|
||||
failureOrVerifyOption,
|
||||
isSubmitting,
|
||||
showErrorMessages,
|
||||
);
|
||||
|
||||
/// Create a copy of VerifyFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$VerifyFormStateImplCopyWith<_$VerifyFormStateImpl> get copyWith =>
|
||||
__$$VerifyFormStateImplCopyWithImpl<_$VerifyFormStateImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
}
|
||||
|
||||
abstract class _VerifyFormState implements VerifyFormState {
|
||||
const factory _VerifyFormState({
|
||||
required final String registrationToken,
|
||||
required final String otpCode,
|
||||
required final Option<Either<AuthFailure, Verify>> failureOrVerifyOption,
|
||||
final bool isSubmitting,
|
||||
final bool showErrorMessages,
|
||||
}) = _$VerifyFormStateImpl;
|
||||
|
||||
@override
|
||||
String get registrationToken;
|
||||
@override
|
||||
String get otpCode;
|
||||
@override
|
||||
Option<Either<AuthFailure, Verify>> get failureOrVerifyOption;
|
||||
@override
|
||||
bool get isSubmitting;
|
||||
@override
|
||||
bool get showErrorMessages;
|
||||
|
||||
/// Create a copy of VerifyFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$VerifyFormStateImplCopyWith<_$VerifyFormStateImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
11
lib/application/auth/verify_form/verify_form_event.dart
Normal file
@ -0,0 +1,11 @@
|
||||
part of 'verify_form_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class VerifyFormEvent with _$VerifyFormEvent {
|
||||
const factory VerifyFormEvent.registrationTokenChanged(
|
||||
String registrationToken,
|
||||
) = _RegistrationTokenChanged;
|
||||
const factory VerifyFormEvent.otpCodeChanged(String otpCode) =
|
||||
_OtpCodeChanged;
|
||||
const factory VerifyFormEvent.submitted() = _Submitted;
|
||||
}
|
||||
18
lib/application/auth/verify_form/verify_form_state.dart
Normal file
@ -0,0 +1,18 @@
|
||||
part of 'verify_form_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class VerifyFormState with _$VerifyFormState {
|
||||
const factory VerifyFormState({
|
||||
required String registrationToken,
|
||||
required String otpCode,
|
||||
required Option<Either<AuthFailure, Verify>> failureOrVerifyOption,
|
||||
@Default(false) bool isSubmitting,
|
||||
@Default(false) bool showErrorMessages,
|
||||
}) = _VerifyFormState;
|
||||
|
||||
factory VerifyFormState.initial() => VerifyFormState(
|
||||
registrationToken: '',
|
||||
otpCode: '',
|
||||
failureOrVerifyOption: none(),
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../domain/customer/customer.dart';
|
||||
|
||||
part 'customer_point_loader_event.dart';
|
||||
part 'customer_point_loader_state.dart';
|
||||
part 'customer_point_loader_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class CustomerPointLoaderBloc
|
||||
extends Bloc<CustomerPointLoaderEvent, CustomerPointLoaderState> {
|
||||
final ICustomerRepository _repository;
|
||||
CustomerPointLoaderBloc(this._repository)
|
||||
: super(CustomerPointLoaderState.initial()) {
|
||||
on<CustomerPointLoaderEvent>(_onCustomerPointLoaderEvent);
|
||||
}
|
||||
|
||||
Future<void> _onCustomerPointLoaderEvent(
|
||||
CustomerPointLoaderEvent event,
|
||||
Emitter<CustomerPointLoaderState> emit,
|
||||
) {
|
||||
return event.map(
|
||||
fetched: (e) async {
|
||||
emit(
|
||||
state.copyWith(isFetching: true, failureOptionCustomerPoint: none()),
|
||||
);
|
||||
|
||||
final result = await _repository.getPoints();
|
||||
|
||||
var data = result.fold(
|
||||
(f) => state.copyWith(failureOptionCustomerPoint: optionOf(f)),
|
||||
(customerPoint) => state.copyWith(customerPoint: customerPoint),
|
||||
);
|
||||
|
||||
emit(data.copyWith(isFetching: false));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,391 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'customer_point_loader_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
/// @nodoc
|
||||
mixin _$CustomerPointLoaderEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? fetched,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Fetched value) fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Fetched value)? fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Fetched value)? fetched,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $CustomerPointLoaderEventCopyWith<$Res> {
|
||||
factory $CustomerPointLoaderEventCopyWith(
|
||||
CustomerPointLoaderEvent value,
|
||||
$Res Function(CustomerPointLoaderEvent) then,
|
||||
) = _$CustomerPointLoaderEventCopyWithImpl<$Res, CustomerPointLoaderEvent>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$CustomerPointLoaderEventCopyWithImpl<
|
||||
$Res,
|
||||
$Val extends CustomerPointLoaderEvent
|
||||
>
|
||||
implements $CustomerPointLoaderEventCopyWith<$Res> {
|
||||
_$CustomerPointLoaderEventCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of CustomerPointLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$FetchedImplCopyWith<$Res> {
|
||||
factory _$$FetchedImplCopyWith(
|
||||
_$FetchedImpl value,
|
||||
$Res Function(_$FetchedImpl) then,
|
||||
) = __$$FetchedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$FetchedImplCopyWithImpl<$Res>
|
||||
extends _$CustomerPointLoaderEventCopyWithImpl<$Res, _$FetchedImpl>
|
||||
implements _$$FetchedImplCopyWith<$Res> {
|
||||
__$$FetchedImplCopyWithImpl(
|
||||
_$FetchedImpl _value,
|
||||
$Res Function(_$FetchedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of CustomerPointLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$FetchedImpl implements _Fetched {
|
||||
const _$FetchedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CustomerPointLoaderEvent.fetched()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$FetchedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({required TResult Function() fetched}) {
|
||||
return fetched();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({TResult? Function()? fetched}) {
|
||||
return fetched?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (fetched != null) {
|
||||
return fetched();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Fetched value) fetched,
|
||||
}) {
|
||||
return fetched(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Fetched value)? fetched,
|
||||
}) {
|
||||
return fetched?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Fetched value)? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (fetched != null) {
|
||||
return fetched(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Fetched implements CustomerPointLoaderEvent {
|
||||
const factory _Fetched() = _$FetchedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$CustomerPointLoaderState {
|
||||
CustomerPoint get customerPoint => throw _privateConstructorUsedError;
|
||||
Option<CustomerFailure> get failureOptionCustomerPoint =>
|
||||
throw _privateConstructorUsedError;
|
||||
bool get isFetching => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of CustomerPointLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$CustomerPointLoaderStateCopyWith<CustomerPointLoaderState> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $CustomerPointLoaderStateCopyWith<$Res> {
|
||||
factory $CustomerPointLoaderStateCopyWith(
|
||||
CustomerPointLoaderState value,
|
||||
$Res Function(CustomerPointLoaderState) then,
|
||||
) = _$CustomerPointLoaderStateCopyWithImpl<$Res, CustomerPointLoaderState>;
|
||||
@useResult
|
||||
$Res call({
|
||||
CustomerPoint customerPoint,
|
||||
Option<CustomerFailure> failureOptionCustomerPoint,
|
||||
bool isFetching,
|
||||
});
|
||||
|
||||
$CustomerPointCopyWith<$Res> get customerPoint;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$CustomerPointLoaderStateCopyWithImpl<
|
||||
$Res,
|
||||
$Val extends CustomerPointLoaderState
|
||||
>
|
||||
implements $CustomerPointLoaderStateCopyWith<$Res> {
|
||||
_$CustomerPointLoaderStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of CustomerPointLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? customerPoint = null,
|
||||
Object? failureOptionCustomerPoint = null,
|
||||
Object? isFetching = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
customerPoint: null == customerPoint
|
||||
? _value.customerPoint
|
||||
: customerPoint // ignore: cast_nullable_to_non_nullable
|
||||
as CustomerPoint,
|
||||
failureOptionCustomerPoint: null == failureOptionCustomerPoint
|
||||
? _value.failureOptionCustomerPoint
|
||||
: failureOptionCustomerPoint // ignore: cast_nullable_to_non_nullable
|
||||
as Option<CustomerFailure>,
|
||||
isFetching: null == isFetching
|
||||
? _value.isFetching
|
||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
|
||||
/// Create a copy of CustomerPointLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$CustomerPointCopyWith<$Res> get customerPoint {
|
||||
return $CustomerPointCopyWith<$Res>(_value.customerPoint, (value) {
|
||||
return _then(_value.copyWith(customerPoint: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$CustomerPointLoaderStateImplCopyWith<$Res>
|
||||
implements $CustomerPointLoaderStateCopyWith<$Res> {
|
||||
factory _$$CustomerPointLoaderStateImplCopyWith(
|
||||
_$CustomerPointLoaderStateImpl value,
|
||||
$Res Function(_$CustomerPointLoaderStateImpl) then,
|
||||
) = __$$CustomerPointLoaderStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
CustomerPoint customerPoint,
|
||||
Option<CustomerFailure> failureOptionCustomerPoint,
|
||||
bool isFetching,
|
||||
});
|
||||
|
||||
@override
|
||||
$CustomerPointCopyWith<$Res> get customerPoint;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$CustomerPointLoaderStateImplCopyWithImpl<$Res>
|
||||
extends
|
||||
_$CustomerPointLoaderStateCopyWithImpl<
|
||||
$Res,
|
||||
_$CustomerPointLoaderStateImpl
|
||||
>
|
||||
implements _$$CustomerPointLoaderStateImplCopyWith<$Res> {
|
||||
__$$CustomerPointLoaderStateImplCopyWithImpl(
|
||||
_$CustomerPointLoaderStateImpl _value,
|
||||
$Res Function(_$CustomerPointLoaderStateImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of CustomerPointLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? customerPoint = null,
|
||||
Object? failureOptionCustomerPoint = null,
|
||||
Object? isFetching = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$CustomerPointLoaderStateImpl(
|
||||
customerPoint: null == customerPoint
|
||||
? _value.customerPoint
|
||||
: customerPoint // ignore: cast_nullable_to_non_nullable
|
||||
as CustomerPoint,
|
||||
failureOptionCustomerPoint: null == failureOptionCustomerPoint
|
||||
? _value.failureOptionCustomerPoint
|
||||
: failureOptionCustomerPoint // ignore: cast_nullable_to_non_nullable
|
||||
as Option<CustomerFailure>,
|
||||
isFetching: null == isFetching
|
||||
? _value.isFetching
|
||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$CustomerPointLoaderStateImpl implements _CustomerPointLoaderState {
|
||||
const _$CustomerPointLoaderStateImpl({
|
||||
required this.customerPoint,
|
||||
required this.failureOptionCustomerPoint,
|
||||
this.isFetching = false,
|
||||
});
|
||||
|
||||
@override
|
||||
final CustomerPoint customerPoint;
|
||||
@override
|
||||
final Option<CustomerFailure> failureOptionCustomerPoint;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isFetching;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CustomerPointLoaderState(customerPoint: $customerPoint, failureOptionCustomerPoint: $failureOptionCustomerPoint, isFetching: $isFetching)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$CustomerPointLoaderStateImpl &&
|
||||
(identical(other.customerPoint, customerPoint) ||
|
||||
other.customerPoint == customerPoint) &&
|
||||
(identical(
|
||||
other.failureOptionCustomerPoint,
|
||||
failureOptionCustomerPoint,
|
||||
) ||
|
||||
other.failureOptionCustomerPoint ==
|
||||
failureOptionCustomerPoint) &&
|
||||
(identical(other.isFetching, isFetching) ||
|
||||
other.isFetching == isFetching));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
customerPoint,
|
||||
failureOptionCustomerPoint,
|
||||
isFetching,
|
||||
);
|
||||
|
||||
/// Create a copy of CustomerPointLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$CustomerPointLoaderStateImplCopyWith<_$CustomerPointLoaderStateImpl>
|
||||
get copyWith =>
|
||||
__$$CustomerPointLoaderStateImplCopyWithImpl<
|
||||
_$CustomerPointLoaderStateImpl
|
||||
>(this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _CustomerPointLoaderState implements CustomerPointLoaderState {
|
||||
const factory _CustomerPointLoaderState({
|
||||
required final CustomerPoint customerPoint,
|
||||
required final Option<CustomerFailure> failureOptionCustomerPoint,
|
||||
final bool isFetching,
|
||||
}) = _$CustomerPointLoaderStateImpl;
|
||||
|
||||
@override
|
||||
CustomerPoint get customerPoint;
|
||||
@override
|
||||
Option<CustomerFailure> get failureOptionCustomerPoint;
|
||||
@override
|
||||
bool get isFetching;
|
||||
|
||||
/// Create a copy of CustomerPointLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$CustomerPointLoaderStateImplCopyWith<_$CustomerPointLoaderStateImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
part of 'customer_point_loader_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class CustomerPointLoaderEvent with _$CustomerPointLoaderEvent {
|
||||
const factory CustomerPointLoaderEvent.fetched() = _Fetched;
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
part of 'customer_point_loader_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class CustomerPointLoaderState with _$CustomerPointLoaderState {
|
||||
const factory CustomerPointLoaderState({
|
||||
required CustomerPoint customerPoint,
|
||||
required Option<CustomerFailure> failureOptionCustomerPoint,
|
||||
@Default(false) bool isFetching,
|
||||
}) = _CustomerPointLoaderState;
|
||||
|
||||
factory CustomerPointLoaderState.initial() => CustomerPointLoaderState(
|
||||
customerPoint: CustomerPoint.empty(),
|
||||
failureOptionCustomerPoint: none(),
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../domain/game/game.dart';
|
||||
|
||||
part 'ferris_wheel_loader_event.dart';
|
||||
part 'ferris_wheel_loader_state.dart';
|
||||
part 'ferris_wheel_loader_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class FerrisWheelLoaderBloc
|
||||
extends Bloc<FerrisWheelLoaderEvent, FerrisWheelLoaderState> {
|
||||
final IGameRepository _repository;
|
||||
FerrisWheelLoaderBloc(this._repository)
|
||||
: super(FerrisWheelLoaderState.initial()) {
|
||||
on<FerrisWheelLoaderEvent>(_onFerrisWheelLoaderEvent);
|
||||
}
|
||||
|
||||
Future<void> _onFerrisWheelLoaderEvent(
|
||||
FerrisWheelLoaderEvent event,
|
||||
Emitter<FerrisWheelLoaderState> emit,
|
||||
) {
|
||||
return event.map(
|
||||
fetched: (e) async {
|
||||
emit(
|
||||
state.copyWith(isFetching: true, failureOptionFerrisWheel: none()),
|
||||
);
|
||||
|
||||
final result = await _repository.ferrisWheel();
|
||||
|
||||
var data = result.fold(
|
||||
(f) => state.copyWith(failureOptionFerrisWheel: optionOf(f)),
|
||||
(ferrisWheel) => state.copyWith(ferrisWheel: ferrisWheel),
|
||||
);
|
||||
|
||||
emit(data.copyWith(isFetching: false));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||