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.
Related
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
I'm building an flutter web app and came across this issue.
I have a text field in an alert dialog.
It works perfectly in my laptop, but the alert dialog is unstable in my mobile.
Here's my code. How can I fix this?
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: const Text('Add Tag'),
content: TextField(
controller: tagController,
decoration: InputDecoration(
hintText: 'Type here',
suffix: IconButton(
icon: const Icon(
Icons.clear,
size: 16,
),
onPressed: () {
tagController.clear();
},
),
),
),
actions: [
TextButton(
onPressed: () {
setState(() {
Navigator.pop(
context);
});
},
child: const Text(
'Cancel',
style: TextStyle(
color:
Colors.red),
)),
TextButton(
onPressed: () async {
},
child: const Text(
'OK',
style: TextStyle(
color:
Colors.green),
))
],
);
});
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()));
},
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)),
...
I have a row with a text saying terms of use and a button. I want to show some data but perhaps I'm not using the correct keywords. All I'm getting is how to change a text on button click.
Anyway, what should I do to let the user see the terms of use on button click?
Container(
padding: EdgeInsets.only(top: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
"Terms of Use",
style: TextStyle(
color: Color(0xff18172b),
fontSize: 18,
fontFamily: "Poppins",
fontWeight: FontWeight.w400,
),
),
IconButton(
iconSize: 18,
onPressed: () {},
icon: Icon(Icons.arrow_forward_ios))
],
),
),
you can navigate to another page that hold the Terms or show modal like this :
IconButton(
iconSize: 18,
onPressed: () async {
await showDialog(
barrierColor: Colors.black12.withOpacity(.6),
context: context,
builder: (_) {
return Dialog(
elevation: 0,
backgroundColor: Colors.transparent,
child: Container(
child: Text("TERMS"),
),
);
});
},
icon: Icon(Icons.arrow_forward_ios))