Files
eatvio_app/lib/presentation/app_navigation_screen/app_navigation_screen.dart

252 lines
8.9 KiB
Dart

import 'bloc/app_navigation_bloc.dart';
import 'models/app_navigation_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:flutter/material.dart';
class AppNavigationScreen extends StatefulWidget {
const AppNavigationScreen({Key? key})
: super(
key: key,
);
static Widget builder(BuildContext context) {
return BlocProvider<AppNavigationBloc>(
create: (context) => AppNavigationBloc(AppNavigationState(
appNavigationModelObj: AppNavigationModel(),
))
..add(AppNavigationInitialEvent()),
child: AppNavigationScreen(),
);
}
@override
State<AppNavigationScreen> createState() => _AppNavigationScreenState();
}
class _AppNavigationScreenState extends State<AppNavigationScreen> {
@override
Widget build(BuildContext context) {
mediaQueryData = MediaQuery.of(context);
return BlocBuilder<AppNavigationBloc, AppNavigationState>(
builder: (context, state) {
return SafeArea(
child: Scaffold(
backgroundColor: Color(0XFFFFFFFF),
body: SizedBox(
width: double.maxFinite,
child: Column(
children: [
_buildAppNavigation(context),
Expanded(
child: SingleChildScrollView(
child: Container(
decoration: BoxDecoration(
color: Color(0XFFFFFFFF),
),
child: Column(
children: [
_buildScreenTitle(
context,
screenTitle: "date_of_birth".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.dateOfBirthScreen),
),
_buildScreenTitle(
context,
screenTitle: "city_of_living".tr,
onTapScreenTitle: () => onTapScreenTitle(
AppRoutes.cityOfLivingScreen),
),
_buildScreenTitle(
context,
screenTitle: "body_circumferences".tr,
onTapScreenTitle: () => onTapScreenTitle(
AppRoutes.bodyCircumferencesScreen),
),
_buildScreenTitle(
context,
screenTitle: "weight".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.weightScreen),
),
_buildScreenTitle(
context,
screenTitle: "allergies".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.allergiesScreen),
),
_buildScreenTitle(
context,
screenTitle: "medicine_intake".tr,
onTapScreenTitle: () => onTapScreenTitle(
AppRoutes.medicineIntakeScreen),
),
_buildScreenTitle(
context,
screenTitle: "splash_screen".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.splashScreen),
),
_buildScreenTitle(
context,
screenTitle: "gender".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.genderScreen),
),
_buildScreenTitle(
context,
screenTitle: "blood_pressure".tr,
onTapScreenTitle: () => onTapScreenTitle(
AppRoutes.bloodPressureScreen),
),
_buildScreenTitle(
context,
screenTitle: "favorite_sports".tr,
onTapScreenTitle: () => onTapScreenTitle(
AppRoutes.favoriteSportsScreen),
),
_buildScreenTitle(
context,
screenTitle: "favorite_foods".tr,
onTapScreenTitle: () => onTapScreenTitle(
AppRoutes.favoriteFoodsScreen),
),
_buildScreenTitle(
context,
screenTitle: "schedule".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.scheduleScreen),
),
_buildScreenTitle(
context,
screenTitle: "additional_information".tr,
onTapScreenTitle: () => onTapScreenTitle(
AppRoutes.additionalInformationScreen),
),
_buildScreenTitle(
context,
screenTitle: "language_select".tr,
onTapScreenTitle: () => onTapScreenTitle(
AppRoutes.languageSelectScreen),
),
],
),
),
),
),
],
),
),
),
);
},
);
}
/// Section Widget
Widget _buildAppNavigation(BuildContext context) {
return Container(
decoration: BoxDecoration(
color: Color(0XFFFFFFFF),
),
child: Column(
children: [
SizedBox(height: 10.v),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 20.h),
child: Text(
"App Navigation".tr,
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0XFF000000),
fontSize: 20.fSize,
fontFamily: 'Roboto',
fontWeight: FontWeight.w400,
),
),
),
),
SizedBox(height: 10.v),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: EdgeInsets.only(left: 20.h),
child: Text(
"Check your app's UI from the below demo screens of your app."
.tr,
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0XFF888888),
fontSize: 16.fSize,
fontFamily: 'Roboto',
fontWeight: FontWeight.w400,
),
),
),
),
SizedBox(height: 5.v),
Divider(
height: 1.v,
thickness: 1.v,
color: Color(0XFF000000),
),
],
),
);
}
/// Common widget
Widget _buildScreenTitle(
BuildContext context, {
required String screenTitle,
Function? onTapScreenTitle,
}) {
return GestureDetector(
onTap: () {
onTapScreenTitle!.call();
},
child: Container(
decoration: BoxDecoration(
color: Color(0XFFFFFFFF),
),
child: Column(
children: [
SizedBox(height: 10.v),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 20.h),
child: Text(
screenTitle,
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0XFF000000),
fontSize: 20.fSize,
fontFamily: 'Roboto',
fontWeight: FontWeight.w400,
),
),
),
),
SizedBox(height: 10.v),
SizedBox(height: 5.v),
Divider(
height: 1.v,
thickness: 1.v,
color: Color(0XFF888888),
),
],
),
),
);
}
/// Common click event
void onTapScreenTitle(String routeName) {
NavigatorService.pushNamed(routeName);
}
}