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

View File

@@ -7,6 +7,8 @@ class HomeTile extends StatefulWidget {
final IconData tileIcon; final IconData tileIcon;
final void Function() onTap; final void Function() onTap;
// final Widget tileIcon; // final Widget tileIcon;
final Color p;
final Color s;
const HomeTile({ const HomeTile({
super.key, super.key,
@@ -14,6 +16,8 @@ class HomeTile extends StatefulWidget {
required this.tileName, required this.tileName,
//required this.tileDescription, //required this.tileDescription,
required this.tileIcon, required this.tileIcon,
required this.p,
required this.s,
}); });
@override @override
@@ -26,12 +30,62 @@ class _HomeTileState extends State<HomeTile> {
@override @override
void initState() { void initState() {
mainC = MzanziInnovationHub.of(context)!.theme.secondaryColor(); mainC = widget.p;
secondC = MzanziInnovationHub.of(context)!.theme.primaryColor(); secondC = widget.s;
super.initState(); super.initState();
} }
Widget displayTile() { 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( return FittedBox(
child: Column( child: Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@@ -78,11 +132,6 @@ class _HomeTileState extends State<HomeTile> {
], ],
), ),
); );
}
@override
Widget build(BuildContext context) {
return displayTile();
// child: Card( // child: Card(
// color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), // color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
// elevation: 20, // elevation: 20,

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:patient_manager/components/homeTile.dart'; import 'package:patient_manager/components/homeTile.dart';
import 'package:patient_manager/main.dart';
class HomeTileGrid extends StatefulWidget { class HomeTileGrid extends StatefulWidget {
final String userEmail; final String userEmail;
@@ -10,21 +11,19 @@ class HomeTileGrid extends StatefulWidget {
} }
class _HomeTileGridState extends State<HomeTileGrid> { class _HomeTileGridState extends State<HomeTileGrid> {
@override late List<List<dynamic>> tileList;
Widget build(BuildContext context) {
var size = MediaQuery.of(context).size;
double width = size.width; @override
double height = size.height; void initState() {
// final double itemHeight = (size.height - kToolbarHeight - 24) / 2; tileList = [
// final double itemWidth = size.width / 5;
List<List<dynamic>> tileList = [
[ [
Icons.medication, Icons.medication,
"Patient Manager", "Patient Manager",
() { () {
Navigator.of(context) // Navigator.of(context)
.pushNamed('/patient-manager', arguments: widget.userEmail); // .pushNamed('/patient-manager', arguments: widget.userEmail);
Navigator.popAndPushNamed(context, '/patient-manager',
arguments: widget.userEmail);
} }
], ],
[Icons.abc, "Test 1", () {}], [Icons.abc, "Test 1", () {}],
@@ -34,24 +33,53 @@ class _HomeTileGridState extends State<HomeTileGrid> {
[Icons.abc, "Test 5", () {}], [Icons.abc, "Test 5", () {}],
[Icons.abc, "Test 6", () {}], [Icons.abc, "Test 6", () {}],
]; ];
super.initState();
}
return GridView.builder( Color getPrim() {
padding: EdgeInsets.fromLTRB(width / 6, height / 16, width / 6, return MzanziInnovationHub.of(context)!.theme.secondaryColor();
0), //EdgeInsets.symmetric(horizontal: width / 6), }
itemCount: tileList.length,
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent( Color getSec() {
maxCrossAxisExtent: 200), return MzanziInnovationHub.of(context)!.theme.primaryColor();
//const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3), }
itemBuilder: (context, index) {
return Padding( Widget buildtile(tile) {
padding: const EdgeInsets.all(10), //setColor();
child: HomeTile( return Padding(
onTap: tileList[index][2], padding: const EdgeInsets.all(10),
tileIcon: tileList[index][0], child: HomeTile(
tileName: tileList[index][1], 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: () { onTap: () {
Navigator.of(context).pushNamed('/home'); //Navigator.of(context).pushNamed('/home');
Navigator.popAndPushNamed(context, '/home');
}, },
), ),
ListTile( ListTile(
@@ -203,7 +204,8 @@ class _PatManAppDrawerState extends State<PatManAppDrawer> {
), ),
onTap: () { onTap: () {
client.auth.signOut(); 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(); return const CircularProgressIndicator();
} else if (snapshot.hasData) { } else if (snapshot.hasData) {
final filesList = snapshot.data!; final filesList = snapshot.data!;
return Flexible( return Container(
flex: 1, //height: 300.0,
child: Container( decoration: BoxDecoration(
//height: 300.0, color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
decoration: BoxDecoration( borderRadius: BorderRadius.circular(25.0),
color: MzanziInnovationHub.of(context)!.theme.primaryColor(), border: Border.all(
borderRadius: BorderRadius.circular(25.0), color:
border: Border.all( MzanziInnovationHub.of(context)!.theme.secondaryColor(),
color: width: 3.0),
MzanziInnovationHub.of(context)!.theme.secondaryColor(), ),
width: 3.0), child: Padding(
), padding: const EdgeInsets.only(top: 5.0),
child: Padding( child: Column(children: [
padding: const EdgeInsets.only(top: 5.0), Row(
child: Column(children: [ mainAxisAlignment: MainAxisAlignment.center,
Row( children: [
mainAxisAlignment: MainAxisAlignment.center, Text(
children: [ "Files",
Text( textAlign: TextAlign.center,
"Files", style: TextStyle(
textAlign: TextAlign.center, fontSize: 25,
style: TextStyle( fontWeight: FontWeight.bold,
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(
color: MzanziInnovationHub.of(context)! color: MzanziInnovationHub.of(context)!
.theme .theme
.secondaryColor()), .secondaryColor(),
), ),
const SizedBox(height: 10), ),
BuildFilesList(files: filesList), 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 { } else {

View File

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

View File

@@ -33,6 +33,8 @@ class PrescripInput extends StatefulWidget {
class _PrescripInputState extends State<PrescripInput> { class _PrescripInputState extends State<PrescripInput> {
//String perscriptionOutput = ""; //String perscriptionOutput = "";
List<List<String>> perscriptionOutput = []; List<List<String>> perscriptionOutput = [];
late double width;
late double height;
final numberOptions = [ final numberOptions = [
"0", "0",
@@ -260,7 +262,7 @@ class _PrescripInputState extends State<PrescripInput> {
icon: Icon( icon: Icon(
Icons.delete_forever_outlined, Icons.delete_forever_outlined,
color: color:
MzanziInnovationHub.of(context)!.theme.primaryColor(), MzanziInnovationHub.of(context)!.theme.secondaryColor(),
), ),
onPressed: () { onPressed: () {
setState(() { setState(() {
@@ -307,15 +309,26 @@ class _PrescripInputState extends State<PrescripInput> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SizedBox( var size = MediaQuery.of(context).size;
child: Row( setState(() {
mainAxisAlignment: MainAxisAlignment.center, width = size.width;
mainAxisSize: MainAxisSize.max, height = size.height;
crossAxisAlignment: CrossAxisAlignment.center, });
children: [ return Container(
displayMedInput(), //width: ,
displayPerscList(), 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/homeTileGrid.dart';
import 'package:patient_manager/components/myAppBar.dart'; import 'package:patient_manager/components/myAppBar.dart';
import 'package:patient_manager/components/homeAppDrawer.dart'; import 'package:patient_manager/components/homeAppDrawer.dart';
//import 'package:patient_manager/components/mySuccessMessage.dart';
bool darkm = false;
class Home extends StatefulWidget { class Home extends StatefulWidget {
//final String userEmail;
const Home({ const Home({
super.key, super.key,
}); });
@@ -34,6 +29,18 @@ class _HomeState extends State<Home> {
return useremail; return useremail;
} }
@override
void dispose() {
// TODO: implement dispose
super.dispose();
}
@override
void initState() {
// TODO: implement initState
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return FutureBuilder( return FutureBuilder(
@@ -58,19 +65,12 @@ class _HomeState extends State<Home> {
// ), // ),
// //backgroundColor: Colors.blueAccent, // //backgroundColor: Colors.blueAccent,
// onPressed: () { // onPressed: () {
// setState(() { // showDatePicker(
// if (darkm) { // context: context,
// darkm = !darkm; // initialDate: DateTime.now(),
// MzanziInnovationHub.of(context)! // firstDate: DateTime(2000),
// .changeTheme(ThemeMode.light); // lastDate: DateTime(2100),
// //print("Dark Mode: $darkm"); // );
// } else {
// darkm = !darkm;
// MzanziInnovationHub.of(context)!
// .changeTheme(ThemeMode.dark);
// //print("Dark Mode: $darkm");
// }
// });
// // showDialog( // // showDialog(
// // context: context, // // context: context,
// // builder: (context) => // // builder: (context) =>
@@ -83,6 +83,7 @@ class _HomeState extends State<Home> {
// ), // ),
// ), // ),
); );
//);
} else { } else {
return const Center(child: CircularProgressIndicator()); return const Center(child: CircularProgressIndicator());
} }

View File

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

View File

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

View File

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

View File

@@ -33,13 +33,9 @@
<link rel="manifest" href="manifest.json"> <link rel="manifest" href="manifest.json">
</head> </head>
<body> <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"> <script type="text/javascript">
pdfjsLib.GlobalWorkerOptions.workerSrc = "https://cdn.jsdelivr.net/npm/pdfjs-dist@2.12.313/build/pdf.worker.min.js"; pdfjsLib.GlobalWorkerOptions.workerSrc = "//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.11.338/pdf.worker.min.js";
pdfRenderOptions = {
cMapUrl: 'https://cdn.jsdelivr.net/npm/pdfjs-dist@2.12.313/cmaps/',
cMapPacked: true,
}
</script> </script>
<script src="flutter_bootstrap.js" async></script> <script src="flutter_bootstrap.js" async></script>
</body> </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 4294967278,397
4294967293,131 4294967293,131
4294967293,130 4294967293,130
@@ -266,7 +267,6 @@
4294967278,280 4294967278,280
4294967278,413 4294967278,413
4294967278,6 4294967278,6
4294967278,428
4294967278,258 4294967278,258
4294967278,5 4294967278,5
4294967278,389 4294967278,389
@@ -294,3 +294,4 @@
4294967279,449 4294967279,449
4294967279,442 4294967279,442
4294967279,126 4294967279,126
4294967279,441

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.