diff --git a/fbla_ui/lib/pages/create_edit_business.dart b/fbla_ui/lib/pages/create_edit_business.dart index b6ec954..1b44aac 100644 --- a/fbla_ui/lib/pages/create_edit_business.dart +++ b/fbla_ui/lib/pages/create_edit_business.dart @@ -287,79 +287,6 @@ class _CreateEditBusinessState extends State { ), ), ), - - // 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: const EdgeInsets.only( left: 8.0, right: 8.0, bottom: 16.0), @@ -408,7 +335,9 @@ class _CreateEditBusinessState extends State { (value == null || value.isEmpty)) { 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 null; @@ -540,15 +469,26 @@ class _CreateEditBusinessState extends State { child: Padding( padding: const EdgeInsets.all(8.0), child: FilledButton( - child: const Row( + child: Row( mainAxisSize: MainAxisSize.min, children: [ Padding( - padding: EdgeInsets.only( + padding: const EdgeInsets.only( 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, + ), + ) + : const Icon(Icons.save), ), - Text('Save'), + const Text('Save'), ], ), onPressed: () async { diff --git a/fbla_ui/lib/pages/create_edit_listing.dart b/fbla_ui/lib/pages/create_edit_listing.dart index 141e9c9..d1ca11b 100644 --- a/fbla_ui/lib/pages/create_edit_listing.dart +++ b/fbla_ui/lib/pages/create_edit_listing.dart @@ -210,6 +210,53 @@ class _CreateEditJobListingState extends State { Card( child: Column( 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( + 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 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( alignment: Alignment.centerLeft, child: Wrap( @@ -284,53 +331,6 @@ class _CreateEditJobListingState extends State { ], ), ), - Align( - alignment: Alignment.centerLeft, - child: Padding( - padding: const EdgeInsets.only( - left: 8.0, - right: 8.0, - bottom: 16.0, - top: 8.0), - child: DropdownMenu( - 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 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: const EdgeInsets.only( left: 8.0, @@ -488,9 +488,9 @@ class _CreateEditJobListingState extends State { strokeWidth: 3.0, ), ) - : Icon(Icons.save), + : const Icon(Icons.save), ), - Text('Save'), + const Text('Save'), ], ), onPressed: () async {