Active Business Toggle
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:patient_manager/components/mihAppDrawer.dart';
|
||||
import 'package:patient_manager/env/env.dart';
|
||||
import 'package:patient_manager/components/homeTileGrid.dart';
|
||||
import 'package:patient_manager/components/mihAppBar.dart';
|
||||
import 'package:patient_manager/main.dart';
|
||||
import 'package:patient_manager/objects/appUser.dart';
|
||||
import 'package:supertokens_flutter/supertokens.dart';
|
||||
import 'package:supertokens_flutter/http.dart' as http;
|
||||
@@ -20,19 +17,9 @@ class Home extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _HomeState extends State<Home> {
|
||||
//late Future<AppUser> signedInUser;
|
||||
String useremail = "";
|
||||
final baseAPI = AppEnviroment.baseApiUrl;
|
||||
|
||||
// Future<void> loadImage() async {
|
||||
// try {
|
||||
// var t = MzanziInnovationHub.of(context)!.theme.logoImage();
|
||||
// await precacheImage(t.image, context);
|
||||
// } catch (e) {
|
||||
// print('Failed to load and cache the image: $e');
|
||||
// }
|
||||
// }
|
||||
|
||||
Future<AppUser> getUserDetails() async {
|
||||
//print("pat man drawer: " + endpointUserData + widget.userEmail);
|
||||
var uid = await SuperTokens.getUserId();
|
||||
@@ -46,6 +33,9 @@ class _HomeState extends State<Home> {
|
||||
var decodedData = jsonDecode(body);
|
||||
AppUser u = AppUser.fromJson(decodedData);
|
||||
// print(u.email);
|
||||
//setState(() {
|
||||
//_widgetOptions = setLayout(u);
|
||||
//});
|
||||
return u;
|
||||
} else {
|
||||
throw Exception("Error: GetUserData status code ${response.statusCode}");
|
||||
@@ -54,66 +44,18 @@ class _HomeState extends State<Home> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
//signedInUser = getUserDetails();
|
||||
super.initState();
|
||||
|
||||
//precacheImage(logo, context);
|
||||
}
|
||||
|
||||
// @override
|
||||
// void didChangeDependencies() {
|
||||
// super.didChangeDependencies();
|
||||
// precacheImage(logo, context);
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
//loadImage();
|
||||
|
||||
return FutureBuilder(
|
||||
future: getUserDetails(),
|
||||
builder: (BuildContext context, AsyncSnapshot<AppUser> snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
if (snapshot.hasData) {
|
||||
return Scaffold(
|
||||
appBar: const MIHAppBar(barTitle: "Mzansi Innovation Hub"),
|
||||
drawer: MIHAppDrawer(
|
||||
signedInUser: snapshot.data!,
|
||||
logo:
|
||||
MzanziInnovationHub.of(context)!.theme.logoImage(), //logo,
|
||||
), //HomeAppDrawer(userEmail: useremail),
|
||||
body: HomeTileGrid(
|
||||
signedInUser: snapshot.data!,
|
||||
),
|
||||
// floatingActionButtonLocation: FloatingActionButtonLocation.endTop,
|
||||
// floatingActionButton: Padding(
|
||||
// padding: const EdgeInsets.only(top: 65, right: 5),
|
||||
// child: FloatingActionButton.extended(
|
||||
// label: const Text(
|
||||
// "Test Pop Up",
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.bold,
|
||||
// ),
|
||||
// ),
|
||||
// //backgroundColor: Colors.blueAccent,
|
||||
// onPressed: () {
|
||||
// showDatePicker(
|
||||
// context: context,
|
||||
// initialDate: DateTime.now(),
|
||||
// firstDate: DateTime(2000),
|
||||
// lastDate: DateTime(2100),
|
||||
// );
|
||||
// // showDialog(
|
||||
// // context: context,
|
||||
// // builder: (context) =>
|
||||
// // const MyErrorMessage(errorType: "Input Error"),
|
||||
// // );
|
||||
// },
|
||||
// icon: const Icon(
|
||||
// Icons.warning,
|
||||
// //color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
// ),
|
||||
// ),
|
||||
return HomeTileGrid(
|
||||
signedInUser: snapshot.data!,
|
||||
);
|
||||
} else {
|
||||
return Center(
|
||||
@@ -129,7 +71,5 @@ class _HomeState extends State<Home> {
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
//);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user