| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- import 'package:cloud_firestore/cloud_firestore.dart';
- import 'package:flutter/material.dart';
- class ProfilePage extends StatefulWidget {
- const ProfilePage({Key? key, required this.title}) : super(key: key);
- final String title;
- @override
- //_RegisterScreen createState() => _RegisterScreen();
- State<ProfilePage> createState() => _ProfilePage();
- }
- class _ProfilePage extends State<ProfilePage> {
- String name = '', surname = '', birth_date = '', mail = '', shared_id = '',
- phone_number = '', anonymous = '', address = '';
- @override
- void initState() {
- super.initState();
- }
- @override
- Widget build(BuildContext context) {
- final arguments = (ModalRoute.of(context)?.settings.arguments ??
- <String, dynamic>{}) as Map;
- FirebaseFirestore.instance.collection('Users').doc(arguments['id'])
- .get().then((DocumentSnapshot) {
- name = DocumentSnapshot.get('name').toString();
- surname = DocumentSnapshot.get('surname').toString();
- birth_date = DocumentSnapshot.get('birth_date').toString();
- mail = DocumentSnapshot.get('mail').toString();
- shared_id = DocumentSnapshot.get('shared_id').toString();
- phone_number = DocumentSnapshot.get('phone_number').toString();
- anonymous = DocumentSnapshot.get('anonymous').toString();
- address = DocumentSnapshot.get('address').toString();
- });
- return Scaffold(
- appBar: AppBar(title: const Text('Profile Page')),
- body: Center(
- child: SizedBox(
- width: 300,
- child: Column(
- children: [
- const SizedBox(height: 30),
- Text(
- 'Personal Information',
- style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
- ),
- const SizedBox(height: 30),
- Image.asset(
- 'assets/user.png',
- width: 150,
- ),
- const SizedBox(height: 30),
- Text('Name: ' + name + ' ' + surname),
- const SizedBox(height: 10),
- Text('Birth Date: ' + birth_date),
- const SizedBox(height: 10),
- Text('Username: ' + shared_id),
- const SizedBox(height: 10),
- Text('Mail: ' + mail),
- const SizedBox(height: 10),
- Text('Phone: ' + phone_number),
- const SizedBox(height: 10),
- Text('Address: ' + address),
- const SizedBox(height: 10),
- Text('Anonymous: ' + anonymous),
- const SizedBox(height: 30),
- ElevatedButton(
- onPressed: () {
- setState(() {});
- },
- child: const Text('Refresh'),
- ),
- ],
- ),
- ),
- ),
- );
- }
- }
|