buildMapSourceSection function
Builds the map source selection section.
Implementation
Widget buildMapSourceSection({
required MapSource mapSource,
required void Function(MapSource) onMapSourceChanged,
}) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Map Source',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.grey,
),
),
const SizedBox(height: 12),
Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey.shade300),
borderRadius: BorderRadius.circular(12),
),
child: DropdownButton<MapSource>(
value: mapSource,
isExpanded: true,
underline: const SizedBox(),
icon: const Icon(Icons.arrow_drop_down),
items: MapSource.values.map((source) {
return DropdownMenuItem<MapSource>(
value: source,
child: Row(
children: [
Icon(source.icon, size: 20, color: Colors.grey.shade700),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
source.displayName,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
),
),
Text(
source.description,
style: TextStyle(
fontSize: 11,
color: Colors.grey.shade600,
),
),
],
),
),
],
),
);
}).toList(),
onChanged: (MapSource? newValue) {
if (newValue != null) {
onMapSourceChanged(newValue);
}
},
),
),
],
);
}