edit profile changes

master
gitadmin 1 month ago
parent 00f3473d02
commit c9ed7a8cfb

@ -25,6 +25,7 @@ class _FleetEmployeesState extends State<FleetEmployees> {
final _nameCtrl = TextEditingController();
final _mobileCtrl = TextEditingController();
final _altMobileCtrl = TextEditingController();
final _locationCtrl = TextEditingController();
final List<String> licenseNumbers = [
"UP3220050012345",
@ -43,6 +44,9 @@ class _FleetEmployeesState extends State<FleetEmployees> {
_fetchDrivers();
}
String? _status; // 'available' | 'on delivery' | 'offline'
final List<String> _statusOptions = const ['available', 'on delivery', 'offline'];
Future<void> _fetchDrivers() async {
setState(() => isLoading = true);
try {
@ -371,8 +375,9 @@ class _FleetEmployeesState extends State<FleetEmployees> {
inputFormatters: const [
FirstCharUppercaseFormatter(), // << live first-letter caps
],
decoration: const InputDecoration(
decoration: InputDecoration(
hintText: "Full Name",
hintStyle: fontTextStyle(14, const Color(0xFF939495), FontWeight.w400),
border: OutlineInputBorder(),
isDense: true,
),
@ -421,8 +426,9 @@ class _FleetEmployeesState extends State<FleetEmployees> {
FilteringTextInputFormatter.digitsOnly,
LengthLimitingTextInputFormatter(10),
],
decoration: const InputDecoration(
decoration: InputDecoration(
hintText: "Mobile Number",
hintStyle: fontTextStyle(14, const Color(0xFF939495), FontWeight.w400),
border: OutlineInputBorder(),
isDense: true,
),
@ -437,13 +443,56 @@ class _FleetEmployeesState extends State<FleetEmployees> {
FilteringTextInputFormatter.digitsOnly,
LengthLimitingTextInputFormatter(10),
],
decoration: const InputDecoration(
decoration: InputDecoration(
hintText: "Mobile Number",
hintStyle: fontTextStyle(14, const Color(0xFF939495), FontWeight.w400),
border: OutlineInputBorder(),
isDense: true,
),
),
),
_LabeledField(
label: "Location *",
child: TextFormField(
controller: _locationCtrl,
validator: (v) => _required(v, field: "Location"),
textCapitalization: TextCapitalization.none,
inputFormatters: const [
FirstCharUppercaseFormatter(), // << live first-letter caps
],
decoration: InputDecoration(
hintText: "Area / locality",
hintStyle: fontTextStyle(14, const Color(0xFF939495), FontWeight.w400),
border: const OutlineInputBorder(),
isDense: true,
),
textInputAction: TextInputAction.done,
),
),
_LabeledField(
label: "Status *",
child: DropdownButtonFormField<String>(
value: _status,
items: _statusOptions
.map((s) => DropdownMenuItem(value: s, child: Text(s)))
.toList(),
onChanged: (v) => setState(() => _status = v),
validator: (v) => v == null || v.isEmpty ? "Status is required" : null,
isExpanded: true,
alignment: Alignment.centerLeft,
hint: Text(
"Select status",
style: fontTextStyle(14, const Color(0xFF939495), FontWeight.w400),
),
icon: const Icon(Icons.keyboard_arrow_down_rounded),
decoration: const InputDecoration(
border: OutlineInputBorder(),
isDense: false,
contentPadding: EdgeInsets.symmetric(horizontal: 12, vertical: 14),
),
),
),
const SizedBox(height: 16),
ElevatedButton(
onPressed: _addDriver,

@ -215,6 +215,87 @@ class _SourceLocationState extends State<SourceLocation> {
width: double.infinity,
child: OutlinedButton.icon(
onPressed: () {
// Your PlacePicker flow goes here (kept commented for reference)
location.serviceEnabled().then((value) {
if (value) {
initRenderer();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return PlacePicker(
resizeToAvoidBottomInset: false,
hintText: "Find a place ...",
searchingText: "Please wait ...",
selectText: "Select place",
outsideOfPickAreaText: "Place not in area",
initialPosition: kInitialPosition,
useCurrentLocation: true,
selectInitialPosition: true,
usePinPointingSearch: true,
usePlaceDetailSearch: true,
zoomGesturesEnabled: true,
zoomControlsEnabled: true,
onMapCreated: (GoogleMapController controller) {},
onPlacePicked: (PickResult result) {
setState(() {
selectedPlace = result;
lat = selectedPlace!.geometry!.location.lat;
lng = selectedPlace!.geometry!.location.lng;
if (selectedPlace!.types!.length == 1) {
address = selectedPlace!.formattedAddress!;
} else {
address = '${selectedPlace!.name!}, ${selectedPlace!.formattedAddress!}';
}
Navigator.of(context).pop();
});
},
onMapTypeChanged: (MapType mapType) {},
apiKey: Platform.isAndroid ? APIKeys.androidApiKey : APIKeys.iosApiKey,
forceAndroidLocationManager: true,
);
},
),
);
} else {
showGeneralDialog(
context: context,
pageBuilder: (context, x, y) {
return Scaffold(
backgroundColor: Colors.grey.withOpacity(.5),
body: Center(
child: Container(
width: double.infinity,
height: 150,
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Card(
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
"Please enable the location",
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
),
const SizedBox(height: 20),
ElevatedButton(
onPressed: () {
Navigator.pop(context);
},
child: const Text("Cancel"),
),
],
),
),
),
),
),
);
},
);
}
});
},
icon: Image.asset('images/Add_icon.png', width: 16, height: 16),
label: Text(
@ -228,6 +309,7 @@ class _SourceLocationState extends State<SourceLocation> {
),
),
_LabeledField(
label: "Water Type *",
child: DropdownButtonFormField<String>(
@ -356,8 +438,10 @@ class _SourceLocationState extends State<SourceLocation> {
child: Column(
children: [
ListTile(
dense: true,
contentPadding: EdgeInsets.zero,
dense: true, // makes tile shorter
contentPadding: EdgeInsets.zero, // removes default horizontal padding
minVerticalPadding: 0,
visualDensity: const VisualDensity(vertical: -4, horizontal: 0),
title: Text(
d.source_name ?? 'Unnamed location',
style: fontTextStyle(

Loading…
Cancel
Save