update app drawe to show the following

name surname
username
type
This commit is contained in:
2024-07-29 11:38:27 +02:00
parent 0fbede68b1
commit 33088ca1fc
3 changed files with 38 additions and 34 deletions

View File

@@ -3,20 +3,20 @@ import 'package:patient_manager/main.dart';
import 'package:patient_manager/objects/appUser.dart'; import 'package:patient_manager/objects/appUser.dart';
import 'package:supertokens_flutter/supertokens.dart'; import 'package:supertokens_flutter/supertokens.dart';
class PatManAppDrawer extends StatefulWidget { class MIHAppDrawer extends StatefulWidget {
final AppUser signedInUser; final AppUser signedInUser;
final Image logo; final Image logo;
const PatManAppDrawer({ const MIHAppDrawer({
super.key, super.key,
required this.signedInUser, required this.signedInUser,
required this.logo, required this.logo,
}); });
@override @override
State<PatManAppDrawer> createState() => _PatManAppDrawerState(); State<MIHAppDrawer> createState() => _MIHAppDrawerState();
} }
class _PatManAppDrawerState extends State<PatManAppDrawer> { class _MIHAppDrawerState extends State<MIHAppDrawer> {
//String endpointUserData = "${AppEnviroment.baseApiUrl}/users/profile/"; //String endpointUserData = "${AppEnviroment.baseApiUrl}/users/profile/";
//late Future<AppUser> signedInUser; //late Future<AppUser> signedInUser;
//late Image logo; //late Image logo;
@@ -76,30 +76,34 @@ class _PatManAppDrawerState extends State<PatManAppDrawer> {
height: 60, height: 60,
child: widget.logo, child: widget.logo,
), ),
const SizedBox(height: 50), Text(
Row( "${widget.signedInUser.fname} ${widget.signedInUser.lname}",
mainAxisSize: MainAxisSize.max, style: TextStyle(
children: [ fontWeight: FontWeight.bold,
Text( color: MzanziInnovationHub.of(context)!
"Username: ", .theme
style: TextStyle( .primaryColor(),
fontWeight: FontWeight.bold, ),
color: MzanziInnovationHub.of(context)! ),
.theme Text(
.primaryColor(), "@${widget.signedInUser.username}",
), style: TextStyle(
), fontSize: 12,
const SizedBox(width: 15), fontWeight: FontWeight.bold,
Text( color: MzanziInnovationHub.of(context)!
widget.signedInUser.username, .theme
style: TextStyle( .primaryColor(),
fontWeight: FontWeight.bold, ),
color: MzanziInnovationHub.of(context)! ),
.theme Text(
.primaryColor(), widget.signedInUser.type,
), style: TextStyle(
), fontSize: 10,
], fontWeight: FontWeight.bold,
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
),
), ),
], ],
), ),
@@ -154,7 +158,7 @@ class _PatManAppDrawerState extends State<PatManAppDrawer> {
), ),
onTap: () { onTap: () {
//signedInUser = snapshot.data!; //signedInUser = snapshot.data!;
//print("PatManAppDrawer: ${signedInUser.runtimeType}"); //print("MIHAppDrawer: ${signedInUser.runtimeType}");
Navigator.of(context) Navigator.of(context)
.pushNamed('/profile', arguments: widget.signedInUser); .pushNamed('/profile', arguments: widget.signedInUser);
}, },

View File

@@ -1,7 +1,7 @@
import 'dart:convert'; import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:patient_manager/components/patManAppDrawer.dart'; import 'package:patient_manager/components/mihAppDrawer.dart';
import 'package:patient_manager/env/env.dart'; import 'package:patient_manager/env/env.dart';
import 'package:patient_manager/components/homeTileGrid.dart'; import 'package:patient_manager/components/homeTileGrid.dart';
import 'package:patient_manager/components/myAppBar.dart'; import 'package:patient_manager/components/myAppBar.dart';
@@ -87,7 +87,7 @@ class _HomeState extends State<Home> {
if (snapshot.hasData) { if (snapshot.hasData) {
return Scaffold( return Scaffold(
appBar: const MyAppBar(barTitle: "Mzansi Innovation Hub"), appBar: const MyAppBar(barTitle: "Mzansi Innovation Hub"),
drawer: PatManAppDrawer( drawer: MIHAppDrawer(
signedInUser: snapshot.data!, signedInUser: snapshot.data!,
logo: logo, logo: logo,
), //HomeAppDrawer(userEmail: useremail), ), //HomeAppDrawer(userEmail: useremail),

View File

@@ -1,7 +1,7 @@
import 'dart:convert'; import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:patient_manager/components/patManAppDrawer.dart'; import 'package:patient_manager/components/mihAppDrawer.dart';
import 'package:patient_manager/components/patientDetails.dart'; import 'package:patient_manager/components/patientDetails.dart';
import 'package:patient_manager/components/myAppBar.dart'; import 'package:patient_manager/components/myAppBar.dart';
import 'package:patient_manager/components/patientFiles.dart'; import 'package:patient_manager/components/patientFiles.dart';
@@ -72,8 +72,8 @@ class _PatientViewState extends State<PatientView> {
if (snapshot.hasData) { if (snapshot.hasData) {
return Scaffold( return Scaffold(
appBar: const MyAppBar(barTitle: "Patient View"), appBar: const MyAppBar(barTitle: "Patient View"),
drawer: PatManAppDrawer( drawer:
signedInUser: widget.signedInUser, logo: logo), MIHAppDrawer(signedInUser: widget.signedInUser, logo: logo),
body: SingleChildScrollView( body: SingleChildScrollView(
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(