import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:securify/Components/wrapper.dart'; class Verify extends StatefulWidget { const Verify({super.key}); @override State createState() => _VerifyState(); } class _VerifyState extends State { @override void initState() { sendverifylink(); super.initState(); } sendverifylink() async { final user = FirebaseAuth.instance.currentUser!; await user.sendEmailVerification().then((value) => { Get.snackbar('link Sent', 'A link has been send to your email', margin: const EdgeInsets.all(30), snackPosition: SnackPosition.TOP) }); } reload() async { await FirebaseAuth.instance.currentUser! .reload() .then((value) => {Get.offAll(const Wrapper())}); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( backgroundColor: const Color(0xFF6F94FC), title: const Text("Verification", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 27)), ), body: Padding( padding: const EdgeInsets.all(25.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ SvgPicture.asset( 'assets/images/mail_sent.svg', width: 300, height: 250, ), const Text( 'Check your email and click the link to verify & reload this page.', style: TextStyle( fontSize: 17, fontWeight: FontWeight.w500, fontStyle: FontStyle.italic), textAlign: TextAlign.center, ), ], ), ), floatingActionButton: FloatingActionButton( backgroundColor: const Color(0xFF6F94FC), onPressed: (() => reload()), child: const Icon(Icons.restart_alt_rounded), ), ); } }