Advertisement
Hevernooo

Больше

Nov 19th, 2024
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 1.64 KB | None | 0 0
  1. import 'package:firebase_auth/firebase_auth.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:plantual_1/utils/utils.dart';
  4. import 'package:plantual_1/ui/auth/signInScreen.dart';
  5.  
  6. class settings extends StatefulWidget {
  7.   const settings({super.key});
  8.  
  9.   @override
  10.   State<settings> createState() => _settingsState();
  11. }
  12.  
  13. class _settingsState extends State<settings> {
  14.  
  15.   final auth = FirebaseAuth.instance;
  16.   @override
  17.   Widget build(BuildContext context) {
  18.     return Column(
  19.         crossAxisAlignment: CrossAxisAlignment.center,
  20.         mainAxisAlignment: MainAxisAlignment.start,
  21.         children: [
  22.           Padding(padding: EdgeInsets.only(top: 20)),
  23.           Text('Ваша почта: ${auth.currentUser!.email.toString()}', style: TextStyle(fontSize: 20),),
  24.           Padding(padding: EdgeInsets.only(top: 20)),
  25.           Text('Ваш UID: ${auth.currentUser!.uid.toString()}', style: TextStyle(fontSize: 20),),
  26.           Padding(padding: EdgeInsets.only(top: 20)),
  27.           Row(
  28.             mainAxisAlignment: MainAxisAlignment.center,
  29.             children: [
  30.               Text('Выйти', style: TextStyle(fontSize: 20),),
  31.               IconButton(
  32.                   onPressed: (){
  33.                     auth.signOut().then((value){
  34.                       Navigator.push(context, MaterialPageRoute(builder: (context) => signInScreen()));
  35.                     }).onError((error, stackTrace){
  36.                       utilsDone().toastMessage(error.toString());
  37.                     });
  38.                   },
  39.                   icon: Icon(Icons.logout, size: 40,)),
  40.             ],
  41.           ),
  42.         ],
  43.       );
  44.   }
  45. }
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement