forked from eatvio/eatvio_app
feature(registration): fix analyzer
This commit is contained in:
@@ -1,14 +1,7 @@
|
||||
import 'package:eatvio_app/app_router.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import 'bloc/name_bloc.dart';
|
||||
import 'models/name_model.dart';
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart';
|
||||
import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart';
|
||||
import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart';
|
||||
import 'package:eatvio_app/widgets/next_step_button.dart';
|
||||
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
|
||||
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -72,57 +65,44 @@ class NameScreen extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
/// Section Widget
|
||||
_buildAppBar(BuildContext context) {
|
||||
return CustomAppBar(
|
||||
leadingWidth: 29.h,
|
||||
leading: AppbarLeadingImage(
|
||||
imagePath: ImageConstant.imgArrowLeft,
|
||||
margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v),
|
||||
onTap: () => onTapArrowLeft(context),
|
||||
),
|
||||
centerTitle: true,
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),
|
||||
);
|
||||
}
|
||||
|
||||
/// Navigates to the previous screen.
|
||||
onTapArrowLeft(BuildContext context) {
|
||||
GoRouter.of(context).pop();
|
||||
}
|
||||
|
||||
_onTapNext(BuildContext context, NameState state) {
|
||||
if (state.firstNameController != null && state.lastNameController != null) {
|
||||
List<String> errors = validateFields(state.firstNameController!.text, state.lastNameController!.text);
|
||||
|
||||
if (errors.isEmpty) {
|
||||
UserRegistrationSheet sheet = state.nameModelObj!.userRegistrationSheet;
|
||||
sheet.firstName = state.firstNameController!.text;
|
||||
sheet.lastName = state.lastNameController!.text;
|
||||
AppRouter.navigatorKey.currentContext?.goNamed('genderScreen', extra: sheet);
|
||||
} else {
|
||||
String errorMessage = '';
|
||||
|
||||
for (var error in errors) {
|
||||
errorMessage += error + '\n\n';
|
||||
}
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text('Error'),
|
||||
content: Text(errorMessage),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => onTapOk(context),
|
||||
child: Text('OK'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
// _onTapNext(BuildContext context, NameState state) {
|
||||
// if (state.firstNameController != null && state.lastNameController != null) {
|
||||
// List<String> errors = validateFields(state.firstNameController!.text, state.lastNameController!.text);
|
||||
//
|
||||
// if (errors.isEmpty) {
|
||||
// UserRegistrationSheet sheet = state.nameModelObj!.userRegistrationSheet;
|
||||
// sheet.firstName = state.firstNameController!.text;
|
||||
// sheet.lastName = state.lastNameController!.text;
|
||||
// AppRouter.navigatorKey.currentContext?.goNamed('genderScreen', extra: sheet);
|
||||
// } else {
|
||||
// String errorMessage = '';
|
||||
//
|
||||
// for (var error in errors) {
|
||||
// errorMessage += error + '\n\n';
|
||||
// }
|
||||
//
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// builder: (context) => AlertDialog(
|
||||
// title: Text('Error'),
|
||||
// content: Text(errorMessage),
|
||||
// actions: [
|
||||
// TextButton(
|
||||
// onPressed: () => onTapOk(context),
|
||||
// child: Text('OK'),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
void onTapOk(BuildContext context) {
|
||||
Navigator.pop(context);
|
||||
|
||||
Reference in New Issue
Block a user