file upload window enhancement
This commit is contained in:
@@ -3,6 +3,7 @@ import 'dart:convert';
|
|||||||
|
|
||||||
import 'package:file_picker/file_picker.dart';
|
import 'package:file_picker/file_picker.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:patient_manager/mih_components/mih_layout/mih_window.dart';
|
||||||
import 'package:patient_manager/mih_packages/patient_profile/builder/build_files_list.dart';
|
import 'package:patient_manager/mih_packages/patient_profile/builder/build_files_list.dart';
|
||||||
import 'package:patient_manager/mih_components/mih_inputs_and_buttons/mih_file_input.dart';
|
import 'package:patient_manager/mih_components/mih_inputs_and_buttons/mih_file_input.dart';
|
||||||
import 'package:patient_manager/mih_components/med_cert_input.dart';
|
import 'package:patient_manager/mih_components/med_cert_input.dart';
|
||||||
@@ -426,36 +427,14 @@ class _PatientFilesState extends State<PatientFiles> {
|
|||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
builder: (context) => Dialog(
|
builder: (context) => MIHWindow(
|
||||||
child: Stack(
|
fullscreen: false,
|
||||||
children: [
|
windowTitle: "Upload File",
|
||||||
Container(
|
windowTools: const [],
|
||||||
padding: const EdgeInsets.all(10.0),
|
onWindowTapClose: () {
|
||||||
width: 700.0,
|
Navigator.pop(context);
|
||||||
//height: 475.0,
|
},
|
||||||
decoration: BoxDecoration(
|
windowBody: [
|
||||||
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
borderRadius: BorderRadius.circular(25.0),
|
|
||||||
border: Border.all(
|
|
||||||
color:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
|
||||||
width: 5.0),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Upload File",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MzanziInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.secondaryColor(),
|
|
||||||
fontSize: 35.0,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25.0),
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 700,
|
width: 700,
|
||||||
child: MIHFileField(
|
child: MIHFileField(
|
||||||
@@ -464,8 +443,7 @@ class _PatientFilesState extends State<PatientFiles> {
|
|||||||
editable: false,
|
editable: false,
|
||||||
required: true,
|
required: true,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
FilePickerResult? result =
|
FilePickerResult? result = await FilePicker.platform.pickFiles(
|
||||||
await FilePicker.platform.pickFiles(
|
|
||||||
type: FileType.custom,
|
type: FileType.custom,
|
||||||
allowedExtensions: ['jpg', 'png', 'pdf'],
|
allowedExtensions: ['jpg', 'png', 'pdf'],
|
||||||
);
|
);
|
||||||
@@ -481,17 +459,15 @@ class _PatientFilesState extends State<PatientFiles> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 30),
|
const SizedBox(height: 15),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 300,
|
width: 300,
|
||||||
height: 50,
|
height: 50,
|
||||||
child: MIHButton(
|
child: MIHButton(
|
||||||
buttonText: "Add File",
|
buttonText: "Add File",
|
||||||
buttonColor: MzanziInnovationHub.of(context)!
|
buttonColor:
|
||||||
.theme
|
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
.secondaryColor(),
|
textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
textColor:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (isFileFieldsFilled()) {
|
if (isFileFieldsFilled()) {
|
||||||
uploadSelectedFile(selected);
|
uploadSelectedFile(selected);
|
||||||
@@ -500,8 +476,7 @@ class _PatientFilesState extends State<PatientFiles> {
|
|||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return const MIHErrorMessage(
|
return const MIHErrorMessage(errorType: "Input Error");
|
||||||
errorType: "Input Error");
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -510,26 +485,6 @@ class _PatientFilesState extends State<PatientFiles> {
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
top: 5,
|
|
||||||
right: 5,
|
|
||||||
width: 50,
|
|
||||||
height: 50,
|
|
||||||
child: IconButton(
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
icon: Icon(
|
|
||||||
Icons.close,
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.errorColor(),
|
|
||||||
size: 35,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user