Make app dymanically resizable for phone & web

This commit is contained in:
2024-07-11 13:31:02 +02:00
parent 98db9ce0c5
commit c8f99a03b4
35 changed files with 306 additions and 208 deletions

View File

@@ -11,6 +11,12 @@ class HomeAppDrawer extends StatefulWidget {
}
class _HomeAppDrawerState extends State<HomeAppDrawer> {
@override
void initState() {
// TODO: implement initState
super.initState();
}
@override
Widget build(BuildContext context) {
//print(MzanziInnovationHub.of(context)?.theme.mode);
@@ -73,6 +79,7 @@ class _HomeAppDrawerState extends State<HomeAppDrawer> {
MzanziInnovationHub.of(context)!.changeTheme(ThemeMode.dark);
//print("Dark Mode: $darkm");
}
Navigator.of(context).pushNamed('/home');
});
},
icon: Icon(

View File

@@ -7,6 +7,8 @@ class HomeTile extends StatefulWidget {
final IconData tileIcon;
final void Function() onTap;
// final Widget tileIcon;
final Color p;
final Color s;
const HomeTile({
super.key,
@@ -14,6 +16,8 @@ class HomeTile extends StatefulWidget {
required this.tileName,
//required this.tileDescription,
required this.tileIcon,
required this.p,
required this.s,
});
@override
@@ -26,12 +30,62 @@ class _HomeTileState extends State<HomeTile> {
@override
void initState() {
mainC = MzanziInnovationHub.of(context)!.theme.secondaryColor();
secondC = MzanziInnovationHub.of(context)!.theme.primaryColor();
mainC = widget.p;
secondC = widget.s;
super.initState();
}
Widget displayTile() {
return FittedBox(
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.end,
children: [
GestureDetector(
onTap: widget.onTap,
onTapDown: (_) {
setState(() {
mainC = MzanziInnovationHub.of(context)!.theme.primaryColor();
secondC =
MzanziInnovationHub.of(context)!.theme.secondaryColor();
});
},
onTapUp: (_) {
setState(() {
mainC = MzanziInnovationHub.of(context)!.theme.secondaryColor();
secondC = MzanziInnovationHub.of(context)!.theme.primaryColor();
});
},
child: Container(
padding: const EdgeInsets.all(3.0),
decoration: BoxDecoration(
color: mainC,
borderRadius: BorderRadius.circular(10.0),
//border: Border.all(color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), width: 1.0),
),
child: Icon(
widget.tileIcon,
color: secondC,
),
),
),
const SizedBox(height: 1),
Text(
widget.tileName,
textAlign: TextAlign.center,
style: TextStyle(
color: mainC,
fontSize: 5.0,
fontWeight: FontWeight.bold,
),
)
],
),
);
}
@override
Widget build(BuildContext context) {
return FittedBox(
child: Column(
mainAxisSize: MainAxisSize.max,
@@ -78,11 +132,6 @@ class _HomeTileState extends State<HomeTile> {
],
),
);
}
@override
Widget build(BuildContext context) {
return displayTile();
// child: Card(
// color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
// elevation: 20,

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:patient_manager/components/homeTile.dart';
import 'package:patient_manager/main.dart';
class HomeTileGrid extends StatefulWidget {
final String userEmail;
@@ -10,21 +11,19 @@ class HomeTileGrid extends StatefulWidget {
}
class _HomeTileGridState extends State<HomeTileGrid> {
@override
Widget build(BuildContext context) {
var size = MediaQuery.of(context).size;
late List<List<dynamic>> tileList;
double width = size.width;
double height = size.height;
// final double itemHeight = (size.height - kToolbarHeight - 24) / 2;
// final double itemWidth = size.width / 5;
List<List<dynamic>> tileList = [
@override
void initState() {
tileList = [
[
Icons.medication,
"Patient Manager",
() {
Navigator.of(context)
.pushNamed('/patient-manager', arguments: widget.userEmail);
// Navigator.of(context)
// .pushNamed('/patient-manager', arguments: widget.userEmail);
Navigator.popAndPushNamed(context, '/patient-manager',
arguments: widget.userEmail);
}
],
[Icons.abc, "Test 1", () {}],
@@ -34,24 +33,53 @@ class _HomeTileGridState extends State<HomeTileGrid> {
[Icons.abc, "Test 5", () {}],
[Icons.abc, "Test 6", () {}],
];
super.initState();
}
return GridView.builder(
padding: EdgeInsets.fromLTRB(width / 6, height / 16, width / 6,
0), //EdgeInsets.symmetric(horizontal: width / 6),
itemCount: tileList.length,
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 200),
//const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3),
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.all(10),
child: HomeTile(
onTap: tileList[index][2],
tileIcon: tileList[index][0],
tileName: tileList[index][1],
),
);
},
Color getPrim() {
return MzanziInnovationHub.of(context)!.theme.secondaryColor();
}
Color getSec() {
return MzanziInnovationHub.of(context)!.theme.primaryColor();
}
Widget buildtile(tile) {
//setColor();
return Padding(
padding: const EdgeInsets.all(10),
child: HomeTile(
onTap: tile[2],
tileIcon: tile[0],
tileName: tile[1],
p: getPrim(),
s: getSec(),
),
);
}
@override
Widget build(BuildContext context) {
var size = MediaQuery.of(context).size;
double width = size.width;
double height = size.height;
return Container(
width: width,
height: height,
child: GridView.builder(
padding: EdgeInsets.fromLTRB(width / 6, height / 16, width / 6,
0), //EdgeInsets.symmetric(horizontal: width / 6),
itemCount: tileList.length,
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 200),
//const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3),
itemBuilder: (context, index) {
var tile = tileList[index];
//setState(() {});
return buildtile(tile);
},
),
);
}
}

View File

@@ -147,7 +147,8 @@ class _PatManAppDrawerState extends State<PatManAppDrawer> {
],
),
onTap: () {
Navigator.of(context).pushNamed('/home');
//Navigator.of(context).pushNamed('/home');
Navigator.popAndPushNamed(context, '/home');
},
),
ListTile(
@@ -203,7 +204,8 @@ class _PatManAppDrawerState extends State<PatManAppDrawer> {
),
onTap: () {
client.auth.signOut();
Navigator.of(context).pushNamed('/');
Navigator.popAndPushNamed(context, '/');
//Navigator.of(context).pushNamed('/');
},
)
],

View File

@@ -556,81 +556,78 @@ class _PatientFilesState extends State<PatientFiles> {
return const CircularProgressIndicator();
} else if (snapshot.hasData) {
final filesList = snapshot.data!;
return Flexible(
flex: 1,
child: Container(
//height: 300.0,
decoration: BoxDecoration(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
borderRadius: BorderRadius.circular(25.0),
border: Border.all(
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 3.0),
),
child: Padding(
padding: const EdgeInsets.only(top: 5.0),
child: Column(children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Files",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
),
),
IconButton(
onPressed: () {
medCertPopUp();
},
icon: Icon(
Icons.sick_outlined,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
),
),
IconButton(
onPressed: () {
prescritionPopUp();
},
icon: Icon(
Icons.medication_outlined,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
),
),
IconButton(
onPressed: () {
uploudFilePopUp();
},
icon: Icon(
Icons.add,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
),
)
],
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Divider(
return Container(
//height: 300.0,
decoration: BoxDecoration(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
borderRadius: BorderRadius.circular(25.0),
border: Border.all(
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 3.0),
),
child: Padding(
padding: const EdgeInsets.only(top: 5.0),
child: Column(children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Files",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor()),
),
const SizedBox(height: 10),
BuildFilesList(files: filesList),
]),
),
.secondaryColor(),
),
),
IconButton(
onPressed: () {
medCertPopUp();
},
icon: Icon(
Icons.sick_outlined,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
),
),
IconButton(
onPressed: () {
prescritionPopUp();
},
icon: Icon(
Icons.medication_outlined,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
),
),
IconButton(
onPressed: () {
uploudFilePopUp();
},
icon: Icon(
Icons.add,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
),
)
],
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Divider(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor()),
),
const SizedBox(height: 10),
BuildFilesList(files: filesList),
]),
),
);
} else {

View File

@@ -226,56 +226,53 @@ class _PatientNotesState extends State<PatientNotes> {
return const CircularProgressIndicator();
} else if (snapshot.hasData) {
final notesList = snapshot.data!;
return Flexible(
flex: 1,
child: Container(
//height: 300.0,
decoration: BoxDecoration(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
borderRadius: BorderRadius.circular(25.0),
border: Border.all(
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 3.0),
),
child: Padding(
padding: const EdgeInsets.only(top: 5.0),
child: Column(children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Notes",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor()),
),
IconButton(
onPressed: () {
addNotePopUp();
},
icon: Icon(Icons.add,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor()),
)
],
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Divider(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor()),
),
const SizedBox(height: 10),
BuildNotesList(notes: notesList),
]),
),
return Container(
//height: 300.0,
decoration: BoxDecoration(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
borderRadius: BorderRadius.circular(25.0),
border: Border.all(
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 3.0),
),
child: Padding(
padding: const EdgeInsets.only(top: 5.0),
child: Column(children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Notes",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor()),
),
IconButton(
onPressed: () {
addNotePopUp();
},
icon: Icon(Icons.add,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor()),
)
],
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Divider(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor()),
),
const SizedBox(height: 10),
BuildNotesList(notes: notesList),
]),
),
);
} else {

View File

@@ -33,6 +33,8 @@ class PrescripInput extends StatefulWidget {
class _PrescripInputState extends State<PrescripInput> {
//String perscriptionOutput = "";
List<List<String>> perscriptionOutput = [];
late double width;
late double height;
final numberOptions = [
"0",
@@ -260,7 +262,7 @@ class _PrescripInputState extends State<PrescripInput> {
icon: Icon(
Icons.delete_forever_outlined,
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
onPressed: () {
setState(() {
@@ -307,15 +309,26 @@ class _PrescripInputState extends State<PrescripInput> {
@override
Widget build(BuildContext context) {
return SizedBox(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
displayMedInput(),
displayPerscList(),
],
var size = MediaQuery.of(context).size;
setState(() {
width = size.width;
height = size.height;
});
return Container(
//width: ,
height: (height / 3) * 2,
child: SingleChildScrollView(
child: Wrap(
direction: Axis.horizontal,
alignment: WrapAlignment.center,
// mainAxisAlignment: MainAxisAlignment.center,
// mainAxisSize: MainAxisSize.max,
// crossAxisAlignment: CrossAxisAlignment.center,
children: [
displayMedInput(),
displayPerscList(),
],
),
),
);
}

View File

@@ -3,13 +3,8 @@ import 'package:patient_manager/main.dart';
import 'package:patient_manager/components/homeTileGrid.dart';
import 'package:patient_manager/components/myAppBar.dart';
import 'package:patient_manager/components/homeAppDrawer.dart';
//import 'package:patient_manager/components/mySuccessMessage.dart';
bool darkm = false;
class Home extends StatefulWidget {
//final String userEmail;
const Home({
super.key,
});
@@ -34,6 +29,18 @@ class _HomeState extends State<Home> {
return useremail;
}
@override
void dispose() {
// TODO: implement dispose
super.dispose();
}
@override
void initState() {
// TODO: implement initState
super.initState();
}
@override
Widget build(BuildContext context) {
return FutureBuilder(
@@ -58,19 +65,12 @@ class _HomeState extends State<Home> {
// ),
// //backgroundColor: Colors.blueAccent,
// onPressed: () {
// setState(() {
// if (darkm) {
// darkm = !darkm;
// MzanziInnovationHub.of(context)!
// .changeTheme(ThemeMode.light);
// //print("Dark Mode: $darkm");
// } else {
// darkm = !darkm;
// MzanziInnovationHub.of(context)!
// .changeTheme(ThemeMode.dark);
// //print("Dark Mode: $darkm");
// }
// });
// showDatePicker(
// context: context,
// initialDate: DateTime.now(),
// firstDate: DateTime(2000),
// lastDate: DateTime(2100),
// );
// // showDialog(
// // context: context,
// // builder: (context) =>
@@ -83,6 +83,7 @@ class _HomeState extends State<Home> {
// ),
// ),
);
//);
} else {
return const Center(child: CircularProgressIndicator());
}

View File

@@ -361,7 +361,7 @@ class _AddPatientState extends State<AddPatient> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: 400.0,
width: 450.0,
height: 100.0,
child: MyButton(
onTap: () {

View File

@@ -172,8 +172,8 @@ class _EditPatientState extends State<EditPatient> {
children: [
Container(
padding: const EdgeInsets.all(10.0),
width: width / 3,
height: height / 2,
width: 700.0,
height: (height / 3) * 2,
decoration: BoxDecoration(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
borderRadius: BorderRadius.circular(25.0),
@@ -553,7 +553,7 @@ class _EditPatientState extends State<EditPatient> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: 400.0,
width: 450.0,
height: 100.0,
child: MyButton(
onTap: () {

View File

@@ -27,17 +27,24 @@ class _PatientViewState extends State<PatientView> {
const SizedBox(
height: 10.0,
),
Row(
Wrap(
spacing: 10.0,
runSpacing: 10.0,
direction: Axis.horizontal,
alignment: WrapAlignment.center,
children: [
PatientNotes(
patientIndex: widget.selectedPatient.idpatients,
SizedBox(
width: 725,
child: PatientNotes(
patientIndex: widget.selectedPatient.idpatients,
),
),
const SizedBox(
width: 10,
),
PatientFiles(
patientIndex: widget.selectedPatient.idpatients,
selectedPatient: widget.selectedPatient,
SizedBox(
width: 725,
child: PatientFiles(
patientIndex: widget.selectedPatient.idpatients,
selectedPatient: widget.selectedPatient,
),
)
],
)

View File

@@ -33,13 +33,9 @@
<link rel="manifest" href="manifest.json">
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/pdfjs-dist@2.12.313/build/pdf.js" type="text/javascript"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.11.338/pdf.min.js"></script>
<script type="text/javascript">
pdfjsLib.GlobalWorkerOptions.workerSrc = "https://cdn.jsdelivr.net/npm/pdfjs-dist@2.12.313/build/pdf.worker.min.js";
pdfRenderOptions = {
cMapUrl: 'https://cdn.jsdelivr.net/npm/pdfjs-dist@2.12.313/cmaps/',
cMapPacked: true,
}
pdfjsLib.GlobalWorkerOptions.workerSrc = "//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.11.338/pdf.worker.min.js";
</script>
<script src="flutter_bootstrap.js" async></script>
</body>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
database/binlog.000057 Normal file

Binary file not shown.

BIN
database/binlog.000058 Normal file

Binary file not shown.

View File

@@ -1,4 +1,5 @@
4294967279,321
4294967294,448
4294967278,398
4294967278,397
4294967293,131
4294967293,130
@@ -266,7 +267,6 @@
4294967278,280
4294967278,413
4294967278,6
4294967278,428
4294967278,258
4294967278,5
4294967278,389
@@ -294,3 +294,4 @@
4294967279,449
4294967279,442
4294967279,126
4294967279,441

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.