remove double future builds
This commit is contained in:
@@ -2,7 +2,6 @@ import 'dart:convert';
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:patient_manager/components/mihAppDrawer.dart';
|
import 'package:patient_manager/components/mihAppDrawer.dart';
|
||||||
import 'package:patient_manager/components/mihLoadingCircle.dart';
|
|
||||||
import 'package:patient_manager/components/patientDetails.dart';
|
import 'package:patient_manager/components/patientDetails.dart';
|
||||||
import 'package:patient_manager/components/mihAppBar.dart';
|
import 'package:patient_manager/components/mihAppBar.dart';
|
||||||
import 'package:patient_manager/components/patientFiles.dart';
|
import 'package:patient_manager/components/patientFiles.dart';
|
||||||
@@ -67,75 +66,56 @@ class _PatientViewState extends State<PatientView> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// loadImage();
|
// loadImage();
|
||||||
// var logo = MzanziInnovationHub.of(context)!.theme.logoImage();
|
// var logo = MzanziInnovationHub.of(context)!.theme.logoImage();
|
||||||
return FutureBuilder(
|
return Scaffold(
|
||||||
future: fetchPatient(),
|
appBar: const MIHAppBar(barTitle: "Patient View"),
|
||||||
builder: (ctx, snapshot) {
|
drawer: showDrawer(),
|
||||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
body: SingleChildScrollView(
|
||||||
return const Mihloadingcircle();
|
child: Padding(
|
||||||
}
|
padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 15.0),
|
||||||
// Checking if future is resolved
|
child: Column(
|
||||||
else if (snapshot.connectionState == ConnectionState.done) {
|
children: [
|
||||||
if (snapshot.hasData) {
|
PatientDetails(
|
||||||
return Scaffold(
|
selectedPatient: widget.arguments.selectedPatient!,
|
||||||
appBar: const MIHAppBar(barTitle: "Patient View"),
|
type: widget.arguments.type,
|
||||||
drawer: showDrawer(),
|
|
||||||
body: SingleChildScrollView(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
vertical: 10.0, horizontal: 15.0),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
PatientDetails(
|
|
||||||
selectedPatient: snapshot.data!,
|
|
||||||
type: widget.arguments.type,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 10.0,
|
|
||||||
),
|
|
||||||
Wrap(
|
|
||||||
spacing: 10.0,
|
|
||||||
runSpacing: 10.0,
|
|
||||||
direction: Axis.horizontal,
|
|
||||||
alignment: WrapAlignment.center,
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: 660,
|
|
||||||
child: PatientNotes(
|
|
||||||
patientAppId: snapshot.data!.app_id,
|
|
||||||
selectedPatient: snapshot.data!,
|
|
||||||
signedInUser: widget.arguments.signedInUser,
|
|
||||||
business: widget.arguments.business,
|
|
||||||
businessUser: widget.arguments.businessUser,
|
|
||||||
type: widget.arguments.type,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: 660,
|
|
||||||
child: PatientFiles(
|
|
||||||
patientIndex: snapshot.data!.idpatients,
|
|
||||||
selectedPatient: snapshot.data!,
|
|
||||||
signedInUser: widget.arguments.signedInUser,
|
|
||||||
business: widget.arguments.business,
|
|
||||||
businessUser: widget.arguments.businessUser,
|
|
||||||
type: widget.arguments.type,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
const SizedBox(
|
||||||
}
|
height: 10.0,
|
||||||
}
|
),
|
||||||
return Center(
|
Wrap(
|
||||||
child: Text(
|
spacing: 10.0,
|
||||||
'${snapshot.error} occurred',
|
runSpacing: 10.0,
|
||||||
style: const TextStyle(fontSize: 18),
|
direction: Axis.horizontal,
|
||||||
|
alignment: WrapAlignment.center,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 660,
|
||||||
|
child: PatientNotes(
|
||||||
|
patientAppId: widget.arguments.selectedPatient!.app_id,
|
||||||
|
selectedPatient: widget.arguments.selectedPatient!,
|
||||||
|
signedInUser: widget.arguments.signedInUser,
|
||||||
|
business: widget.arguments.business,
|
||||||
|
businessUser: widget.arguments.businessUser,
|
||||||
|
type: widget.arguments.type,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 660,
|
||||||
|
child: PatientFiles(
|
||||||
|
patientIndex:
|
||||||
|
widget.arguments.selectedPatient!.idpatients,
|
||||||
|
selectedPatient: widget.arguments.selectedPatient!,
|
||||||
|
signedInUser: widget.arguments.signedInUser,
|
||||||
|
business: widget.arguments.business,
|
||||||
|
businessUser: widget.arguments.businessUser,
|
||||||
|
type: widget.arguments.type,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
},
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user