Merge pull request 'forget_password_data' (#138) from forget_password_data into main
Reviewed-on: https://repo.ravanertebat.com/TM/tm_app/pulls/138
This commit is contained in:
@@ -8,14 +8,14 @@ class AppConfig {
|
|||||||
|
|
||||||
// این متد بر اساس محیط فعال، URL مناسب را برمیگرداند.
|
// این متد بر اساس محیط فعال، URL مناسب را برمیگرداند.
|
||||||
static String get apiBaseUrl {
|
static String get apiBaseUrl {
|
||||||
// return 'http://10.0.2.2:8081';
|
return 'http://10.0.2.2:8081';
|
||||||
// return '192.168.1.103:8081';
|
// return '192.168.1.103:8081';
|
||||||
// if (isDevelopment) {
|
// if (isDevelopment) {
|
||||||
// // Handle different platforms for local development
|
// // Handle different platforms for local development
|
||||||
// if (kIsWeb) {
|
// if (kIsWeb) {
|
||||||
// For web, use localhost
|
// For web, use localhost
|
||||||
// return 'https://app.opplens.com';
|
// return 'https://app.opplens.com';
|
||||||
return 'http://localhost:8081';
|
// return 'http://localhost:8081';
|
||||||
// } else {
|
// } else {
|
||||||
// For Android emulator, use 10.0.2.2 (special IP for host machine)
|
// For Android emulator, use 10.0.2.2 (special IP for host machine)
|
||||||
// return 'http://10.0.2.2:8081';
|
// return 'http://10.0.2.2:8081';
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:tm_app/views/completion_of_documents/pages/m_completion_of_documents_page.dart';
|
import 'package:tm_app/views/completion_of_documents/pages/m_completion_of_documents_page.dart';
|
||||||
import 'package:tm_app/views/detail/pages/detail_screen.dart';
|
import 'package:tm_app/views/detail/pages/detail_screen.dart';
|
||||||
|
import 'package:tm_app/views/forget_password_otp.dart/pages/forgot_password_otp_screen.dart';
|
||||||
import 'package:tm_app/views/home/pages/home_screen.dart';
|
import 'package:tm_app/views/home/pages/home_screen.dart';
|
||||||
import 'package:tm_app/views/liked_tenders/pages/liked_tenders_screen.dart';
|
import 'package:tm_app/views/liked_tenders/pages/liked_tenders_screen.dart';
|
||||||
import 'package:tm_app/views/login/pages/login_screen.dart';
|
import 'package:tm_app/views/login/pages/login_screen.dart';
|
||||||
@@ -231,3 +232,14 @@ class ForgotPasswordRouteData extends GoRouteData
|
|||||||
return const ForgotPasswordScreen();
|
return const ForgotPasswordScreen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TypedGoRoute<ForgotPasswordOtpRouteData>(path: '/forgot-password-otp')
|
||||||
|
class ForgotPasswordOtpRouteData extends GoRouteData
|
||||||
|
with _$ForgotPasswordOtpRouteData {
|
||||||
|
const ForgotPasswordOtpRouteData();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, GoRouterState state) {
|
||||||
|
return const ForgotPasswordOtpScreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ List<RouteBase> get $appRoutes => [
|
|||||||
$completionOfDocumentsMobileRouteData,
|
$completionOfDocumentsMobileRouteData,
|
||||||
$tenderDetailRouteData,
|
$tenderDetailRouteData,
|
||||||
$forgotPasswordRouteData,
|
$forgotPasswordRouteData,
|
||||||
|
$forgotPasswordOtpRouteData,
|
||||||
];
|
];
|
||||||
|
|
||||||
RouteBase get $loginScreenRoute =>
|
RouteBase get $loginScreenRoute =>
|
||||||
@@ -343,3 +344,30 @@ mixin _$ForgotPasswordRouteData on GoRouteData {
|
|||||||
@override
|
@override
|
||||||
void replace(BuildContext context) => context.replace(location);
|
void replace(BuildContext context) => context.replace(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RouteBase get $forgotPasswordOtpRouteData => GoRouteData.$route(
|
||||||
|
path: '/forgot-password-otp',
|
||||||
|
|
||||||
|
factory: _$ForgotPasswordOtpRouteData._fromState,
|
||||||
|
);
|
||||||
|
|
||||||
|
mixin _$ForgotPasswordOtpRouteData on GoRouteData {
|
||||||
|
static ForgotPasswordOtpRouteData _fromState(GoRouterState state) =>
|
||||||
|
const ForgotPasswordOtpRouteData();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get location => GoRouteData.$location('/forgot-password-otp');
|
||||||
|
|
||||||
|
@override
|
||||||
|
void go(BuildContext context) => context.go(location);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
|
||||||
|
|
||||||
|
@override
|
||||||
|
void pushReplacement(BuildContext context) =>
|
||||||
|
context.pushReplacement(location);
|
||||||
|
|
||||||
|
@override
|
||||||
|
void replace(BuildContext context) => context.replace(location);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
|
import 'package:tm_app/data/services/model/forgot_password_response/forgot_password_response_model.dart';
|
||||||
import 'package:tm_app/data/services/model/login_response/login_response_model.dart';
|
import 'package:tm_app/data/services/model/login_response/login_response_model.dart';
|
||||||
|
import 'package:tm_app/data/services/model/verify_otp_response/verify_otp_response_model.dart';
|
||||||
|
|
||||||
import '../../core/utils/result.dart';
|
import '../../core/utils/result.dart';
|
||||||
import '../services/auth_service.dart';
|
import '../services/auth_service.dart';
|
||||||
@@ -24,4 +26,17 @@ class AuthRepository {
|
|||||||
Future<void> localLogout() async {
|
Future<void> localLogout() async {
|
||||||
return _authService.localLogout();
|
return _authService.localLogout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<Result<ForgotPasswordResponseModel>> forgotPassword({
|
||||||
|
required String email,
|
||||||
|
}) async {
|
||||||
|
return _authService.forgotPassword(email: email);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<Result<VerifyOtpResponseModel>> verifyOtp({
|
||||||
|
required String code,
|
||||||
|
required String email,
|
||||||
|
}) async {
|
||||||
|
return _authService.verifyOtp(code: code, email: email);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
class AuthApi {
|
class AuthApi {
|
||||||
static const String login = '/api/v1/profile/login';
|
static const String login = '/api/v1/profile/login';
|
||||||
static const String logout = '/api/v1/profile/logout';
|
static const String logout = '/api/v1/profile/logout';
|
||||||
|
static const String forgotPassword = '/api/v1/profile/forgot-password';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,10 @@ import 'dart:convert';
|
|||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:tm_app/core/utils/logger.dart';
|
import 'package:tm_app/core/utils/logger.dart';
|
||||||
import 'package:tm_app/data/services/api/auth_api.dart';
|
import 'package:tm_app/data/services/api/auth_api.dart';
|
||||||
|
import 'package:tm_app/data/services/model/forgot_password_response/forgot_password_response_model.dart';
|
||||||
import 'package:tm_app/data/services/model/login_response/login_response_model.dart';
|
import 'package:tm_app/data/services/model/login_response/login_response_model.dart';
|
||||||
import 'package:tm_app/data/services/model/logout_response/logout_response.dart';
|
import 'package:tm_app/data/services/model/logout_response/logout_response.dart';
|
||||||
|
import 'package:tm_app/data/services/model/verify_otp_response/verify_otp_response_model.dart';
|
||||||
|
|
||||||
import '../../core/network/network_manager.dart';
|
import '../../core/network/network_manager.dart';
|
||||||
import '../../core/utils/result.dart';
|
import '../../core/utils/result.dart';
|
||||||
@@ -56,4 +58,36 @@ class AuthService {
|
|||||||
await prefs.remove('refresh_token');
|
await prefs.remove('refresh_token');
|
||||||
appLogger.info('tokens cleared!');
|
appLogger.info('tokens cleared!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<Result<ForgotPasswordResponseModel>> forgotPassword({
|
||||||
|
required String email,
|
||||||
|
}) async {
|
||||||
|
final data = jsonEncode({"email": email});
|
||||||
|
|
||||||
|
final result = await _networkManager.makeRequest(
|
||||||
|
AuthApi.forgotPassword,
|
||||||
|
method: 'POST',
|
||||||
|
(json) => ForgotPasswordResponseModel.fromJson(json),
|
||||||
|
data: data,
|
||||||
|
);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<Result<VerifyOtpResponseModel>> verifyOtp({
|
||||||
|
required String code,
|
||||||
|
required String email,
|
||||||
|
}) async {
|
||||||
|
final data = jsonEncode({"code": code, "email": email});
|
||||||
|
|
||||||
|
final result = await _networkManager.makeRequest(
|
||||||
|
"/api/v1/profile/verify-otp",
|
||||||
|
method: 'POST',
|
||||||
|
(json) => VerifyOtpResponseModel.fromJson(json),
|
||||||
|
data: data,
|
||||||
|
);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
// ignore_for_file: invalid_annotation_target
|
||||||
|
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
import '../error/error_model.dart';
|
||||||
|
|
||||||
|
part 'forgot_password_response_model.freezed.dart';
|
||||||
|
part 'forgot_password_response_model.g.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class ForgotPasswordResponseModel with _$ForgotPasswordResponseModel {
|
||||||
|
const factory ForgotPasswordResponseModel({
|
||||||
|
required bool success,
|
||||||
|
required String? message,
|
||||||
|
required ForgotPasswordData? data,
|
||||||
|
required ErrorModel? error,
|
||||||
|
required Map<String, dynamic>? meta,
|
||||||
|
}) = _ForgotPasswordResponseModel;
|
||||||
|
|
||||||
|
factory ForgotPasswordResponseModel.fromJson(Map<String, Object?> json) =>
|
||||||
|
_$ForgotPasswordResponseModelFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class ForgotPasswordData with _$ForgotPasswordData {
|
||||||
|
const factory ForgotPasswordData({
|
||||||
|
required String? message,
|
||||||
|
required bool? success,
|
||||||
|
}) = _ForgotPasswordData;
|
||||||
|
|
||||||
|
factory ForgotPasswordData.fromJson(Map<String, Object?> json) =>
|
||||||
|
_$ForgotPasswordDataFromJson(json);
|
||||||
|
}
|
||||||
+611
@@ -0,0 +1,611 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// coverage:ignore-file
|
||||||
|
// 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 'forgot_password_response_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$ForgotPasswordResponseModel {
|
||||||
|
|
||||||
|
bool get success; String? get message; ForgotPasswordData? get data; ErrorModel? get error; Map<String, dynamic>? get meta;
|
||||||
|
/// Create a copy of ForgotPasswordResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$ForgotPasswordResponseModelCopyWith<ForgotPasswordResponseModel> get copyWith => _$ForgotPasswordResponseModelCopyWithImpl<ForgotPasswordResponseModel>(this as ForgotPasswordResponseModel, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this ForgotPasswordResponseModel to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is ForgotPasswordResponseModel&&(identical(other.success, success) || other.success == success)&&(identical(other.message, message) || other.message == message)&&(identical(other.data, data) || other.data == data)&&(identical(other.error, error) || other.error == error)&&const DeepCollectionEquality().equals(other.meta, meta));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,success,message,data,error,const DeepCollectionEquality().hash(meta));
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ForgotPasswordResponseModel(success: $success, message: $message, data: $data, error: $error, meta: $meta)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $ForgotPasswordResponseModelCopyWith<$Res> {
|
||||||
|
factory $ForgotPasswordResponseModelCopyWith(ForgotPasswordResponseModel value, $Res Function(ForgotPasswordResponseModel) _then) = _$ForgotPasswordResponseModelCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
bool success, String? message, ForgotPasswordData? data, ErrorModel? error, Map<String, dynamic>? meta
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$ForgotPasswordDataCopyWith<$Res>? get data;$ErrorModelCopyWith<$Res>? get error;
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$ForgotPasswordResponseModelCopyWithImpl<$Res>
|
||||||
|
implements $ForgotPasswordResponseModelCopyWith<$Res> {
|
||||||
|
_$ForgotPasswordResponseModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final ForgotPasswordResponseModel _self;
|
||||||
|
final $Res Function(ForgotPasswordResponseModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of ForgotPasswordResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? success = null,Object? message = freezed,Object? data = freezed,Object? error = freezed,Object? meta = freezed,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
success: null == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,message: freezed == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,data: freezed == data ? _self.data : data // ignore: cast_nullable_to_non_nullable
|
||||||
|
as ForgotPasswordData?,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
|
||||||
|
as ErrorModel?,meta: freezed == meta ? _self.meta : meta // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Map<String, dynamic>?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
/// Create a copy of ForgotPasswordResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$ForgotPasswordDataCopyWith<$Res>? get data {
|
||||||
|
if (_self.data == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ForgotPasswordDataCopyWith<$Res>(_self.data!, (value) {
|
||||||
|
return _then(_self.copyWith(data: value));
|
||||||
|
});
|
||||||
|
}/// Create a copy of ForgotPasswordResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$ErrorModelCopyWith<$Res>? get error {
|
||||||
|
if (_self.error == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ErrorModelCopyWith<$Res>(_self.error!, (value) {
|
||||||
|
return _then(_self.copyWith(error: value));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [ForgotPasswordResponseModel].
|
||||||
|
extension ForgotPasswordResponseModelPatterns on ForgotPasswordResponseModel {
|
||||||
|
/// A variant of `map` that fallback to returning `orElse`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _ForgotPasswordResponseModel value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ForgotPasswordResponseModel() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// Callbacks receives the raw object, upcasted.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case final Subclass2 value:
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _ForgotPasswordResponseModel value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ForgotPasswordResponseModel():
|
||||||
|
return $default(_that);case _:
|
||||||
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `map` that fallback to returning `null`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _ForgotPasswordResponseModel value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ForgotPasswordResponseModel() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to an `orElse` callback.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool success, String? message, ForgotPasswordData? data, ErrorModel? error, Map<String, dynamic>? meta)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ForgotPasswordResponseModel() when $default != null:
|
||||||
|
return $default(_that.success,_that.message,_that.data,_that.error,_that.meta);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// As opposed to `map`, this offers destructuring.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case Subclass2(:final field2):
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool success, String? message, ForgotPasswordData? data, ErrorModel? error, Map<String, dynamic>? meta) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ForgotPasswordResponseModel():
|
||||||
|
return $default(_that.success,_that.message,_that.data,_that.error,_that.meta);case _:
|
||||||
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to returning `null`
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool success, String? message, ForgotPasswordData? data, ErrorModel? error, Map<String, dynamic>? meta)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ForgotPasswordResponseModel() when $default != null:
|
||||||
|
return $default(_that.success,_that.message,_that.data,_that.error,_that.meta);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
|
||||||
|
class _ForgotPasswordResponseModel implements ForgotPasswordResponseModel {
|
||||||
|
const _ForgotPasswordResponseModel({required this.success, required this.message, required this.data, required this.error, required final Map<String, dynamic>? meta}): _meta = meta;
|
||||||
|
factory _ForgotPasswordResponseModel.fromJson(Map<String, dynamic> json) => _$ForgotPasswordResponseModelFromJson(json);
|
||||||
|
|
||||||
|
@override final bool success;
|
||||||
|
@override final String? message;
|
||||||
|
@override final ForgotPasswordData? data;
|
||||||
|
@override final ErrorModel? error;
|
||||||
|
final Map<String, dynamic>? _meta;
|
||||||
|
@override Map<String, dynamic>? get meta {
|
||||||
|
final value = _meta;
|
||||||
|
if (value == null) return null;
|
||||||
|
if (_meta is EqualUnmodifiableMapView) return _meta;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableMapView(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Create a copy of ForgotPasswordResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$ForgotPasswordResponseModelCopyWith<_ForgotPasswordResponseModel> get copyWith => __$ForgotPasswordResponseModelCopyWithImpl<_ForgotPasswordResponseModel>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$ForgotPasswordResponseModelToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ForgotPasswordResponseModel&&(identical(other.success, success) || other.success == success)&&(identical(other.message, message) || other.message == message)&&(identical(other.data, data) || other.data == data)&&(identical(other.error, error) || other.error == error)&&const DeepCollectionEquality().equals(other._meta, _meta));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,success,message,data,error,const DeepCollectionEquality().hash(_meta));
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ForgotPasswordResponseModel(success: $success, message: $message, data: $data, error: $error, meta: $meta)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$ForgotPasswordResponseModelCopyWith<$Res> implements $ForgotPasswordResponseModelCopyWith<$Res> {
|
||||||
|
factory _$ForgotPasswordResponseModelCopyWith(_ForgotPasswordResponseModel value, $Res Function(_ForgotPasswordResponseModel) _then) = __$ForgotPasswordResponseModelCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
bool success, String? message, ForgotPasswordData? data, ErrorModel? error, Map<String, dynamic>? meta
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@override $ForgotPasswordDataCopyWith<$Res>? get data;@override $ErrorModelCopyWith<$Res>? get error;
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$ForgotPasswordResponseModelCopyWithImpl<$Res>
|
||||||
|
implements _$ForgotPasswordResponseModelCopyWith<$Res> {
|
||||||
|
__$ForgotPasswordResponseModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _ForgotPasswordResponseModel _self;
|
||||||
|
final $Res Function(_ForgotPasswordResponseModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of ForgotPasswordResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? success = null,Object? message = freezed,Object? data = freezed,Object? error = freezed,Object? meta = freezed,}) {
|
||||||
|
return _then(_ForgotPasswordResponseModel(
|
||||||
|
success: null == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,message: freezed == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,data: freezed == data ? _self.data : data // ignore: cast_nullable_to_non_nullable
|
||||||
|
as ForgotPasswordData?,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
|
||||||
|
as ErrorModel?,meta: freezed == meta ? _self._meta : meta // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Map<String, dynamic>?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create a copy of ForgotPasswordResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$ForgotPasswordDataCopyWith<$Res>? get data {
|
||||||
|
if (_self.data == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ForgotPasswordDataCopyWith<$Res>(_self.data!, (value) {
|
||||||
|
return _then(_self.copyWith(data: value));
|
||||||
|
});
|
||||||
|
}/// Create a copy of ForgotPasswordResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$ErrorModelCopyWith<$Res>? get error {
|
||||||
|
if (_self.error == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ErrorModelCopyWith<$Res>(_self.error!, (value) {
|
||||||
|
return _then(_self.copyWith(error: value));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$ForgotPasswordData {
|
||||||
|
|
||||||
|
String? get message; bool? get success;
|
||||||
|
/// Create a copy of ForgotPasswordData
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$ForgotPasswordDataCopyWith<ForgotPasswordData> get copyWith => _$ForgotPasswordDataCopyWithImpl<ForgotPasswordData>(this as ForgotPasswordData, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this ForgotPasswordData to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is ForgotPasswordData&&(identical(other.message, message) || other.message == message)&&(identical(other.success, success) || other.success == success));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,message,success);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ForgotPasswordData(message: $message, success: $success)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $ForgotPasswordDataCopyWith<$Res> {
|
||||||
|
factory $ForgotPasswordDataCopyWith(ForgotPasswordData value, $Res Function(ForgotPasswordData) _then) = _$ForgotPasswordDataCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String? message, bool? success
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$ForgotPasswordDataCopyWithImpl<$Res>
|
||||||
|
implements $ForgotPasswordDataCopyWith<$Res> {
|
||||||
|
_$ForgotPasswordDataCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final ForgotPasswordData _self;
|
||||||
|
final $Res Function(ForgotPasswordData) _then;
|
||||||
|
|
||||||
|
/// Create a copy of ForgotPasswordData
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? message = freezed,Object? success = freezed,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
message: freezed == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,success: freezed == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [ForgotPasswordData].
|
||||||
|
extension ForgotPasswordDataPatterns on ForgotPasswordData {
|
||||||
|
/// A variant of `map` that fallback to returning `orElse`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _ForgotPasswordData value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ForgotPasswordData() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// Callbacks receives the raw object, upcasted.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case final Subclass2 value:
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _ForgotPasswordData value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ForgotPasswordData():
|
||||||
|
return $default(_that);case _:
|
||||||
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `map` that fallback to returning `null`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _ForgotPasswordData value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ForgotPasswordData() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to an `orElse` callback.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? message, bool? success)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ForgotPasswordData() when $default != null:
|
||||||
|
return $default(_that.message,_that.success);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// As opposed to `map`, this offers destructuring.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case Subclass2(:final field2):
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? message, bool? success) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ForgotPasswordData():
|
||||||
|
return $default(_that.message,_that.success);case _:
|
||||||
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to returning `null`
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? message, bool? success)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ForgotPasswordData() when $default != null:
|
||||||
|
return $default(_that.message,_that.success);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
|
||||||
|
class _ForgotPasswordData implements ForgotPasswordData {
|
||||||
|
const _ForgotPasswordData({required this.message, required this.success});
|
||||||
|
factory _ForgotPasswordData.fromJson(Map<String, dynamic> json) => _$ForgotPasswordDataFromJson(json);
|
||||||
|
|
||||||
|
@override final String? message;
|
||||||
|
@override final bool? success;
|
||||||
|
|
||||||
|
/// Create a copy of ForgotPasswordData
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$ForgotPasswordDataCopyWith<_ForgotPasswordData> get copyWith => __$ForgotPasswordDataCopyWithImpl<_ForgotPasswordData>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$ForgotPasswordDataToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ForgotPasswordData&&(identical(other.message, message) || other.message == message)&&(identical(other.success, success) || other.success == success));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,message,success);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ForgotPasswordData(message: $message, success: $success)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$ForgotPasswordDataCopyWith<$Res> implements $ForgotPasswordDataCopyWith<$Res> {
|
||||||
|
factory _$ForgotPasswordDataCopyWith(_ForgotPasswordData value, $Res Function(_ForgotPasswordData) _then) = __$ForgotPasswordDataCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
String? message, bool? success
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$ForgotPasswordDataCopyWithImpl<$Res>
|
||||||
|
implements _$ForgotPasswordDataCopyWith<$Res> {
|
||||||
|
__$ForgotPasswordDataCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _ForgotPasswordData _self;
|
||||||
|
final $Res Function(_ForgotPasswordData) _then;
|
||||||
|
|
||||||
|
/// Create a copy of ForgotPasswordData
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? message = freezed,Object? success = freezed,}) {
|
||||||
|
return _then(_ForgotPasswordData(
|
||||||
|
message: freezed == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,success: freezed == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// dart format on
|
||||||
+42
@@ -0,0 +1,42 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'forgot_password_response_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
_ForgotPasswordResponseModel _$ForgotPasswordResponseModelFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _ForgotPasswordResponseModel(
|
||||||
|
success: json['success'] as bool,
|
||||||
|
message: json['message'] as String?,
|
||||||
|
data:
|
||||||
|
json['data'] == null
|
||||||
|
? null
|
||||||
|
: ForgotPasswordData.fromJson(json['data'] as Map<String, dynamic>),
|
||||||
|
error:
|
||||||
|
json['error'] == null
|
||||||
|
? null
|
||||||
|
: ErrorModel.fromJson(json['error'] as Map<String, dynamic>),
|
||||||
|
meta: json['meta'] as Map<String, dynamic>?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$ForgotPasswordResponseModelToJson(
|
||||||
|
_ForgotPasswordResponseModel instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'success': instance.success,
|
||||||
|
'message': instance.message,
|
||||||
|
'data': instance.data,
|
||||||
|
'error': instance.error,
|
||||||
|
'meta': instance.meta,
|
||||||
|
};
|
||||||
|
|
||||||
|
_ForgotPasswordData _$ForgotPasswordDataFromJson(Map<String, dynamic> json) =>
|
||||||
|
_ForgotPasswordData(
|
||||||
|
message: json['message'] as String?,
|
||||||
|
success: json['success'] as bool?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$ForgotPasswordDataToJson(_ForgotPasswordData instance) =>
|
||||||
|
<String, dynamic>{'message': instance.message, 'success': instance.success};
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
part 'verify_otp_data.freezed.dart';
|
||||||
|
part 'verify_otp_data.g.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class VerifyOtpData with _$VerifyOtpData {
|
||||||
|
const factory VerifyOtpData({
|
||||||
|
required String message,
|
||||||
|
required bool success,
|
||||||
|
required String token,
|
||||||
|
}) = _VerifyOtpData;
|
||||||
|
|
||||||
|
factory VerifyOtpData.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$VerifyOtpDataFromJson(json);
|
||||||
|
}
|
||||||
@@ -0,0 +1,283 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// coverage:ignore-file
|
||||||
|
// 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_otp_data.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$VerifyOtpData {
|
||||||
|
|
||||||
|
String get message; bool get success; String get token;
|
||||||
|
/// Create a copy of VerifyOtpData
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$VerifyOtpDataCopyWith<VerifyOtpData> get copyWith => _$VerifyOtpDataCopyWithImpl<VerifyOtpData>(this as VerifyOtpData, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this VerifyOtpData to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is VerifyOtpData&&(identical(other.message, message) || other.message == message)&&(identical(other.success, success) || other.success == success)&&(identical(other.token, token) || other.token == token));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,message,success,token);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'VerifyOtpData(message: $message, success: $success, token: $token)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $VerifyOtpDataCopyWith<$Res> {
|
||||||
|
factory $VerifyOtpDataCopyWith(VerifyOtpData value, $Res Function(VerifyOtpData) _then) = _$VerifyOtpDataCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String message, bool success, String token
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$VerifyOtpDataCopyWithImpl<$Res>
|
||||||
|
implements $VerifyOtpDataCopyWith<$Res> {
|
||||||
|
_$VerifyOtpDataCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final VerifyOtpData _self;
|
||||||
|
final $Res Function(VerifyOtpData) _then;
|
||||||
|
|
||||||
|
/// Create a copy of VerifyOtpData
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? message = null,Object? success = null,Object? token = null,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,success: null == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,token: null == token ? _self.token : token // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [VerifyOtpData].
|
||||||
|
extension VerifyOtpDataPatterns on VerifyOtpData {
|
||||||
|
/// A variant of `map` that fallback to returning `orElse`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _VerifyOtpData value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _VerifyOtpData() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// Callbacks receives the raw object, upcasted.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case final Subclass2 value:
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _VerifyOtpData value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _VerifyOtpData():
|
||||||
|
return $default(_that);case _:
|
||||||
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `map` that fallback to returning `null`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _VerifyOtpData value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _VerifyOtpData() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to an `orElse` callback.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String message, bool success, String token)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _VerifyOtpData() when $default != null:
|
||||||
|
return $default(_that.message,_that.success,_that.token);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// As opposed to `map`, this offers destructuring.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case Subclass2(:final field2):
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String message, bool success, String token) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _VerifyOtpData():
|
||||||
|
return $default(_that.message,_that.success,_that.token);case _:
|
||||||
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to returning `null`
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String message, bool success, String token)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _VerifyOtpData() when $default != null:
|
||||||
|
return $default(_that.message,_that.success,_that.token);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
|
||||||
|
class _VerifyOtpData implements VerifyOtpData {
|
||||||
|
const _VerifyOtpData({required this.message, required this.success, required this.token});
|
||||||
|
factory _VerifyOtpData.fromJson(Map<String, dynamic> json) => _$VerifyOtpDataFromJson(json);
|
||||||
|
|
||||||
|
@override final String message;
|
||||||
|
@override final bool success;
|
||||||
|
@override final String token;
|
||||||
|
|
||||||
|
/// Create a copy of VerifyOtpData
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$VerifyOtpDataCopyWith<_VerifyOtpData> get copyWith => __$VerifyOtpDataCopyWithImpl<_VerifyOtpData>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$VerifyOtpDataToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _VerifyOtpData&&(identical(other.message, message) || other.message == message)&&(identical(other.success, success) || other.success == success)&&(identical(other.token, token) || other.token == token));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,message,success,token);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'VerifyOtpData(message: $message, success: $success, token: $token)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$VerifyOtpDataCopyWith<$Res> implements $VerifyOtpDataCopyWith<$Res> {
|
||||||
|
factory _$VerifyOtpDataCopyWith(_VerifyOtpData value, $Res Function(_VerifyOtpData) _then) = __$VerifyOtpDataCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
String message, bool success, String token
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$VerifyOtpDataCopyWithImpl<$Res>
|
||||||
|
implements _$VerifyOtpDataCopyWith<$Res> {
|
||||||
|
__$VerifyOtpDataCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _VerifyOtpData _self;
|
||||||
|
final $Res Function(_VerifyOtpData) _then;
|
||||||
|
|
||||||
|
/// Create a copy of VerifyOtpData
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? message = null,Object? success = null,Object? token = null,}) {
|
||||||
|
return _then(_VerifyOtpData(
|
||||||
|
message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,success: null == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,token: null == token ? _self.token : token // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// dart format on
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'verify_otp_data.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
_VerifyOtpData _$VerifyOtpDataFromJson(Map<String, dynamic> json) =>
|
||||||
|
_VerifyOtpData(
|
||||||
|
message: json['message'] as String,
|
||||||
|
success: json['success'] as bool,
|
||||||
|
token: json['token'] as String,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$VerifyOtpDataToJson(_VerifyOtpData instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'message': instance.message,
|
||||||
|
'success': instance.success,
|
||||||
|
'token': instance.token,
|
||||||
|
};
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
import 'package:tm_app/data/services/model/verify_otp_data/verify_otp_data.dart';
|
||||||
|
|
||||||
|
part 'verify_otp_response_model.freezed.dart';
|
||||||
|
part 'verify_otp_response_model.g.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class VerifyOtpResponseModel with _$VerifyOtpResponseModel {
|
||||||
|
const factory VerifyOtpResponseModel({
|
||||||
|
required bool success,
|
||||||
|
required String message,
|
||||||
|
required VerifyOtpData data,
|
||||||
|
}) = _VerifyOtpResponseModel;
|
||||||
|
|
||||||
|
factory VerifyOtpResponseModel.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$VerifyOtpResponseModelFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,301 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// coverage:ignore-file
|
||||||
|
// 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_otp_response_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$VerifyOtpResponseModel {
|
||||||
|
|
||||||
|
bool get success; String get message; VerifyOtpData get data;
|
||||||
|
/// Create a copy of VerifyOtpResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$VerifyOtpResponseModelCopyWith<VerifyOtpResponseModel> get copyWith => _$VerifyOtpResponseModelCopyWithImpl<VerifyOtpResponseModel>(this as VerifyOtpResponseModel, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this VerifyOtpResponseModel to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is VerifyOtpResponseModel&&(identical(other.success, success) || other.success == success)&&(identical(other.message, message) || other.message == message)&&(identical(other.data, data) || other.data == data));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,success,message,data);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'VerifyOtpResponseModel(success: $success, message: $message, data: $data)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $VerifyOtpResponseModelCopyWith<$Res> {
|
||||||
|
factory $VerifyOtpResponseModelCopyWith(VerifyOtpResponseModel value, $Res Function(VerifyOtpResponseModel) _then) = _$VerifyOtpResponseModelCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
bool success, String message, VerifyOtpData data
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$VerifyOtpDataCopyWith<$Res> get data;
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$VerifyOtpResponseModelCopyWithImpl<$Res>
|
||||||
|
implements $VerifyOtpResponseModelCopyWith<$Res> {
|
||||||
|
_$VerifyOtpResponseModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final VerifyOtpResponseModel _self;
|
||||||
|
final $Res Function(VerifyOtpResponseModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of VerifyOtpResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? success = null,Object? message = null,Object? data = null,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
success: null == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable
|
||||||
|
as VerifyOtpData,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
/// Create a copy of VerifyOtpResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$VerifyOtpDataCopyWith<$Res> get data {
|
||||||
|
|
||||||
|
return $VerifyOtpDataCopyWith<$Res>(_self.data, (value) {
|
||||||
|
return _then(_self.copyWith(data: value));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [VerifyOtpResponseModel].
|
||||||
|
extension VerifyOtpResponseModelPatterns on VerifyOtpResponseModel {
|
||||||
|
/// A variant of `map` that fallback to returning `orElse`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _VerifyOtpResponseModel value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _VerifyOtpResponseModel() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// Callbacks receives the raw object, upcasted.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case final Subclass2 value:
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _VerifyOtpResponseModel value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _VerifyOtpResponseModel():
|
||||||
|
return $default(_that);case _:
|
||||||
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `map` that fallback to returning `null`.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case final Subclass value:
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _VerifyOtpResponseModel value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _VerifyOtpResponseModel() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to an `orElse` callback.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool success, String message, VerifyOtpData data)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _VerifyOtpResponseModel() when $default != null:
|
||||||
|
return $default(_that.success,_that.message,_that.data);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// As opposed to `map`, this offers destructuring.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case Subclass2(:final field2):
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool success, String message, VerifyOtpData data) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _VerifyOtpResponseModel():
|
||||||
|
return $default(_that.success,_that.message,_that.data);case _:
|
||||||
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to returning `null`
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool success, String message, VerifyOtpData data)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _VerifyOtpResponseModel() when $default != null:
|
||||||
|
return $default(_that.success,_that.message,_that.data);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
|
||||||
|
class _VerifyOtpResponseModel implements VerifyOtpResponseModel {
|
||||||
|
const _VerifyOtpResponseModel({required this.success, required this.message, required this.data});
|
||||||
|
factory _VerifyOtpResponseModel.fromJson(Map<String, dynamic> json) => _$VerifyOtpResponseModelFromJson(json);
|
||||||
|
|
||||||
|
@override final bool success;
|
||||||
|
@override final String message;
|
||||||
|
@override final VerifyOtpData data;
|
||||||
|
|
||||||
|
/// Create a copy of VerifyOtpResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$VerifyOtpResponseModelCopyWith<_VerifyOtpResponseModel> get copyWith => __$VerifyOtpResponseModelCopyWithImpl<_VerifyOtpResponseModel>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$VerifyOtpResponseModelToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _VerifyOtpResponseModel&&(identical(other.success, success) || other.success == success)&&(identical(other.message, message) || other.message == message)&&(identical(other.data, data) || other.data == data));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,success,message,data);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'VerifyOtpResponseModel(success: $success, message: $message, data: $data)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$VerifyOtpResponseModelCopyWith<$Res> implements $VerifyOtpResponseModelCopyWith<$Res> {
|
||||||
|
factory _$VerifyOtpResponseModelCopyWith(_VerifyOtpResponseModel value, $Res Function(_VerifyOtpResponseModel) _then) = __$VerifyOtpResponseModelCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
bool success, String message, VerifyOtpData data
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@override $VerifyOtpDataCopyWith<$Res> get data;
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$VerifyOtpResponseModelCopyWithImpl<$Res>
|
||||||
|
implements _$VerifyOtpResponseModelCopyWith<$Res> {
|
||||||
|
__$VerifyOtpResponseModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _VerifyOtpResponseModel _self;
|
||||||
|
final $Res Function(_VerifyOtpResponseModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of VerifyOtpResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? success = null,Object? message = null,Object? data = null,}) {
|
||||||
|
return _then(_VerifyOtpResponseModel(
|
||||||
|
success: null == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable
|
||||||
|
as VerifyOtpData,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create a copy of VerifyOtpResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$VerifyOtpDataCopyWith<$Res> get data {
|
||||||
|
|
||||||
|
return $VerifyOtpDataCopyWith<$Res>(_self.data, (value) {
|
||||||
|
return _then(_self.copyWith(data: value));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// dart format on
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'verify_otp_response_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
_VerifyOtpResponseModel _$VerifyOtpResponseModelFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _VerifyOtpResponseModel(
|
||||||
|
success: json['success'] as bool,
|
||||||
|
message: json['message'] as String,
|
||||||
|
data: VerifyOtpData.fromJson(json['data'] as Map<String, dynamic>),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$VerifyOtpResponseModelToJson(
|
||||||
|
_VerifyOtpResponseModel instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'success': instance.success,
|
||||||
|
'message': instance.message,
|
||||||
|
'data': instance.data,
|
||||||
|
};
|
||||||
@@ -26,6 +26,9 @@ class $AssetsIconsGen {
|
|||||||
/// File path: assets/icons/arrow-circle-right.svg
|
/// File path: assets/icons/arrow-circle-right.svg
|
||||||
String get arrowCircleRight => 'assets/icons/arrow-circle-right.svg';
|
String get arrowCircleRight => 'assets/icons/arrow-circle-right.svg';
|
||||||
|
|
||||||
|
/// File path: assets/icons/arrow-down.svg
|
||||||
|
String get arrowDown => 'assets/icons/arrow-down.svg';
|
||||||
|
|
||||||
/// File path: assets/icons/arrow-left-small.svg
|
/// File path: assets/icons/arrow-left-small.svg
|
||||||
String get arrowLeftSmall => 'assets/icons/arrow-left-small.svg';
|
String get arrowLeftSmall => 'assets/icons/arrow-left-small.svg';
|
||||||
|
|
||||||
@@ -35,6 +38,9 @@ class $AssetsIconsGen {
|
|||||||
/// File path: assets/icons/arrow-right.svg
|
/// File path: assets/icons/arrow-right.svg
|
||||||
String get arrowRight => 'assets/icons/arrow-right.svg';
|
String get arrowRight => 'assets/icons/arrow-right.svg';
|
||||||
|
|
||||||
|
/// File path: assets/icons/arrow-up.svg
|
||||||
|
String get arrowUp => 'assets/icons/arrow-up.svg';
|
||||||
|
|
||||||
/// File path: assets/icons/arrow_down_small.svg
|
/// File path: assets/icons/arrow_down_small.svg
|
||||||
String get arrowDownSmall => 'assets/icons/arrow_down_small.svg';
|
String get arrowDownSmall => 'assets/icons/arrow_down_small.svg';
|
||||||
|
|
||||||
@@ -44,9 +50,15 @@ class $AssetsIconsGen {
|
|||||||
/// File path: assets/icons/calendar.svg
|
/// File path: assets/icons/calendar.svg
|
||||||
String get calendar => 'assets/icons/calendar.svg';
|
String get calendar => 'assets/icons/calendar.svg';
|
||||||
|
|
||||||
|
/// File path: assets/icons/clipboard-text.svg
|
||||||
|
String get clipboardText => 'assets/icons/clipboard-text.svg';
|
||||||
|
|
||||||
/// File path: assets/icons/close-circle.svg
|
/// File path: assets/icons/close-circle.svg
|
||||||
String get closeCircle => 'assets/icons/close-circle.svg';
|
String get closeCircle => 'assets/icons/close-circle.svg';
|
||||||
|
|
||||||
|
/// File path: assets/icons/danger-fill.svg
|
||||||
|
String get dangerFill => 'assets/icons/danger-fill.svg';
|
||||||
|
|
||||||
/// File path: assets/icons/danger.svg
|
/// File path: assets/icons/danger.svg
|
||||||
String get danger => 'assets/icons/danger.svg';
|
String get danger => 'assets/icons/danger.svg';
|
||||||
|
|
||||||
@@ -141,19 +153,26 @@ class $AssetsIconsGen {
|
|||||||
/// File path: assets/icons/trash.svg
|
/// File path: assets/icons/trash.svg
|
||||||
String get trash => 'assets/icons/trash.svg';
|
String get trash => 'assets/icons/trash.svg';
|
||||||
|
|
||||||
|
/// File path: assets/icons/upload_file.svg
|
||||||
|
String get uploadFile => 'assets/icons/upload_file.svg';
|
||||||
|
|
||||||
/// List of all assets
|
/// List of all assets
|
||||||
List<dynamic> get values => [
|
List<dynamic> get values => [
|
||||||
se,
|
se,
|
||||||
approve,
|
approve,
|
||||||
arrowCircleLeft,
|
arrowCircleLeft,
|
||||||
arrowCircleRight,
|
arrowCircleRight,
|
||||||
|
arrowDown,
|
||||||
arrowLeftSmall,
|
arrowLeftSmall,
|
||||||
arrowRightSmall,
|
arrowRightSmall,
|
||||||
arrowRight,
|
arrowRight,
|
||||||
|
arrowUp,
|
||||||
arrowDownSmall,
|
arrowDownSmall,
|
||||||
arrows,
|
arrows,
|
||||||
calendar,
|
calendar,
|
||||||
|
clipboardText,
|
||||||
closeCircle,
|
closeCircle,
|
||||||
|
dangerFill,
|
||||||
danger,
|
danger,
|
||||||
dislike,
|
dislike,
|
||||||
edit,
|
edit,
|
||||||
@@ -185,6 +204,7 @@ class $AssetsIconsGen {
|
|||||||
tick,
|
tick,
|
||||||
trailingIcon,
|
trailingIcon,
|
||||||
trash,
|
trash,
|
||||||
|
uploadFile,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:tm_app/data/services/model/customer/customer.dart';
|
import 'package:tm_app/data/services/model/customer/customer.dart';
|
||||||
|
import 'package:tm_app/data/services/model/forgot_password_response/forgot_password_response_model.dart';
|
||||||
|
import 'package:tm_app/data/services/model/verify_otp_response/verify_otp_response_model.dart';
|
||||||
|
import 'package:tm_app/views/forget_password_create/pages/forgot_password_create_screen.dart';
|
||||||
|
|
||||||
import '../core/utils/result.dart';
|
import '../core/utils/result.dart';
|
||||||
import '../data/repositories/auth_repository.dart';
|
import '../data/repositories/auth_repository.dart';
|
||||||
@@ -16,8 +19,6 @@ class AuthViewModel with ChangeNotifier {
|
|||||||
emailController.addListener(_onTextChanged);
|
emailController.addListener(_onTextChanged);
|
||||||
otpController.addListener(_onTextChanged);
|
otpController.addListener(_onTextChanged);
|
||||||
newPasswordController.addListener(_onTextChanged);
|
newPasswordController.addListener(_onTextChanged);
|
||||||
// usernameFocus.addListener(_onTextChanged);
|
|
||||||
// passwordFocus.addListener(_onTextChanged);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final TextEditingController usernameController = TextEditingController();
|
final TextEditingController usernameController = TextEditingController();
|
||||||
@@ -25,6 +26,7 @@ class AuthViewModel with ChangeNotifier {
|
|||||||
final TextEditingController emailController = TextEditingController();
|
final TextEditingController emailController = TextEditingController();
|
||||||
final TextEditingController newPasswordController = TextEditingController();
|
final TextEditingController newPasswordController = TextEditingController();
|
||||||
final TextEditingController otpController = TextEditingController();
|
final TextEditingController otpController = TextEditingController();
|
||||||
|
|
||||||
final FocusNode usernameFocus = FocusNode();
|
final FocusNode usernameFocus = FocusNode();
|
||||||
final FocusNode passwordFocus = FocusNode();
|
final FocusNode passwordFocus = FocusNode();
|
||||||
final FocusNode emailFocus = FocusNode();
|
final FocusNode emailFocus = FocusNode();
|
||||||
@@ -33,8 +35,10 @@ class AuthViewModel with ChangeNotifier {
|
|||||||
|
|
||||||
bool _obscurePassword = true;
|
bool _obscurePassword = true;
|
||||||
bool get obscurePassword => _obscurePassword;
|
bool get obscurePassword => _obscurePassword;
|
||||||
|
|
||||||
bool _obscureForgotPassword = true;
|
bool _obscureForgotPassword = true;
|
||||||
bool get obscureForgotPassword => _obscureForgotPassword;
|
bool get obscureForgotPassword => _obscureForgotPassword;
|
||||||
|
|
||||||
bool get isLoginEnabled =>
|
bool get isLoginEnabled =>
|
||||||
usernameController.text.isNotEmpty && passwordController.text.isNotEmpty;
|
usernameController.text.isNotEmpty && passwordController.text.isNotEmpty;
|
||||||
|
|
||||||
@@ -42,16 +46,25 @@ class AuthViewModel with ChangeNotifier {
|
|||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
String? _errorMessage;
|
String? _errorMessage;
|
||||||
Customer? _loggedInUser;
|
Customer? _loggedInUser;
|
||||||
|
String? successMessage;
|
||||||
|
String? _forgotPasswordMessage;
|
||||||
|
|
||||||
bool get isLoading => _isLoading;
|
bool get isLoading => _isLoading;
|
||||||
String? get errorMessage => _errorMessage;
|
String? get errorMessage => _errorMessage;
|
||||||
Customer? get loggedInUser => _loggedInUser;
|
Customer? get loggedInUser => _loggedInUser;
|
||||||
|
String? get forgotPasswordMessage => _forgotPasswordMessage;
|
||||||
|
String? resetToken;
|
||||||
|
|
||||||
void togglePasswordVisibility() {
|
void togglePasswordVisibility() {
|
||||||
_obscurePassword = !_obscurePassword;
|
_obscurePassword = !_obscurePassword;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void toggleForgotPasswordVisibility() {
|
||||||
|
_obscureForgotPassword = !_obscureForgotPassword;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
bool get isEmailValid {
|
bool get isEmailValid {
|
||||||
final email = emailController.text.trim();
|
final email = emailController.text.trim();
|
||||||
final emailRegex = RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$');
|
final emailRegex = RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$');
|
||||||
@@ -64,7 +77,7 @@ class AuthViewModel with ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool get canSubmitOtpPage {
|
bool get canSubmitOtpPage {
|
||||||
return isEmailValid && isOtpValid;
|
return isOtpValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get isNewPasswordValid {
|
bool get isNewPasswordValid {
|
||||||
@@ -78,11 +91,6 @@ class AuthViewModel with ChangeNotifier {
|
|||||||
return hasMinLength && hasUppercase && hasLowercase && hasSpecialChar;
|
return hasMinLength && hasUppercase && hasLowercase && hasSpecialChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleForgotPasswordVisibility() {
|
|
||||||
_obscureForgotPassword = !_obscureForgotPassword;
|
|
||||||
notifyListeners();
|
|
||||||
}
|
|
||||||
|
|
||||||
void _onTextChanged() {
|
void _onTextChanged() {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
@@ -102,8 +110,6 @@ class AuthViewModel with ChangeNotifier {
|
|||||||
switch (result) {
|
switch (result) {
|
||||||
case Ok<LoginResponseModel>():
|
case Ok<LoginResponseModel>():
|
||||||
_loggedInUser = result.value.data.customer;
|
_loggedInUser = result.value.data.customer;
|
||||||
usernameController.text.trim();
|
|
||||||
passwordController.text.trim();
|
|
||||||
usernameController.clear();
|
usernameController.clear();
|
||||||
passwordController.clear();
|
passwordController.clear();
|
||||||
break;
|
break;
|
||||||
@@ -114,6 +120,8 @@ class AuthViewModel with ChangeNotifier {
|
|||||||
|
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|
||||||
|
// reset error after notify
|
||||||
_errorMessage = null;
|
_errorMessage = null;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
@@ -139,6 +147,71 @@ class AuthViewModel with ChangeNotifier {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
notifyListeners();
|
||||||
|
|
||||||
|
_errorMessage = null;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> forgotPassword(BuildContext context) async {
|
||||||
|
_isLoading = true;
|
||||||
|
_errorMessage = null;
|
||||||
|
successMessage = null;
|
||||||
|
notifyListeners();
|
||||||
|
|
||||||
|
final result = await _authRepository.forgotPassword(
|
||||||
|
email: emailController.text.trim(),
|
||||||
|
);
|
||||||
|
|
||||||
|
switch (result) {
|
||||||
|
case Ok<ForgotPasswordResponseModel>():
|
||||||
|
_isLoading = false;
|
||||||
|
successMessage = result.value.message;
|
||||||
|
notifyListeners();
|
||||||
|
|
||||||
|
Future.microtask(() {
|
||||||
|
successMessage = null;
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Error<ForgotPasswordResponseModel>():
|
||||||
|
_isLoading = false;
|
||||||
|
_errorMessage = result.error.toString();
|
||||||
|
notifyListeners();
|
||||||
|
|
||||||
|
Future.microtask(() {
|
||||||
|
_errorMessage = null;
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> verifyOtp(BuildContext context) async {
|
||||||
|
_isLoading = true;
|
||||||
|
_errorMessage = null;
|
||||||
|
notifyListeners();
|
||||||
|
|
||||||
|
final result = await _authRepository.verifyOtp(
|
||||||
|
code: otpController.text.trim(),
|
||||||
|
email: emailController.text.trim(),
|
||||||
|
);
|
||||||
|
|
||||||
|
switch (result) {
|
||||||
|
case Ok<VerifyOtpResponseModel>():
|
||||||
|
_isLoading = false;
|
||||||
|
resetToken = result.value.data.token;
|
||||||
|
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (_) => const ForgotPasswordCreateScreen()),
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Error<VerifyOtpResponseModel>():
|
||||||
|
_isLoading = false;
|
||||||
|
_errorMessage = result.error.toString();
|
||||||
|
break;
|
||||||
|
}
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
_errorMessage = null;
|
_errorMessage = null;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
@@ -148,8 +221,16 @@ class AuthViewModel with ChangeNotifier {
|
|||||||
void dispose() {
|
void dispose() {
|
||||||
usernameController.dispose();
|
usernameController.dispose();
|
||||||
passwordController.dispose();
|
passwordController.dispose();
|
||||||
|
emailController.dispose();
|
||||||
|
newPasswordController.dispose();
|
||||||
|
otpController.dispose();
|
||||||
|
|
||||||
usernameFocus.dispose();
|
usernameFocus.dispose();
|
||||||
passwordFocus.dispose();
|
passwordFocus.dispose();
|
||||||
|
emailFocus.dispose();
|
||||||
|
newPasswordFocus.dispose();
|
||||||
|
otpFocus.dispose();
|
||||||
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:pinput/pinput.dart';
|
import 'package:pinput/pinput.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:tm_app/core/utils/size_config.dart';
|
import 'package:tm_app/core/utils/size_config.dart';
|
||||||
import 'package:tm_app/views/forget_password_create/pages/forgot_password_create_screen.dart';
|
|
||||||
|
|
||||||
import '../../../core/constants/assets.dart';
|
import '../../../core/constants/assets.dart';
|
||||||
import '../../../core/theme/colors.dart';
|
import '../../../core/theme/colors.dart';
|
||||||
@@ -88,20 +87,12 @@ class DesktopForgotPasswordOtpPage extends StatelessWidget {
|
|||||||
onPressed: null,
|
onPressed: null,
|
||||||
)
|
)
|
||||||
: BaseButton(
|
: BaseButton(
|
||||||
isEnabled:
|
isEnabled: viewModel.canSubmitOtpPage,
|
||||||
viewModel.canSubmitOtpPage, // 👈 شرط جدید
|
|
||||||
text: ForgotPasswordOtpStrings.resetLink,
|
text: ForgotPasswordOtpStrings.resetLink,
|
||||||
onPressed:
|
onPressed:
|
||||||
viewModel.canSubmitOtpPage
|
viewModel.canSubmitOtpPage
|
||||||
? () async {
|
? () async {
|
||||||
Navigator.push(
|
await viewModel.verifyOtp(context);
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder:
|
|
||||||
(context) =>
|
|
||||||
const ForgotPasswordCreateScreen(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:pinput/pinput.dart';
|
import 'package:pinput/pinput.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:tm_app/core/utils/size_config.dart';
|
import 'package:tm_app/core/utils/size_config.dart';
|
||||||
import 'package:tm_app/views/forget_password_create/pages/forgot_password_create_screen.dart';
|
|
||||||
|
|
||||||
import '../../../core/constants/assets.dart';
|
import '../../../core/constants/assets.dart';
|
||||||
import '../../../core/theme/colors.dart';
|
import '../../../core/theme/colors.dart';
|
||||||
@@ -89,14 +88,7 @@ class MobileForgotPasswordOtpPage extends StatelessWidget {
|
|||||||
onPressed:
|
onPressed:
|
||||||
viewModel.canSubmitOtpPage
|
viewModel.canSubmitOtpPage
|
||||||
? () async {
|
? () async {
|
||||||
Navigator.push(
|
await viewModel.verifyOtp(context);
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder:
|
|
||||||
(context) =>
|
|
||||||
const ForgotPasswordCreateScreen(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:pinput/pinput.dart';
|
import 'package:pinput/pinput.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:tm_app/core/utils/size_config.dart';
|
import 'package:tm_app/core/utils/size_config.dart';
|
||||||
import 'package:tm_app/views/forget_password_create/pages/forgot_password_create_screen.dart';
|
|
||||||
|
|
||||||
import '../../../core/constants/assets.dart';
|
import '../../../core/constants/assets.dart';
|
||||||
import '../../../core/theme/colors.dart';
|
import '../../../core/theme/colors.dart';
|
||||||
@@ -88,20 +87,12 @@ class TabletForgotPasswordOtpPage extends StatelessWidget {
|
|||||||
onPressed: null,
|
onPressed: null,
|
||||||
)
|
)
|
||||||
: BaseButton(
|
: BaseButton(
|
||||||
isEnabled:
|
isEnabled: viewModel.canSubmitOtpPage,
|
||||||
viewModel.canSubmitOtpPage, // 👈 شرط جدید
|
|
||||||
text: ForgotPasswordOtpStrings.resetLink,
|
text: ForgotPasswordOtpStrings.resetLink,
|
||||||
onPressed:
|
onPressed:
|
||||||
viewModel.canSubmitOtpPage
|
viewModel.canSubmitOtpPage
|
||||||
? () async {
|
? () async {
|
||||||
Navigator.push(
|
await viewModel.verifyOtp(context);
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder:
|
|
||||||
(context) =>
|
|
||||||
const ForgotPasswordCreateScreen(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:tm_app/core/routes/app_routes.dart';
|
||||||
import 'package:tm_app/core/utils/size_config.dart';
|
import 'package:tm_app/core/utils/size_config.dart';
|
||||||
import 'package:tm_app/views/forget_password_otp.dart/pages/forgot_password_otp_screen.dart';
|
|
||||||
|
|
||||||
import '../../../core/constants/assets.dart';
|
import '../../../core/constants/assets.dart';
|
||||||
import '../../../core/theme/colors.dart';
|
import '../../../core/theme/colors.dart';
|
||||||
|
import '../../../core/utils/app_toast.dart';
|
||||||
import '../../../view_models/auth_view_model.dart';
|
import '../../../view_models/auth_view_model.dart';
|
||||||
import '../../login/widgets/login_textfield.dart';
|
import '../../login/widgets/login_textfield.dart';
|
||||||
import '../../shared/base_button.dart';
|
import '../../shared/base_button.dart';
|
||||||
@@ -22,6 +22,17 @@ class DesktopForgotPasswordPage extends StatelessWidget {
|
|||||||
body: Center(
|
body: Center(
|
||||||
child: Consumer<AuthViewModel>(
|
child: Consumer<AuthViewModel>(
|
||||||
builder: (context, viewModel, _) {
|
builder: (context, viewModel, _) {
|
||||||
|
if (viewModel.successMessage != null) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
AppToast.success(context, viewModel.successMessage!);
|
||||||
|
const ForgotPasswordOtpRouteData().push(context);
|
||||||
|
});
|
||||||
|
} else if (viewModel.errorMessage != null) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
AppToast.error(context, viewModel.errorMessage!);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: [
|
||||||
@@ -60,27 +71,12 @@ class DesktopForgotPasswordPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 40.0.h()),
|
SizedBox(height: 40.0.h()),
|
||||||
// LoginTextField(
|
|
||||||
// controller: viewModel.emailController,
|
|
||||||
// focusNode: viewModel.emailFocus,
|
|
||||||
// label: ForgotPasswordStrings.usernameHint,
|
|
||||||
// iconPath: AssetsManager.userIcon,
|
|
||||||
// isPassword: false,
|
|
||||||
// ),
|
|
||||||
// SizedBox(height: 24.0.h()),
|
|
||||||
LoginTextField(
|
LoginTextField(
|
||||||
controller: viewModel.emailController,
|
controller: viewModel.emailController,
|
||||||
focusNode: viewModel.emailFocus,
|
focusNode: viewModel.emailFocus,
|
||||||
label: ForgotPasswordStrings.emailHint,
|
label: ForgotPasswordStrings.emailHint,
|
||||||
isPassword: false,
|
isPassword: false,
|
||||||
),
|
),
|
||||||
// SizedBox(height: 24.0.h()),
|
|
||||||
// LoginTextField(
|
|
||||||
// controller: viewModel.emailController,
|
|
||||||
// focusNode: viewModel.emailFocus,
|
|
||||||
// label: ForgotPasswordStrings.companyIdHint,
|
|
||||||
// isPassword: false,
|
|
||||||
// ),
|
|
||||||
SizedBox(height: 70.0.h()),
|
SizedBox(height: 70.0.h()),
|
||||||
viewModel.isLoading
|
viewModel.isLoading
|
||||||
? const BaseButton(
|
? const BaseButton(
|
||||||
@@ -94,21 +90,14 @@ class DesktopForgotPasswordPage extends StatelessWidget {
|
|||||||
onPressed:
|
onPressed:
|
||||||
viewModel.isEmailValid
|
viewModel.isEmailValid
|
||||||
? () async {
|
? () async {
|
||||||
Navigator.push(
|
await viewModel.forgotPassword(context);
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder:
|
|
||||||
(context) =>
|
|
||||||
const ForgotPasswordOtpScreen(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
context.pop();
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
ForgotPasswordStrings.backToSignInButton,
|
ForgotPasswordStrings.backToSignInButton,
|
||||||
@@ -123,7 +112,6 @@ class DesktopForgotPasswordPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.symmetric(vertical: 20.0.h()),
|
padding: EdgeInsets.symmetric(vertical: 20.0.h()),
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:tm_app/core/constants/assets.dart';
|
||||||
|
import 'package:tm_app/core/routes/app_routes.dart';
|
||||||
|
import 'package:tm_app/core/theme/colors.dart';
|
||||||
|
import 'package:tm_app/core/utils/app_toast.dart';
|
||||||
import 'package:tm_app/core/utils/size_config.dart';
|
import 'package:tm_app/core/utils/size_config.dart';
|
||||||
import 'package:tm_app/views/forget_password_otp.dart/pages/forgot_password_otp_screen.dart';
|
import 'package:tm_app/view_models/auth_view_model.dart';
|
||||||
|
|
||||||
import '../../../core/constants/assets.dart';
|
|
||||||
import '../../../core/theme/colors.dart';
|
|
||||||
import '../../../view_models/auth_view_model.dart';
|
|
||||||
import '../../login/widgets/login_textfield.dart';
|
import '../../login/widgets/login_textfield.dart';
|
||||||
import '../../shared/base_button.dart';
|
import '../../shared/base_button.dart';
|
||||||
import '../strings/forgot_password_strings.dart';
|
import '../strings/forgot_password_strings.dart';
|
||||||
@@ -24,6 +24,17 @@ class MobileForgotPasswordPage extends StatelessWidget {
|
|||||||
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
|
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
|
||||||
child: Consumer<AuthViewModel>(
|
child: Consumer<AuthViewModel>(
|
||||||
builder: (context, viewModel, _) {
|
builder: (context, viewModel, _) {
|
||||||
|
if (viewModel.successMessage != null) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
AppToast.success(context, viewModel.successMessage!);
|
||||||
|
const ForgotPasswordOtpRouteData().push(context);
|
||||||
|
});
|
||||||
|
} else if (viewModel.errorMessage != null) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
AppToast.error(context, viewModel.errorMessage!);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
@@ -55,14 +66,6 @@ class MobileForgotPasswordPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 40.0.h()),
|
SizedBox(height: 40.0.h()),
|
||||||
// LoginTextField(
|
|
||||||
// controller: viewModel.emailController,
|
|
||||||
// focusNode: viewModel.emailFocus,
|
|
||||||
// label: ForgotPasswordStrings.usernameHint,
|
|
||||||
// iconPath: AssetsManager.userIcon,
|
|
||||||
// isPassword: false,
|
|
||||||
// ),
|
|
||||||
// SizedBox(height: 24.0.h()),
|
|
||||||
LoginTextField(
|
LoginTextField(
|
||||||
controller: viewModel.emailController,
|
controller: viewModel.emailController,
|
||||||
focusNode: viewModel.emailFocus,
|
focusNode: viewModel.emailFocus,
|
||||||
@@ -70,13 +73,6 @@ class MobileForgotPasswordPage extends StatelessWidget {
|
|||||||
isPassword: false,
|
isPassword: false,
|
||||||
),
|
),
|
||||||
SizedBox(height: 24.0.h()),
|
SizedBox(height: 24.0.h()),
|
||||||
// LoginTextField(
|
|
||||||
// controller: viewModel.emailController,
|
|
||||||
// focusNode: viewModel.emailFocus,
|
|
||||||
// label: ForgotPasswordStrings.companyIdHint,
|
|
||||||
// isPassword: false,
|
|
||||||
// ),
|
|
||||||
// SizedBox(height: 70.0.h()),
|
|
||||||
viewModel.isLoading
|
viewModel.isLoading
|
||||||
? const BaseButton(
|
? const BaseButton(
|
||||||
isEnabled: false,
|
isEnabled: false,
|
||||||
@@ -89,20 +85,13 @@ class MobileForgotPasswordPage extends StatelessWidget {
|
|||||||
onPressed:
|
onPressed:
|
||||||
viewModel.isEmailValid
|
viewModel.isEmailValid
|
||||||
? () async {
|
? () async {
|
||||||
Navigator.push(
|
await viewModel.forgotPassword(context);
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder:
|
|
||||||
(context) =>
|
|
||||||
const ForgotPasswordOtpScreen(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
context.pop();
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
ForgotPasswordStrings.backToSignInButton,
|
ForgotPasswordStrings.backToSignInButton,
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:tm_app/core/routes/app_routes.dart';
|
||||||
import 'package:tm_app/core/utils/size_config.dart';
|
import 'package:tm_app/core/utils/size_config.dart';
|
||||||
import 'package:tm_app/views/forget_password_otp.dart/pages/forgot_password_otp_screen.dart';
|
|
||||||
|
|
||||||
import '../../../core/constants/assets.dart';
|
import '../../../core/constants/assets.dart';
|
||||||
import '../../../core/theme/colors.dart';
|
import '../../../core/theme/colors.dart';
|
||||||
|
import '../../../core/utils/app_toast.dart';
|
||||||
import '../../../view_models/auth_view_model.dart';
|
import '../../../view_models/auth_view_model.dart';
|
||||||
import '../../login/widgets/login_textfield.dart';
|
import '../../login/widgets/login_textfield.dart';
|
||||||
import '../../shared/base_button.dart';
|
import '../../shared/base_button.dart';
|
||||||
@@ -20,6 +20,17 @@ class TabletForgotPasswordPage extends StatelessWidget {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: Consumer<AuthViewModel>(
|
body: Consumer<AuthViewModel>(
|
||||||
builder: (context, viewModel, _) {
|
builder: (context, viewModel, _) {
|
||||||
|
if (viewModel.successMessage != null) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
AppToast.success(context, viewModel.successMessage!);
|
||||||
|
const ForgotPasswordOtpRouteData().push(context);
|
||||||
|
});
|
||||||
|
} else if (viewModel.errorMessage != null) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
AppToast.error(context, viewModel.errorMessage!);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return Center(
|
return Center(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 364,
|
width: 364,
|
||||||
@@ -54,14 +65,6 @@ class TabletForgotPasswordPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 40.0.h()),
|
SizedBox(height: 40.0.h()),
|
||||||
// LoginTextField(
|
|
||||||
// controller: viewModel.emailController,
|
|
||||||
// focusNode: viewModel.emailFocus,
|
|
||||||
// label: ForgotPasswordStrings.usernameHint,
|
|
||||||
// iconPath: AssetsManager.userIcon,
|
|
||||||
// isPassword: false,
|
|
||||||
// ),
|
|
||||||
// SizedBox(height: 24.0.h()),
|
|
||||||
LoginTextField(
|
LoginTextField(
|
||||||
controller: viewModel.emailController,
|
controller: viewModel.emailController,
|
||||||
focusNode: viewModel.emailFocus,
|
focusNode: viewModel.emailFocus,
|
||||||
@@ -69,13 +72,6 @@ class TabletForgotPasswordPage extends StatelessWidget {
|
|||||||
isPassword: false,
|
isPassword: false,
|
||||||
),
|
),
|
||||||
SizedBox(height: 24.0.h()),
|
SizedBox(height: 24.0.h()),
|
||||||
// LoginTextField(
|
|
||||||
// controller: viewModel.emailController,
|
|
||||||
// focusNode: viewModel.emailFocus,
|
|
||||||
// label: ForgotPasswordStrings.companyIdHint,
|
|
||||||
// isPassword: false,
|
|
||||||
// ),
|
|
||||||
// SizedBox(height: 70.0.h()),
|
|
||||||
viewModel.isLoading
|
viewModel.isLoading
|
||||||
? const BaseButton(
|
? const BaseButton(
|
||||||
isEnabled: false,
|
isEnabled: false,
|
||||||
@@ -88,22 +84,14 @@ class TabletForgotPasswordPage extends StatelessWidget {
|
|||||||
onPressed:
|
onPressed:
|
||||||
viewModel.isEmailValid
|
viewModel.isEmailValid
|
||||||
? () async {
|
? () async {
|
||||||
Navigator.push(
|
await viewModel.forgotPassword(context);
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder:
|
|
||||||
(context) =>
|
|
||||||
const ForgotPasswordOtpScreen(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
|
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
context.pop();
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
ForgotPasswordStrings.backToSignInButton,
|
ForgotPasswordStrings.backToSignInButton,
|
||||||
|
|||||||
@@ -102,20 +102,20 @@ class _LoginMobilePageState extends State<LoginMobilePage> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
// SizedBox(height: 32.0.h()),
|
SizedBox(height: 32.0.h()),
|
||||||
// TextButton(
|
TextButton(
|
||||||
// onPressed: () {
|
onPressed: () {
|
||||||
// ForgotPasswordRouteData().push(context);
|
const ForgotPasswordRouteData().push(context);
|
||||||
// },
|
},
|
||||||
// child: Text(
|
child: Text(
|
||||||
// LoginStrings.forgotPassword,
|
LoginStrings.forgotPassword,
|
||||||
// style: TextStyle(
|
style: TextStyle(
|
||||||
// fontSize: 14.0.sp(),
|
fontSize: 14.0.sp(),
|
||||||
// fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
// color: AppColors.mainBlue,
|
color: AppColors.mainBlue,
|
||||||
// ),
|
),
|
||||||
// ),
|
),
|
||||||
// ),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user