Encrypted messaging app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
4.4 KiB

  1. import 'package:flutter/material.dart';
  2. import 'package:shared_preferences/shared_preferences.dart';
  3. import '/utils/storage/encryption_keys.dart';
  4. import '/utils/storage/database.dart';
  5. class Profile extends StatefulWidget {
  6. const Profile({Key? key}) : super(key: key);
  7. @override
  8. State<Profile> createState() => _ProfileState();
  9. }
  10. class _ProfileState extends State<Profile> {
  11. @override
  12. Widget build(BuildContext context) {
  13. return Scaffold(
  14. body: SingleChildScrollView(
  15. physics: const BouncingScrollPhysics(),
  16. child: Column(
  17. crossAxisAlignment: CrossAxisAlignment.start,
  18. children: <Widget>[
  19. SafeArea(
  20. child: Padding(
  21. padding: const EdgeInsets.only(left: 16,right: 16,top: 10),
  22. child: Row(
  23. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  24. children: <Widget>[
  25. const Text("Profile",style: TextStyle(fontSize: 32,fontWeight: FontWeight.bold),),
  26. Container(
  27. padding: const EdgeInsets.only(left: 8,right: 8,top: 2,bottom: 2),
  28. height: 30,
  29. decoration: BoxDecoration(
  30. borderRadius: BorderRadius.circular(30),
  31. color: Colors.pink[50],
  32. ),
  33. child: GestureDetector(
  34. onTap: () async {
  35. deleteDb();
  36. final preferences = await SharedPreferences.getInstance();
  37. preferences.setBool('islogin', false);
  38. preferences.remove(rsaPrivateKeyName);
  39. Navigator.pushNamedAndRemoveUntil(context, '/landing', ModalRoute.withName('/landing'));
  40. },
  41. child: Row(
  42. children: const <Widget>[
  43. Icon(Icons.logout, color: Colors.pink, size: 20,),
  44. SizedBox(width: 2,),
  45. Text("Logout",style: TextStyle(fontSize: 14,fontWeight: FontWeight.bold),),
  46. ],
  47. ),
  48. ),
  49. )
  50. ],
  51. ),
  52. ),
  53. ),
  54. const Padding(
  55. padding: EdgeInsets.only(top: 16,left: 16,right: 16),
  56. child: Text('Test'),
  57. ),
  58. ],
  59. ),
  60. ),
  61. );
  62. }
  63. }