The Problem is When I Run the App and its for example Home Screen then I have two options signup and login when I press login it takes me to its screen and its fine but after like 3 secs without pressing any button it switches back to signup screen on its own so what is happening here I made sure the login has no connection withe the signup screen and here is the code for Home Screen `
import 'package:flutter/widgets.dart';
import '../../core/app_export.dart';
import '../../theme/custom_button_style.dart';
import '../../widgets/custom_elevated_button.dart';
import 'bloc/home_bloc.dart';
import 'models/home_model.dart';
class HomeScreen extends StatelessWidget {
const HomeScreen({Key? key})
: super(
key: key,
);
static Widget builder(BuildContext context) {
return BlocProvider<HomeBloc>(
create: (context) => HomeBloc(HomeState(
homeModelObj: HomeModel(),
))
..add(HomeInitialEvent()),
child: HomeScreen(),
);
}
@override
Widget build(BuildContext context) {
return BlocBuilder<HomeBloc, HomeState>(
builder: (context, state) {
return SafeArea(
child: Scaffold(
backgroundColor: theme.colorScheme.onError,
//
body: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(
horizontal: 19.h,
vertical: 77.v,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Spacer(),
CustomImageView(
imagePath: ImageConstant.imgKindergartenStudentAmico,
height: 365.v,
width: 391.h,
margin: EdgeInsets.only(
bottom: 24.0,
),
),
SizedBox(height: 4.v),
Container(
width: 246.h,
margin: EdgeInsets.only(bottom: 48.0),
child: Text(
"msg3".tr,
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: CustomTextStyles.headlineLargeSemiBold,
),
),
SizedBox(height: 10.v),
CustomElevatedButton(
height: 60.v,
text: "lbl13".tr,
margin: EdgeInsets.only(
left: 24.h,
right: 24.h,
bottom: 16.0,
),
buttonStyle: ElevatedButton.styleFrom(
backgroundColor: Color.fromRGBO(157, 216, 159,1)),
buttonTextStyle: CustomTextStyles.headlineMediumOnErrorBold,
onPressed: () {
onTaptf(context);
},
),
SizedBox(height: 10.v),
CustomElevatedButton(
height: 60.v,
text: "lbl14".tr,
margin: EdgeInsets.only(
left: 24.h,
right: 24.h,
),
buttonStyle: ElevatedButton.styleFrom(
backgroundColor: Color.fromRGBO(157, 216, 159,1)),
// buttonStyle: ,
buttonTextStyle: CustomTextStyles.headlineMediumOnErrorBold,
onPressed: () {
onTaptf1(context);
},
)
],
),
),
// ),
),
);
},
);
}
/// Navigates to the logInScreen when the action is triggered.
onTaptf(BuildContext context) {
NavigatorService.pushNamed(
AppRoutes.logInScreen,
);
}
/// Navigates to the logInScreen when the action is triggered.
onTaptf1(BuildContext context) {
NavigatorService.pushNamed(
AppRoutes.signUpScreen,
);
}
}
code login screen
import '../../core/app_export.dart';
// import '../../widgets/custom_text_form_field.dart';
import '../../widgets/custom_elevated_button.dart';
import 'bloc/log_in_bloc.dart';
import 'models/log_in_model.dart';
class LogInScreen extends StatelessWidget {
const LogInScreen({Key? key})
: super(
key: key,
);
static Widget builder(BuildContext context) {
return BlocProvider<LogInBloc>(
create: (context) => LogInBloc(LogInState(
logInModelObj: LogInModel(),
))
..add(LogInInitialEvent()),
child: LogInScreen(),
);
}
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
backgroundColor: theme.colorScheme.onError,
resizeToAvoidBottomInset: false,
body: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(
horizontal: 24.h,
vertical: 42.v,
),
child: Column(
children: [
_buildLoginRowArrowDown(context),
Spacer(
flex: 47,
),
SizedBox(height: 22.v),
_buildColumnEmail(context),
SizedBox(height: 6.v),
_buildColumnPassword(context),
SizedBox(height: 43.v),
Spacer(
flex: 52,
),
SizedBox(height: 98.v),
_buildLoginStackView(context)
],
),
),
),
);
}
/// Section Widget
Widget _buildLoginRowArrowDown(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CustomImageView(
imagePath: ImageConstant.imgArrowDown,
height: 21.adaptSize,
width: 21.adaptSize,
margin: EdgeInsets.only(
top: 18.v,
bottom: 24.v,
),
onTap: () {
onTapImgArrowdownone(context);
},
),
Container(
width: 195.h,
margin: EdgeInsets.only(left: 162.h),
child: Padding(
padding: EdgeInsets.only(top: 8),
child:Text(
"lbl13".tr,
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: theme.textTheme.headlineLarge,
),
),
),
],
);
}
/// Section Widget
Widget _buildLoginStackView(BuildContext context) {
return GestureDetector(
onTap: () {
onTapLoginStackView(context);
},
child: SizedBox(
height: 83.v,
width: 345.h,
child: Stack(
alignment: Alignment.topCenter,
children: [
Align(
alignment: Alignment.center,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
CustomElevatedButton(
height: 60.v,
text: "lbl16".tr,
margin: EdgeInsets.only(
left: 24.h,
right: 24.h,
),
buttonStyle: ElevatedButton.styleFrom(
backgroundColor: Color.fromRGBO(157, 216, 159,1),
),
buttonTextStyle: CustomTextStyles.headlineMediumOnErrorBold,
onPressed: () {
onTapLoginStackView(context);
},
),
],
),
),
],
),
),
);
}
/// Navigates to the homeScreen when the action is triggered.
onTapImgArrowdownone(BuildContext context) {
NavigatorService.pushNamed(
AppRoutes.homeScreen,
);
}
/// Navigates to the selectionScreen when the action is triggered.
onTapLoginStackView(BuildContext context) {
NavigatorService.pushNamed(
AppRoutes.selectionScreen,
);
}
Widget _buildColumnEmail(BuildContext context) {
return Padding(
padding: EdgeInsets.only(
left: 9.h,
right: 5.h,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Padding(
padding: EdgeInsets.only(right: 5.h),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
SizedBox(
width: 178.h,
child: Text(
"msg4".tr,
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: theme.textTheme.headlineMedium,
),
),
CustomImageView(
imagePath: ImageConstant.imgVectorBlack900,
height: 19.v,
width: 23.h,
margin: EdgeInsets.only(
left: 12.h,
top: 22.v,
bottom: 18.v,
),
)
],
),
),
SizedBox(height: 2.v),
BlocSelector<LogInBloc, LogInState, TextEditingController?>(
selector: (state) => state.edittextoneController,
builder: (context, edittextoneController) {
return TextField(
controller: edittextoneController,
textInputAction: TextInputAction.done,
style: TextStyle(
color: Colors.black,
fontSize:
16.0, // Adjust other text style properties as needed
),
cursorColor: Color.fromARGB(
255, 0, 0, 0), // Set the same style as CustomTextFormField
decoration: InputDecoration(
// Add any additional decoration properties here
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(20.0),
),
fillColor: Colors.grey[200],
filled: true,
),
// fillColor: Colors.grey[200], // Set the box color here
);
},
),
],
),
);
}
/// Section Widget
Widget _buildColumnPassword(BuildContext context) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 6.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Padding(
padding: EdgeInsets.only(right: 13.h),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
SizedBox(
width: 129.h,
child: Text(
"lbl15".tr,
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: theme.textTheme.headlineMedium,
),
),
CustomImageView(
imagePath: ImageConstant.imgLocation,
height: 25.v,
width: 15.h,
margin: EdgeInsets.only(
left: 11.h,
top: 19.v,
bottom: 14.v,
),
)
],
),
),
BlocSelector<LogInBloc, LogInState, TextEditingController?>(
selector: (state) => state.edittextController,
builder: (context, edittextController) {
return TextField(
controller: edittextController,
textInputAction: TextInputAction.done,
style: TextStyle(
color: Colors.black,
fontSize:
16.0, // Adjust other text style properties as needed
),
cursorColor: Color.fromARGB(
255, 0, 0, 0), // Set the same style as CustomTextFormField
decoration: InputDecoration(
// Add any additional decoration properties here
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(20.0),
),
fillColor: Colors.grey[200],
filled: true,
),
// fillColor: Colors.grey[200], // Set the box color here
);
},
),
],
),
);
}
}
so what is happening this just the code of the design no database attached yet
well I tried removing the app navigation file from the routes as I can’t see it used any where but it didn’t solve the problem and it didn’t affect any thing bad or good so I don’t know what to to