go router full

This commit is contained in:
mso7nueh
2024-06-06 16:02:39 +03:00
parent 7b55204659
commit 647e9e9133
42 changed files with 483 additions and 1018 deletions

View File

@@ -1,3 +1,5 @@
import 'package:go_router/go_router.dart';
import 'bloc/height_bloc.dart';
import 'models/height_model.dart';
import 'package:eatvio_app/core/app_export.dart';
@@ -14,12 +16,9 @@ class HeightScreen extends StatelessWidget {
const HeightScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
final sheet =
ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
final sheet = ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
return BlocProvider<HeightBloc>(
create: (context) => HeightBloc(HeightState(
heightModelObj: HeightModel(userRegistrationSheet: sheet)))
..add(HeightInitialEvent()),
create: (context) => HeightBloc(HeightState(heightModelObj: HeightModel(userRegistrationSheet: sheet)))..add(HeightInitialEvent()),
child: HeightScreen());
}
@@ -72,8 +71,7 @@ class HeightScreen extends StatelessWidget {
style: theme.textTheme.bodyLarge,
),
SizedBox(height: 4.v),
BlocBuilder<HeightBloc, HeightState>(
builder: (context, state) {
BlocBuilder<HeightBloc, HeightState>(builder: (context, state) {
return CustomTextFormField(
width: 150.h,
textInputAction: TextInputAction.done,
@@ -113,11 +111,7 @@ class HeightScreen extends StatelessWidget {
onTapNext(HeightState state, BuildContext context) {
return () {
UserRegistrationSheet sheet = state.heightModelObj!.userRegistrationSheet;
Navigator.pushNamed(
context,
AppRoutes.bloodPressureScreen,
arguments: sheet,
);
GoRouter.of(context).goNamed('bloodPressureScreen', extra: sheet);
};
}
@@ -125,10 +119,8 @@ class HeightScreen extends StatelessWidget {
_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: onTapBack(context)),
leading:
AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}