Flutter showing error while using InkeWell (dirty State) - flutter

My Flutter project ain't working, as I used a inkwell for a text, so that when the user clicks on the text it Navigates to another page,and it gets error saying dirty state whenever I try to run it,
const SizedBox(width: 167.5),
InkWell(
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: ((context) => const PopAnime()))),
child: const Text(
"See all >",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
fontSize: 15),
),
),
]),
[][1

InkWell(
onTap: () => Navigator.of(context).push(
MaterialPageRoute(
builder: ((context) => const PopAnime()),
),
),
child: const Text(
"See all >",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
fontSize: 15,
),
),
)
you can use navigator like this

Related

why i can not navigate to another screen the text button is working but i can't navigate

why i can not navigate to another screen the text button is working but i can't navigate
TextButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => Status()),
);
},
child: Text(
'STATUS',
style: TextStyle(
fontSize: 20,
color: Colors.white,
),
),
),

Firebase Auth systems stopped working after signOut

I was making a profile page. I also added a "Logout" button to the profile page.
The codes are as follows:
InkWell(
child: ListView(
shrinkWrap: true,
children: [
ListTile(
leading: Icon(Icons.person, color: Colors.black,),
title: Text("Profile", style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold, color: Colors.black),),
onTap: () {
//Navigator.push(context, MaterialPageRoute(builder: (context) => profileScreen()));
},
),
ListTile(
leading: Icon(Icons.settings, color: Colors.black,),
title: Text("Settings", style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold, color: Colors.black),),
onTap: () {
//Navigator.push(context, MaterialPageRoute(builder: (context) => settingsScreen()));
},
),
ListTile(
leading: Icon(Icons.exit_to_app, color: Colors.black,),
title: Text("Logout", style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold, color: Colors.black),),
onTap: () {
FirebaseAuth.instance.signOut(); // !!!!!!!!!!!!<<<<<<<
},
),
],
),
onTap: () {
print("clicked");
},
),
Console:
W/System (31904): Ignoring header X-Firebase-Locale because its value was null.
When I press the ListTile with "Logout" written FirebaseAuth.instance.signOut(); the code would work. I pressed it and my access to the account was cut off. It also gave a few errors but those errors were normal errors anyway.
Then I tried to login to the account again, I couldn't. It gave an error other than password and email errors.
Apart from these, functions such as registration and forgot password do not work.
What could have caused this problem? How can I solve it? Thanks in advance for your help.

The named parameter 'onTap' isn't defined in my code

I currently learning Flutter and I'm very new to it. I wanted to go to another page when tap on this text but my bad it gives me this error.
return Expanded(
flex: 1,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
GestureDetector(
oneTap: () { // i got error here
Navigator.push(context, MaterialPageRoute(builder: (context) => SingUpPage()));
},
child: Text(
'Sing up',
style: GoogleFonts.openSans(
fontSize: 18,
fontWeight: FontWeight.w700,
decoration: TextDecoration.underline),
),
),
Text(
'Forgot Password',
style: GoogleFonts.openSans(
fontSize: 18,
fontWeight: FontWeight.w700,
decoration: TextDecoration.underline),
)
],
),
);
}
You are making a typo/mistake on oneTap, change it to onTap.
you mean "onTap" not "oneTap"
onTap: () { // <--- this one
Navigator.push(context, MaterialPageRoute(builder: (context) => SingUpPage()));
}
Rename onTap instead of oneTap
onTap: () { // here change needed
Navigator.push(context, MaterialPageRoute(builder: (context) => SingUpPage()));
},

Why does my CupertinoActionSheet appear from the top?

Everything works fine, it's just that the sheet appears at the top instead of the bottom. I would like the cupertinoactionsheet to appear from the bottom as default.
I'm currently using an Android emulator but I doubt it's the reason why the sheet is appearing from the top.
Attached is my code
Future<bool> showReportDialog({
#required BuildContext context,
}) async {
return showCupertinoDialog(
context: context,
builder: (context) => CupertinoActionSheet(
title: const Text('Make Your Space Safe',
style: TextStyle(
fontSize: 18, color: Colors.black, fontWeight: FontWeight.w600)),
message: const Text('What to report this user for?',
style: TextStyle(
fontSize: 16.5,
color: Colors.black38,
fontWeight: FontWeight.w500)),
actions: <CupertinoActionSheetAction>[
CupertinoActionSheetAction(
child: const Text(
'Scam',
),
onPressed: () {
afterReport();
print("Reported user for SCAM");
},
),
CupertinoActionSheetAction(
child: const Text('Bots/Spam'),
onPressed: () {
afterReport();
print("Reported user for BOTS/SPAM");
},
),
CupertinoActionSheetAction(
child: const Text('Sexually harassing'),
onPressed: () {
afterReport();
print("Reported user for SEXUALLY HARASSSING");
},
),
CupertinoActionSheetAction(
child: const Text('Offensive/abusive behaviour'),
onPressed: () {
afterReport();
print('Reported user for OFFENSIVE/ABUSIVE BEHAVIOUR');
},
),
CupertinoActionSheetAction(
child: const Text('I want to write more',
style: TextStyle(fontWeight: FontWeight.bold)),
onPressed: () {
Navigator.push(
context,
new MaterialPageRoute(
builder: (BuildContext context) => ReportUser()));
},
),
CupertinoActionSheetAction(
child: const Text('Cancel'),
onPressed: () {
Navigator.pop(context);
},
)
],
),
);
}
You need to use showCupertinoModalPopup instead of showCupertinoDialog:
showCupertinoModalPopup(
context: context,
builder: (context) => CupertinoActionSheet(
title: const Text('Make Your Space Safe',
style: TextStyle(
fontSize: 18,
color: Colors.black,
fontWeight: FontWeight.w600)),
...

is it possible to navigate/move to a different screen by using GestureDetector and class name?

hello i have a container that says "lets Get Started" at the bottom of the introductory screen , is it possible to move the user to login page by detecting the tap and then moving user to the login page by using class name of the login page ?
: GestureDetector(
onTap: (){
print("Container clicked");
},
child : Container(
alignment: Alignment.center,
width: MediaQuery.of(context).size.width,
height: Platform.isIOS ? 70 : 60,
//-----------------------------------
//last screen get started box color
color: Colors.blue,
child: Text(
"GET STARTED NOW",
style: TextStyle(
//last screen get started text
color: Colors.white,
fontWeight: FontWeight.w600,
),
),
),
)
Just add this for your on tap with login class name
onTap: () => Navigator.of(context).push(new MaterialPageRoute(
builder: (BuildContext context) => new LoginPage())), //your login class name
You just need to pass your class name which you want to navigate just replace this class name to LoginScreen()
GestureDetector(
onTap: () {
print("Container clicked");
Navigator.pushReplacement(
context, MaterialPageRoute(builder: (_) => LoginScreen()));
},
child: Container(
alignment: Alignment.center,
width: MediaQuery.of(context).size.width,
color: Colors.blue,
child: Text(
"GET STARTED NOW",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w600,
),
),
),
),