|
|
@@ -0,0 +1,101 @@
|
|
|
+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
|
|
|
+ Widget build(BuildContext context) {
|
|
|
+ final arguments = (ModalRoute.of(context)?.settings.arguments ??
|
|
|
+ <String, dynamic>{}) as Map;
|
|
|
+ print('******' + arguments['id']);
|
|
|
+
|
|
|
+ //getting info of the user one by one
|
|
|
+ FirebaseFirestore.instance.collection('profileInfo').doc(arguments['id'])
|
|
|
+ .get().then((DocumentSnapshot) {
|
|
|
+ name = DocumentSnapshot.get('name').toString();
|
|
|
+ });
|
|
|
+ FirebaseFirestore.instance.collection('profileInfo').doc(arguments['id'])
|
|
|
+ .get().then((DocumentSnapshot) {
|
|
|
+ surname = DocumentSnapshot.get('surname').toString();
|
|
|
+ });
|
|
|
+ FirebaseFirestore.instance.collection('profileInfo').doc(arguments['id'])
|
|
|
+ .get().then((DocumentSnapshot) {
|
|
|
+ birth_date = DocumentSnapshot.get('birth_date').toString();
|
|
|
+ });
|
|
|
+ FirebaseFirestore.instance.collection('profileInfo').doc(arguments['id'])
|
|
|
+ .get().then((DocumentSnapshot) {
|
|
|
+ mail = DocumentSnapshot.get('mail').toString();
|
|
|
+ });
|
|
|
+ FirebaseFirestore.instance.collection('profileInfo').doc(arguments['id'])
|
|
|
+ .get().then((DocumentSnapshot) {
|
|
|
+ shared_id = DocumentSnapshot.get('shared_id').toString();
|
|
|
+ });
|
|
|
+ FirebaseFirestore.instance.collection('profileInfo').doc(arguments['id'])
|
|
|
+ .get().then((DocumentSnapshot) {
|
|
|
+ phone_number = DocumentSnapshot.get('phone_number').toString();
|
|
|
+ });
|
|
|
+ FirebaseFirestore.instance.collection('profileInfo').doc(arguments['id'])
|
|
|
+ .get().then((DocumentSnapshot) {
|
|
|
+ anonymous = DocumentSnapshot.get('anonymous').toString();
|
|
|
+ });
|
|
|
+ FirebaseFirestore.instance.collection('profileInfo').doc(arguments['id'])
|
|
|
+ .get().then((DocumentSnapshot) {
|
|
|
+ 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'),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+}
|