update add business woth mnew fields
This commit is contained in:
@@ -56,12 +56,16 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
final locationController = TextEditingController();
|
final locationController = TextEditingController();
|
||||||
final practiceNoController = TextEditingController();
|
final practiceNoController = TextEditingController();
|
||||||
final vatNoController = TextEditingController();
|
final vatNoController = TextEditingController();
|
||||||
|
final websiteController = TextEditingController();
|
||||||
|
final ratingController = TextEditingController();
|
||||||
|
final missionVisionController = TextEditingController();
|
||||||
|
|
||||||
ImageProvider<Object>? logoPreview;
|
ImageProvider<Object>? logoPreview;
|
||||||
ImageProvider<Object>? signaturePreview;
|
ImageProvider<Object>? signaturePreview;
|
||||||
PlatformFile? selectedLogo;
|
PlatformFile? selectedLogo;
|
||||||
PlatformFile? selectedSignature;
|
PlatformFile? selectedSignature;
|
||||||
|
|
||||||
|
final ValueNotifier<int> _counter = ValueNotifier<int>(0);
|
||||||
final ValueNotifier<String> busType = ValueNotifier("");
|
final ValueNotifier<String> busType = ValueNotifier("");
|
||||||
final _formKey = GlobalKey<FormState>();
|
final _formKey = GlobalKey<FormState>();
|
||||||
late String env;
|
late String env;
|
||||||
@@ -123,6 +127,9 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
contactController.text,
|
contactController.text,
|
||||||
locationController.text,
|
locationController.text,
|
||||||
logonameController.text,
|
logonameController.text,
|
||||||
|
websiteController.text,
|
||||||
|
"0",
|
||||||
|
missionVisionController.text,
|
||||||
context,
|
context,
|
||||||
);
|
);
|
||||||
print(response.body);
|
print(response.body);
|
||||||
@@ -233,6 +240,14 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Color getMissionVisionLimitColor(int limit) {
|
||||||
|
if (_counter.value <= limit) {
|
||||||
|
return MzanziInnovationHub.of(context)!.theme.secondaryColor();
|
||||||
|
} else {
|
||||||
|
return MzanziInnovationHub.of(context)!.theme.errorColor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MIHBody getBody(double width) {
|
MIHBody getBody(double width) {
|
||||||
return MIHBody(
|
return MIHBody(
|
||||||
borderOn: false,
|
borderOn: false,
|
||||||
@@ -280,10 +295,54 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
inputColor: MzanziInnovationHub.of(context)!
|
inputColor: MzanziInnovationHub.of(context)!
|
||||||
.theme
|
.theme
|
||||||
.primaryColor(),
|
.primaryColor(),
|
||||||
controller: regController,
|
controller: nameController,
|
||||||
multiLineInput: false,
|
multiLineInput: false,
|
||||||
requiredText: true,
|
requiredText: true,
|
||||||
hintText: "Registration No.",
|
hintText: "Business Name",
|
||||||
|
validator: (value) {
|
||||||
|
return MihValidationServices().isEmpty(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10.0),
|
||||||
|
MihDropdownField(
|
||||||
|
controller: typeController,
|
||||||
|
hintText: "Business Type",
|
||||||
|
dropdownOptions: const ["Doctors Office", "Other"],
|
||||||
|
editable: true,
|
||||||
|
enableSearch: true,
|
||||||
|
validator: (value) {
|
||||||
|
return MihValidationServices().isEmpty(value);
|
||||||
|
},
|
||||||
|
requiredText: true,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10.0),
|
||||||
|
MihTextFormField(
|
||||||
|
fillColor: MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.secondaryColor(),
|
||||||
|
inputColor: MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.primaryColor(),
|
||||||
|
controller: emailController,
|
||||||
|
multiLineInput: false,
|
||||||
|
requiredText: true,
|
||||||
|
hintText: "Business Email",
|
||||||
|
validator: (value) {
|
||||||
|
return MihValidationServices().validateEmail(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10.0),
|
||||||
|
MihTextFormField(
|
||||||
|
fillColor: MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.secondaryColor(),
|
||||||
|
inputColor: MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.primaryColor(),
|
||||||
|
controller: contactController,
|
||||||
|
multiLineInput: false,
|
||||||
|
requiredText: true,
|
||||||
|
hintText: "Contact Number",
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
return MihValidationServices().isEmpty(value);
|
return MihValidationServices().isEmpty(value);
|
||||||
},
|
},
|
||||||
@@ -296,25 +355,79 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
inputColor: MzanziInnovationHub.of(context)!
|
inputColor: MzanziInnovationHub.of(context)!
|
||||||
.theme
|
.theme
|
||||||
.primaryColor(),
|
.primaryColor(),
|
||||||
controller: nameController,
|
controller: websiteController,
|
||||||
multiLineInput: false,
|
multiLineInput: false,
|
||||||
requiredText: true,
|
requiredText: false,
|
||||||
hintText: "Business Name",
|
hintText: "Business Website",
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
return MihValidationServices().isEmpty(value);
|
return MihValidationServices()
|
||||||
|
.validateWebsite(value, false);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(height: 15.0),
|
const SizedBox(height: 10.0),
|
||||||
MihDropdownField(
|
MihTextFormField(
|
||||||
controller: typeController,
|
height: 250,
|
||||||
hintText: "Business Type",
|
fillColor: MzanziInnovationHub.of(context)!
|
||||||
dropdownOptions: const ["Doctors Office", "Other"],
|
.theme
|
||||||
editable: true,
|
.secondaryColor(),
|
||||||
enableSearch: true,
|
inputColor: MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.primaryColor(),
|
||||||
|
controller: missionVisionController,
|
||||||
|
multiLineInput: true,
|
||||||
|
requiredText: true,
|
||||||
|
hintText: "Business Mission & Vision",
|
||||||
|
validator: (value) {
|
||||||
|
return MihValidationServices().validateLength(
|
||||||
|
missionVisionController.text, 256);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 15,
|
||||||
|
child: ValueListenableBuilder(
|
||||||
|
valueListenable: _counter,
|
||||||
|
builder:
|
||||||
|
(BuildContext context, int value, Widget? child) {
|
||||||
|
return Row(
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"$value",
|
||||||
|
style: TextStyle(
|
||||||
|
color: getMissionVisionLimitColor(256),
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 5),
|
||||||
|
Text(
|
||||||
|
"/256",
|
||||||
|
style: TextStyle(
|
||||||
|
color: getMissionVisionLimitColor(256),
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10.0),
|
||||||
|
|
||||||
|
MihTextFormField(
|
||||||
|
fillColor: MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.secondaryColor(),
|
||||||
|
inputColor: MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.primaryColor(),
|
||||||
|
controller: regController,
|
||||||
|
multiLineInput: false,
|
||||||
|
requiredText: true,
|
||||||
|
hintText: "Registration No.",
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
return MihValidationServices().isEmpty(value);
|
return MihValidationServices().isEmpty(value);
|
||||||
},
|
},
|
||||||
requiredText: true,
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10.0),
|
const SizedBox(height: 10.0),
|
||||||
ValueListenableBuilder(
|
ValueListenableBuilder(
|
||||||
@@ -362,38 +475,6 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10.0),
|
const SizedBox(height: 10.0),
|
||||||
MihTextFormField(
|
|
||||||
fillColor: MzanziInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.secondaryColor(),
|
|
||||||
inputColor: MzanziInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.primaryColor(),
|
|
||||||
controller: contactController,
|
|
||||||
multiLineInput: false,
|
|
||||||
requiredText: true,
|
|
||||||
hintText: "Contact Number",
|
|
||||||
validator: (value) {
|
|
||||||
return MihValidationServices().isEmpty(value);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10.0),
|
|
||||||
MihTextFormField(
|
|
||||||
fillColor: MzanziInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.secondaryColor(),
|
|
||||||
inputColor: MzanziInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.primaryColor(),
|
|
||||||
controller: emailController,
|
|
||||||
multiLineInput: false,
|
|
||||||
requiredText: true,
|
|
||||||
hintText: "Business Email",
|
|
||||||
validator: (value) {
|
|
||||||
return MihValidationServices().validateEmail(value);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10.0),
|
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
@@ -573,6 +654,7 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
super.initState();
|
||||||
typeController.addListener(typeSelected);
|
typeController.addListener(typeSelected);
|
||||||
setState(() {
|
setState(() {
|
||||||
fnameController.text = widget.signedInUser.fname;
|
fnameController.text = widget.signedInUser.fname;
|
||||||
@@ -584,7 +666,11 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
} else {
|
} else {
|
||||||
env = "Dev";
|
env = "Dev";
|
||||||
}
|
}
|
||||||
super.initState();
|
missionVisionController.addListener(() {
|
||||||
|
setState(() {
|
||||||
|
_counter.value = missionVisionController.text.characters.length;
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
Reference in New Issue
Block a user