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.

68 lines
4.6 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.remove('logged_in_at');
  38. preferences.remove('username');
  39. preferences.remove('userId');
  40. preferences.remove(rsaPrivateKeyName);
  41. Navigator.pushNamedAndRemoveUntil(context, '/landing', ModalRoute.withName('/landing'));
  42. },
  43. child: Row(
  44. children: const <Widget>[
  45. Icon(Icons.logout, color: Colors.pink, size: 20,),
  46. SizedBox(width: 2,),
  47. Text("Logout",style: TextStyle(fontSize: 14,fontWeight: FontWeight.bold),),
  48. ],
  49. ),
  50. ),
  51. )
  52. ],
  53. ),
  54. ),
  55. ),
  56. const Padding(
  57. padding: EdgeInsets.only(top: 16,left: 16,right: 16),
  58. child: Text('Test'),
  59. ),
  60. ],
  61. ),
  62. ),
  63. );
  64. }
  65. }