forked from eatvio/eatvio_app
Successfully passsed data between screens and imported UserRegistrationSheet for all screens
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
|
||||
import 'bloc/credentials_bloc.dart';
|
||||
import 'models/credentials_model.dart';
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
@@ -6,21 +5,22 @@ 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';
|
||||
|
||||
class CredentialsScreen extends StatelessWidget {
|
||||
const CredentialsScreen({Key? key}) : super(key: key);
|
||||
|
||||
static Widget builder(BuildContext context) {
|
||||
final sheet =
|
||||
ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
|
||||
return BlocProvider<CredentialsBloc>(
|
||||
create: (context) => CredentialsBloc(CredentialsState(
|
||||
credentialsModelObj: CredentialsModel(
|
||||
userRegistrationSheet: ModalRoute.of(context)!
|
||||
.settings
|
||||
.arguments as UserRegistrationSheet)))
|
||||
..add(CredentialsInitialEvent()),
|
||||
child: CredentialsScreen());
|
||||
create: (context) => CredentialsBloc(
|
||||
CredentialsState(
|
||||
credentialsModelObj: CredentialsModel(userRegistrationSheet: sheet),
|
||||
),
|
||||
)..add(CredentialsInitialEvent()),
|
||||
child: CredentialsScreen(),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -90,12 +90,27 @@ class CredentialsScreen extends StatelessWidget {
|
||||
textInputAction: TextInputAction.done);
|
||||
}),
|
||||
Spacer(),
|
||||
NextStepButton(
|
||||
text: "continue".tr.toUpperCase(),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: () {
|
||||
navigateToName(context);
|
||||
}),
|
||||
BlocBuilder<CredentialsBloc, CredentialsState>(
|
||||
builder: (context, state) {
|
||||
return NextStepButton(
|
||||
text: "continue".tr.toUpperCase(),
|
||||
margin: EdgeInsets.only(
|
||||
left: 16.h, right: 16.h, bottom: 50.v),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: () {
|
||||
UserRegistrationSheet sheet =
|
||||
state.credentialsModelObj!.userRegistrationSheet;
|
||||
sheet.email = state.valueController!.text;
|
||||
sheet.password = state.passwordController!.text;
|
||||
sheet.passwordConfirmation =
|
||||
state.passwordController!.text;
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
AppRoutes.nameScreen,
|
||||
arguments: sheet,
|
||||
);
|
||||
});
|
||||
}),
|
||||
SizedBox(height: 17.v),
|
||||
]))));
|
||||
}
|
||||
@@ -118,11 +133,4 @@ class CredentialsScreen extends StatelessWidget {
|
||||
onTapArrowLeft(BuildContext context) {
|
||||
NavigatorService.goBack();
|
||||
}
|
||||
|
||||
/// Navigates to the weightScreen when the action is triggered.
|
||||
navigateToName(BuildContext context) {
|
||||
NavigatorService.pushNamed(
|
||||
AppRoutes.nameScreen,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user