地图组件和ECS框架完成

This commit is contained in:
2026-01-13 15:39:45 +08:00
parent 9d45d4c726
commit 566ec47a73
24 changed files with 17072 additions and 66 deletions

View File

@@ -0,0 +1,35 @@
import 'package:flutter/material.dart';
import '/utils/map_styles.dart';
class StyleDropdown extends StatefulWidget {
const StyleDropdown({required this.onChanged, super.key});
final void Function(MapStyles style) onChanged;
static MapStyles get initStyle => MapStyles.openMapTilesLiberty;
@override
State<StyleDropdown> createState() => _StyleDropdownState();
}
class _StyleDropdownState extends State<StyleDropdown> {
late MapStyles _selectedStyle = StyleDropdown.initStyle;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: DropdownButton<MapStyles>(
value: _selectedStyle,
items: MapStyles.values
.map((e) => DropdownMenuItem(value: e, child: Text(e.name)))
.toList(growable: false),
onChanged: (value) {
if (value == null) return;
setState(() => _selectedStyle = value);
widget.onChanged(value);
},
),
);
}
}