more fixes

This commit is contained in:
Drake Marino 2024-06-26 13:30:02 -05:00
parent fd94dbf20d
commit 5614888454
2 changed files with 67 additions and 127 deletions

View File

@ -287,79 +287,6 @@ class _CreateEditBusinessState extends State<CreateEditBusiness> {
), ),
), ),
), ),
// Padding(
// padding: const EdgeInsets.only(
// left: 8.0, right: 8.0, bottom: 16.0),
// child: Row(
// children: [
// ElevatedButton(
// style: ButtonStyle(
// backgroundColor:
// MaterialStateProperty.all(
// Theme.of(context)
// .colorScheme
// .background)),
// child: const Row(
// children: [
// Icon(Icons.search),
// Text('Search For Location'),
// ],
// ),
// onPressed: () {},
// ),
// const Padding(
// padding: EdgeInsets.only(
// left: 32.0, right: 32.0),
// child: Text(
// 'OR',
// style: TextStyle(fontSize: 24),
// ),
// ),
// Expanded(
// child: Column(
// children: [
// TextFormField(
// controller: _locationNameController,
// onChanged: (inputName) {
// setState(() {
// business.locationName =
// inputName;
// });
// },
// onTapOutside:
// (PointerDownEvent event) {
// FocusScope.of(context).unfocus();
// },
// decoration: const InputDecoration(
// labelText:
// 'Location Name (optional)',
// ),
// ),
// TextFormField(
// controller:
// _locationAddressController,
// onChanged: (inputAddr) {
// setState(() {
// business.locationAddress =
// inputAddr;
// });
// },
// onTapOutside:
// (PointerDownEvent event) {
// FocusScope.of(context).unfocus();
// },
// decoration: const InputDecoration(
// labelText:
// 'Location Address (optional)',
// ),
// ),
// ],
// ),
// ),
// ],
// ),
// ),
Padding( Padding(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
left: 8.0, right: 8.0, bottom: 16.0), left: 8.0, right: 8.0, bottom: 16.0),
@ -408,7 +335,9 @@ class _CreateEditBusinessState extends State<CreateEditBusiness> {
(value == null || value.isEmpty)) { (value == null || value.isEmpty)) {
return 'At least one contact method is required'; return 'At least one contact method is required';
} }
if (value != null && value.length != 14) { if (value != null &&
value.isNotEmpty &&
value.length != 14) {
return 'Enter a valid phone number'; return 'Enter a valid phone number';
} }
return null; return null;
@ -540,15 +469,26 @@ class _CreateEditBusinessState extends State<CreateEditBusiness> {
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: FilledButton( child: FilledButton(
child: const Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.only( padding: const EdgeInsets.only(
top: 8.0, right: 8.0, bottom: 8.0), top: 8.0, right: 8.0, bottom: 8.0),
child: Icon(Icons.save), child: _isLoading
? SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator(
color: Theme.of(context)
.colorScheme
.onPrimary,
strokeWidth: 3.0,
), ),
Text('Save'), )
: const Icon(Icons.save),
),
const Text('Save'),
], ],
), ),
onPressed: () async { onPressed: () async {

View File

@ -210,6 +210,53 @@ class _CreateEditJobListingState extends State<CreateEditJobListing> {
Card( Card(
child: Column( child: Column(
children: [ children: [
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.only(
left: 8.0,
right: 8.0,
bottom: 16.0,
top: 8.0),
child: DropdownMenu<int>(
menuHeight: 300,
width: (MediaQuery.sizeOf(context)
.width -
24) <
776
? MediaQuery.sizeOf(context)
.width -
24
: 776,
errorText:
businessDropdownErrorText,
initialSelection:
widget.inputBusiness?.id,
label: const Text(
'Offering Business'),
dropdownMenuEntries: [
for (Map<String, dynamic> map
in nameMapping)
DropdownMenuEntry(
value: map['id']!,
label: map['name'])
],
onSelected: (inputType) {
setState(() {
listing.businessId =
inputType!;
businessName = nameMapping
.where((element) =>
element['id'] ==
listing.businessId)
.first['name'];
businessDropdownErrorText =
null;
});
},
),
),
),
Align( Align(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Wrap( child: Wrap(
@ -284,53 +331,6 @@ class _CreateEditJobListingState extends State<CreateEditJobListing> {
], ],
), ),
), ),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.only(
left: 8.0,
right: 8.0,
bottom: 16.0,
top: 8.0),
child: DropdownMenu<int>(
menuHeight: 300,
width: (MediaQuery.sizeOf(context)
.width -
24) <
776
? MediaQuery.sizeOf(context)
.width -
24
: 776,
errorText:
businessDropdownErrorText,
initialSelection:
widget.inputBusiness?.id,
label: const Text(
'Offering Business'),
dropdownMenuEntries: [
for (Map<String, dynamic> map
in nameMapping)
DropdownMenuEntry(
value: map['id']!,
label: map['name'])
],
onSelected: (inputType) {
setState(() {
listing.businessId =
inputType!;
businessName = nameMapping
.where((element) =>
element['id'] ==
listing.businessId)
.first['name'];
businessDropdownErrorText =
null;
});
},
),
),
),
Padding( Padding(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
left: 8.0, left: 8.0,
@ -488,9 +488,9 @@ class _CreateEditJobListingState extends State<CreateEditJobListing> {
strokeWidth: 3.0, strokeWidth: 3.0,
), ),
) )
: Icon(Icons.save), : const Icon(Icons.save),
), ),
Text('Save'), const Text('Save'),
], ],
), ),
onPressed: () async { onPressed: () async {