mirror of
https://github.com/darkmoonight/Rain.git
synced 2025-06-28 12:09:57 +00:00
Add buttons to the map
This commit is contained in:
parent
d0791279a2
commit
f174c0f336
3 changed files with 33 additions and 4 deletions
|
@ -76,6 +76,16 @@ class _MapWeatherState extends State<MapWeather> with TickerProviderStateMixin {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _resetMapOrientation({LatLng? center, double? zoom}) {
|
||||||
|
_animatedMapController.animateTo(
|
||||||
|
dest: center,
|
||||||
|
zoom: zoom,
|
||||||
|
rotation: 0,
|
||||||
|
duration: const Duration(milliseconds: 500),
|
||||||
|
curve: Curves.easeInOut,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void _onMarkerTap(WeatherCard weatherCard) {
|
void _onMarkerTap(WeatherCard weatherCard) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectedWeatherCard = weatherCard;
|
_selectedWeatherCard = weatherCard;
|
||||||
|
@ -262,6 +272,7 @@ class _MapWeatherState extends State<MapWeather> with TickerProviderStateMixin {
|
||||||
_buildMapTileLayer(cacheStore),
|
_buildMapTileLayer(cacheStore),
|
||||||
RichAttributionWidget(
|
RichAttributionWidget(
|
||||||
animationConfig: const ScaleRAWA(),
|
animationConfig: const ScaleRAWA(),
|
||||||
|
alignment: AttributionAlignment.bottomLeft,
|
||||||
attributions: [
|
attributions: [
|
||||||
TextSourceAttribution(
|
TextSourceAttribution(
|
||||||
'OpenStreetMap contributors',
|
'OpenStreetMap contributors',
|
||||||
|
@ -289,6 +300,24 @@ class _MapWeatherState extends State<MapWeather> with TickerProviderStateMixin {
|
||||||
markers: [mainMarker, ...cardMarkers],
|
markers: [mainMarker, ...cardMarkers],
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
Positioned(
|
||||||
|
bottom: 15,
|
||||||
|
right: 15,
|
||||||
|
child: FloatingActionButton(
|
||||||
|
child: const Icon(IconsaxPlusLinear.gps),
|
||||||
|
onPressed: () => _resetMapOrientation(
|
||||||
|
center: LatLng(mainLocation.lat!, mainLocation.lon!),
|
||||||
|
zoom: 12),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
bottom: 15,
|
||||||
|
right: 85,
|
||||||
|
child: FloatingActionButton(
|
||||||
|
child: const Icon(IconsaxPlusLinear.refresh_square_2),
|
||||||
|
onPressed: () => _resetMapOrientation(),
|
||||||
|
),
|
||||||
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
|
|
|
@ -1267,10 +1267,10 @@ packages:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: vm_service
|
name: vm_service
|
||||||
sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc
|
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "14.2.4"
|
version: "14.2.5"
|
||||||
watcher:
|
watcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -1368,5 +1368,5 @@ packages:
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.2"
|
version: "3.1.2"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=3.5.0 <4.0.0"
|
dart: ">=3.5.1 <4.0.0"
|
||||||
flutter: ">=3.24.0"
|
flutter: ">=3.24.0"
|
||||||
|
|
|
@ -6,7 +6,7 @@ publish_to: "none"
|
||||||
version: 1.3.4+37
|
version: 1.3.4+37
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.5.0 <4.0.0"
|
sdk: ">=3.5.1 <4.0.0"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue