Fix map and add new button

This commit is contained in:
Yoshi 2024-08-28 21:52:42 +03:00
parent 1ea344c69a
commit 1d7cbbd1bf
3 changed files with 35 additions and 8 deletions

View file

@ -148,6 +148,11 @@ class _SelectGeolocationState extends State<SelectGeolocation> {
37.6156,
),
initialZoom: 3,
interactionOptions:
const InteractionOptions(
flags: InteractiveFlag.all &
~InteractiveFlag.rotate,
),
cameraConstraint:
CameraConstraint.contain(
bounds: LatLngBounds(

View file

@ -38,11 +38,15 @@ class _MapWeatherState extends State<MapWeather> with TickerProviderStateMixin {
final statusData = StatusData();
final Future<CacheStore> _cacheStoreFuture = _getCacheStore();
final GlobalKey<ExpandableFabState> _fabKey = GlobalKey<ExpandableFabState>();
final bool _isDarkMode = Get.theme.brightness == Brightness.dark;
WeatherCard? _selectedWeatherCard;
bool _isCardVisible = false;
late final AnimationController _animationController;
late final Animation<Offset> _offsetAnimation;
static const _useTransformerId = 'useTransformerId';
final bool _useTransformer = true;
final _focusNode = FocusNode();
late final TextEditingController _controllerSearch = TextEditingController();
@ -79,6 +83,7 @@ class _MapWeatherState extends State<MapWeather> with TickerProviderStateMixin {
void _resetMapOrientation({LatLng? center, double? zoom}) {
_animatedMapController.animateTo(
customId: _useTransformer ? _useTransformerId : null,
dest: center,
zoom: zoom,
rotation: 0,
@ -93,6 +98,10 @@ class _MapWeatherState extends State<MapWeather> with TickerProviderStateMixin {
});
_animationController.forward();
_isCardVisible = true;
if (_fabKey.currentState?.isOpen == true) {
_fabKey.currentState?.toggle();
}
}
void _hideCard() {
@ -241,7 +250,10 @@ class _MapWeatherState extends State<MapWeather> with TickerProviderStateMixin {
options: MapOptions(
backgroundColor: context.theme.colorScheme.surface,
initialCenter: LatLng(mainLocation.lat!, mainLocation.lon!),
initialZoom: 12,
initialZoom: 8,
interactionOptions: const InteractionOptions(
flags: InteractiveFlag.all & ~InteractiveFlag.rotate,
),
cameraConstraint: CameraConstraint.contain(
bounds: LatLngBounds(
const LatLng(-90, -180),
@ -303,8 +315,9 @@ class _MapWeatherState extends State<MapWeather> with TickerProviderStateMixin {
);
}),
ExpandableFab(
key: _fabKey,
pos: ExpandableFabPos.right,
type: ExpandableFabType.fan,
type: ExpandableFabType.up,
distance: 70,
openButtonBuilder: RotateFloatingActionButtonBuilder(
child: const Icon(IconsaxPlusLinear.menu),
@ -317,16 +330,25 @@ class _MapWeatherState extends State<MapWeather> with TickerProviderStateMixin {
children: [
FloatingActionButton(
heroTag: null,
child: const Icon(IconsaxPlusLinear.gps),
child: const Icon(IconsaxPlusLinear.home_2),
onPressed: () => _resetMapOrientation(
center:
LatLng(mainLocation.lat!, mainLocation.lon!),
zoom: 12),
zoom: 8),
),
FloatingActionButton(
heroTag: null,
child: const Icon(IconsaxPlusLinear.refresh_2),
onPressed: () => _resetMapOrientation(),
child: const Icon(IconsaxPlusLinear.search_zoom_out_1),
onPressed: () => _animatedMapController.animatedZoomOut(
customId: _useTransformer ? _useTransformerId : null,
),
),
FloatingActionButton(
heroTag: null,
child: const Icon(IconsaxPlusLinear.search_zoom_in),
onPressed: () => _animatedMapController.animatedZoomIn(
customId: _useTransformer ? _useTransformerId : null,
),
),
],
),

View file

@ -50,7 +50,7 @@ dependencies:
flutter_local_notifications: ^17.2.2
internet_connection_checker_plus: ^2.5.1
dio_cache_interceptor_file_store: ^1.2.2
isar:
isar:
version: ^3.1.8
hosted: https://pub.isar-community.dev/
isar_flutter_libs:
@ -74,7 +74,7 @@ dev_dependencies:
json_serializable: ^6.8.0
flutter_native_splash: ^2.4.1
flutter_launcher_icons: ^0.13.1
isar_generator:
isar_generator:
version: ^3.1.8
hosted: https://pub.isar-community.dev/