fix attachement issue on updat and add business

This commit is contained in:
2024-08-08 11:17:20 +02:00
parent 6c66ec55d8
commit 3aca8bb60f
2 changed files with 290 additions and 372 deletions

View File

@@ -5,6 +5,7 @@ import 'package:flutter/services.dart';
import 'package:patient_manager/components/mihAppBar.dart';
import 'package:patient_manager/components/myDropdownInput.dart';
import 'package:patient_manager/components/myErrorMessage.dart';
import 'package:patient_manager/components/myFileInput.dart';
import 'package:patient_manager/components/mySuccessMessage.dart';
import 'package:patient_manager/components/myTextInput.dart';
import 'package:patient_manager/components/mybutton.dart';
@@ -162,10 +163,7 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
Widget build(BuildContext context) {
return Scaffold(
appBar: const MIHAppBar(barTitle: "Add Business"),
body: Padding(
padding: const EdgeInsets.all(15.0),
child: Center(
child: KeyboardListener(
body: KeyboardListener(
focusNode: _focusNode,
autofocus: true,
onKeyEvent: (event) async {
@@ -175,6 +173,7 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
}
},
child: SingleChildScrollView(
padding: EdgeInsets.all(25),
child: Column(
children: [
const Text(
@@ -207,25 +206,11 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
editable: true,
),
const SizedBox(height: 10.0),
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Flexible(
flex: 19,
child: MyTextField(
MyFileField(
controller: logonameController,
hintText: "Logo",
editable: false,
required: true,
),
),
Flexible(
flex: 1,
child: Center(
child: IconButton(
icon: const Icon(Icons.attach_file),
onPressed: () async {
FilePickerResult? result =
await FilePicker.platform.pickFiles(
@@ -242,14 +227,9 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
});
},
),
),
),
],
),
const SizedBox(height: 15.0),
Divider(
color:
MzanziInnovationHub.of(context)?.theme.secondaryColor(),
color: MzanziInnovationHub.of(context)?.theme.secondaryColor(),
),
const SizedBox(height: 15.0),
const Text(
@@ -282,25 +262,11 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
required: true,
),
const SizedBox(height: 10.0),
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Flexible(
flex: 19,
child: MyTextField(
MyFileField(
controller: signtureController,
hintText: "Signature",
editable: false,
required: true,
),
),
Flexible(
flex: 1,
child: Center(
child: IconButton(
icon: const Icon(Icons.attach_file),
onPressed: () async {
FilePickerResult? result =
await FilePicker.platform.pickFiles(
@@ -317,10 +283,6 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
});
},
),
),
),
],
),
const SizedBox(height: 15.0),
MyDropdownField(
controller: accessController,
@@ -335,9 +297,8 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
height: 100.0,
child: MyButton(
buttonText: "Add",
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
textColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
onTap: () {
@@ -349,8 +310,6 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
),
),
),
),
),
);
}
}

View File

@@ -6,6 +6,7 @@ import 'package:flutter/services.dart';
import 'package:patient_manager/components/mihAppBar.dart';
import 'package:patient_manager/components/myDropdownInput.dart';
import 'package:patient_manager/components/myErrorMessage.dart';
import 'package:patient_manager/components/myFileInput.dart';
import 'package:patient_manager/components/mySuccessMessage.dart';
import 'package:patient_manager/components/myTextInput.dart';
import 'package:patient_manager/components/mybutton.dart';
@@ -255,10 +256,7 @@ class _ProfileBusinessUpdateState extends State<ProfileBusinessUpdate> {
Widget build(BuildContext context) {
return Scaffold(
appBar: const MIHAppBar(barTitle: "Business Profile"),
body: Padding(
padding: const EdgeInsets.all(15.0),
child: Center(
child: KeyboardListener(
body: KeyboardListener(
focusNode: _focusNode,
autofocus: true,
onKeyEvent: (event) async {
@@ -269,6 +267,7 @@ class _ProfileBusinessUpdateState extends State<ProfileBusinessUpdate> {
}
},
child: SingleChildScrollView(
padding: EdgeInsets.all(25),
child: Column(
children: [
const Text(
@@ -301,25 +300,11 @@ class _ProfileBusinessUpdateState extends State<ProfileBusinessUpdate> {
editable: true,
),
const SizedBox(height: 10.0),
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Flexible(
flex: 19,
child: MyTextField(
MyFileField(
controller: logonameController,
hintText: "Logo",
editable: false,
required: true,
),
),
Flexible(
flex: 1,
child: Center(
child: IconButton(
icon: const Icon(Icons.attach_file),
onPressed: () async {
FilePickerResult? result =
await FilePicker.platform.pickFiles(
@@ -336,14 +321,9 @@ class _ProfileBusinessUpdateState extends State<ProfileBusinessUpdate> {
});
},
),
),
),
],
),
const SizedBox(height: 15.0),
Divider(
color:
MzanziInnovationHub.of(context)?.theme.secondaryColor(),
color: MzanziInnovationHub.of(context)?.theme.secondaryColor(),
),
const SizedBox(height: 15.0),
const Text(
@@ -376,25 +356,11 @@ class _ProfileBusinessUpdateState extends State<ProfileBusinessUpdate> {
required: true,
),
const SizedBox(height: 10.0),
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Flexible(
flex: 19,
child: MyTextField(
MyFileField(
controller: signtureController,
hintText: "Signature",
editable: false,
required: true,
),
),
Flexible(
flex: 1,
child: Center(
child: IconButton(
icon: const Icon(Icons.attach_file),
onPressed: () async {
FilePickerResult? result =
await FilePicker.platform.pickFiles(
@@ -411,10 +377,6 @@ class _ProfileBusinessUpdateState extends State<ProfileBusinessUpdate> {
});
},
),
),
),
],
),
const SizedBox(height: 15.0),
MyDropdownField(
controller: accessController,
@@ -429,9 +391,8 @@ class _ProfileBusinessUpdateState extends State<ProfileBusinessUpdate> {
height: 100.0,
child: MyButton(
buttonText: "Add",
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
textColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
onTap: () {
@@ -444,8 +405,6 @@ class _ProfileBusinessUpdateState extends State<ProfileBusinessUpdate> {
),
),
),
),
),
);
}
}