Skip to content

Commit

Permalink
fix(mobile): location picker show buttons above navigation bar
Browse files Browse the repository at this point in the history
  • Loading branch information
shenlong-tanwen committed Jan 27, 2024
1 parent 871b948 commit 6ecf0f4
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 35 deletions.
8 changes: 4 additions & 4 deletions mobile/lib/extensions/build_context_extensions.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import 'package:flutter/material.dart';

extension ContextHelper on BuildContext {
// Returns the current size from MediaQuery
Size get size => MediaQuery.sizeOf(this);
// Returns the current padding from MediaQuery
EdgeInsets get padding => MediaQuery.paddingOf(this);

// Returns the current width from MediaQuery
double get width => size.width;
double get width => MediaQuery.sizeOf(this).width;

// Returns the current height from MediaQuery
double get height => size.height;
double get height => MediaQuery.sizeOf(this).height;

// Returns true if the app is running on a mobile device (!tablets)
bool get isMobile => width < 550;
Expand Down
66 changes: 35 additions & 31 deletions mobile/lib/modules/map/views/map_location_picker_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,38 +140,42 @@ class _BottomBar extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SizedBox(
height: 150,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(Icons.public, size: 18),
const SizedBox(width: 15),
ValueListenableBuilder(
valueListenable: selectedLatLng,
builder: (_, value, __) => Text(
"${value.latitude.toStringAsFixed(4)}, ${value.longitude.toStringAsFixed(4)}",
height: 150 + context.padding.bottom,
child: Padding(
padding: EdgeInsets.only(bottom: context.padding.bottom),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(Icons.public, size: 18),
const SizedBox(width: 15),
ValueListenableBuilder(
valueListenable: selectedLatLng,
builder: (_, value, __) => Text(
"${value.latitude.toStringAsFixed(4)}, ${value.longitude.toStringAsFixed(4)}",
),
),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
ElevatedButton(
onPressed: onUseLocation,
child: const Text("map_location_picker_page_use_location").tr(),
),
ElevatedButton(
onPressed: onGetCurrentLocation,
child: const Icon(Icons.my_location),
),
],
),
],
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
ElevatedButton(
onPressed: onUseLocation,
child:
const Text("map_location_picker_page_use_location").tr(),
),
ElevatedButton(
onPressed: onGetCurrentLocation,
child: const Icon(Icons.my_location),
),
],
),
],
),
),
);
}
Expand Down

0 comments on commit 6ecf0f4

Please sign in to comment.