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