mirror of https://github.com/evanferrao/mynotes
51 lines
1.5 KiB
Dart
51 lines
1.5 KiB
Dart
import 'package:firebase_auth/firebase_auth.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:mynotes/constants/routes.dart';
|
|
|
|
class VerifyEmailView extends StatefulWidget {
|
|
const VerifyEmailView({super.key});
|
|
|
|
@override
|
|
State<VerifyEmailView> createState() => _VerifyEmailViewState();
|
|
}
|
|
|
|
class _VerifyEmailViewState extends State<VerifyEmailView> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title:
|
|
const Text('Verify Email', style: TextStyle(color: Colors.white)),
|
|
backgroundColor: Colors.blue),
|
|
body: Column(
|
|
children: [
|
|
const Text(
|
|
"we've sent an email to your email address, Please open it to verify your account",
|
|
),
|
|
const Text(
|
|
'If you did not receive the email, please press the button below to resend it.',
|
|
),
|
|
TextButton(
|
|
onPressed: () async {
|
|
final user = FirebaseAuth.instance.currentUser;
|
|
await user?.sendEmailVerification();
|
|
},
|
|
child: const Text('Send verification email',
|
|
style: TextStyle(color: Colors.blue)),
|
|
),
|
|
TextButton(
|
|
onPressed: () async {
|
|
await FirebaseAuth.instance.signOut();
|
|
Navigator.of(context).pushNamedAndRemoveUntil(
|
|
registerRoute,
|
|
(route) => false,
|
|
);
|
|
},
|
|
child: const Text('Restart'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|