forked from eatvio/eatvio_app
sync upsteam #3
@@ -302,7 +302,10 @@ class CreateDietCubit extends Cubit<CreateDietState> {
|
||||
|
||||
Future<String?> createDiet() async {
|
||||
emit(state.copyWith(isDietPublishing: true));
|
||||
if (!_isFromValid()) return 'validation';
|
||||
if (!_isFromValid()) {
|
||||
emit(state.copyWith(isDietPublishing: false));
|
||||
return 'validation';
|
||||
}
|
||||
try {
|
||||
File? file;
|
||||
if (state.dietData.imageUrl != null) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'package:eatvio_app/features/registration_v2/cubit/registration_state.dar
|
||||
import 'package:eatvio_app/features/registration_v2/models/registration_model.dart';
|
||||
import 'package:eatvio_app/features/registration_v2/repositories/registration_repository_v2.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_password_generator/flutter_password_generator.dart';
|
||||
import 'package:gpassword/gpassword.dart';
|
||||
|
||||
class RegistrationCubitV2 extends Cubit<RegistrationStateV2> {
|
||||
final RegistrationRepositoryV2 registrationRepository;
|
||||
@@ -230,9 +230,8 @@ class RegistrationCubitV2 extends Cubit<RegistrationStateV2> {
|
||||
}
|
||||
|
||||
Future<String> _generatePassword() async {
|
||||
final generator = FlutterPasswordGenerator(length: 8);
|
||||
final result = await generator.generatePassword();
|
||||
final password = result['password'] as String;
|
||||
final generator = GPassword();
|
||||
final password = generator.generate(passwordLength: 10);
|
||||
emit(state.copyWith(password: password));
|
||||
return password;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ class _PasswordFieldState extends State<PasswordField> {
|
||||
copied = true;
|
||||
});
|
||||
Future.delayed(const Duration(seconds: 3), () {
|
||||
if (!context.mounted) return;
|
||||
setState(() {
|
||||
copied = false;
|
||||
});
|
||||
|
||||
@@ -77,7 +77,7 @@ dependencies:
|
||||
vk_id: ^1.0.3
|
||||
flutter_login_yandex: ^0.0.5
|
||||
markdown: ^7.3.0
|
||||
flutter_password_generator: ^1.0.3
|
||||
gpassword: ^1.0.0
|
||||
|
||||
dev_dependencies:
|
||||
build_runner: ^2.7.0
|
||||
|
||||
Reference in New Issue
Block a user