Added OSM Location Picker
This commit is contained in:
parent
a447233d41
commit
39956cff02
desk_watch
@ -44,10 +44,11 @@ android {
|
||||
defaultConfig {
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId "com.example.desk_watch"
|
||||
minSdkVersion flutter.minSdkVersion
|
||||
minSdkVersion 19
|
||||
targetSdkVersion flutter.targetSdkVersion
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
multiDexEnabled true
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
@ -1 +1,2 @@
|
||||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
|
||||
#include "Generated.xcconfig"
|
||||
|
@ -1 +1,2 @@
|
||||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
|
||||
#include "Generated.xcconfig"
|
||||
|
41
desk_watch/ios/Podfile
Normal file
41
desk_watch/ios/Podfile
Normal file
@ -0,0 +1,41 @@
|
||||
# Uncomment this line to define a global platform for your project
|
||||
# platform :ios, '9.0'
|
||||
|
||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||
|
||||
project 'Runner', {
|
||||
'Debug' => :debug,
|
||||
'Profile' => :release,
|
||||
'Release' => :release,
|
||||
}
|
||||
|
||||
def flutter_root
|
||||
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
|
||||
unless File.exist?(generated_xcode_build_settings_path)
|
||||
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
|
||||
end
|
||||
|
||||
File.foreach(generated_xcode_build_settings_path) do |line|
|
||||
matches = line.match(/FLUTTER_ROOT\=(.*)/)
|
||||
return matches[1].strip if matches
|
||||
end
|
||||
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
|
||||
end
|
||||
|
||||
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
|
||||
|
||||
flutter_ios_podfile_setup
|
||||
|
||||
target 'Runner' do
|
||||
use_frameworks!
|
||||
use_modular_headers!
|
||||
|
||||
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
|
||||
end
|
||||
|
||||
post_install do |installer|
|
||||
installer.pods_project.targets.each do |target|
|
||||
flutter_additional_ios_build_settings(target)
|
||||
end
|
||||
end
|
@ -1,10 +1,32 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_osm_plugin/flutter_osm_plugin.dart';
|
||||
|
||||
class settingsPage extends StatelessWidget {
|
||||
class settingsPage extends StatefulWidget {
|
||||
const settingsPage({
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<settingsPage> createState() => _settingsPageState();
|
||||
}
|
||||
|
||||
class TextGeoPoint extends GeoPoint {
|
||||
TextGeoPoint({required double latitude, required double longitude})
|
||||
: super(latitude: latitude, longitude: longitude);
|
||||
|
||||
TextGeoPoint.fromGeoPoint(GeoPoint p)
|
||||
: super(latitude: p.latitude, longitude: p.longitude);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return latitude.toStringAsFixed(3) + ', ' + longitude.toStringAsFixed(3);
|
||||
}
|
||||
}
|
||||
|
||||
class _settingsPageState extends State<settingsPage> {
|
||||
TextGeoPoint _homeLocation = TextGeoPoint(latitude: 48.8, longitude: 9.9);
|
||||
TextGeoPoint _workLocation = TextGeoPoint(latitude: 48.8, longitude: 9.9);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ButtonStyle updateStyle = ElevatedButton.styleFrom(
|
||||
@ -26,12 +48,28 @@ class settingsPage extends StatelessWidget {
|
||||
body: Column(
|
||||
children: [
|
||||
Text('Home', style: textHeadStyle),
|
||||
Text('35.2525, 49.2525', style: textGPSStyle),
|
||||
Text('$_homeLocation', style: textGPSStyle),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: ElevatedButton(
|
||||
style: updateStyle,
|
||||
onPressed: () {},
|
||||
onPressed: () async {
|
||||
var p = await showSimplePickerLocation(
|
||||
context: context,
|
||||
isDismissible: true,
|
||||
title: "Home Location Picker",
|
||||
textConfirmPicker: "pick",
|
||||
initCurrentUserPosition: false,
|
||||
initZoom: 8,
|
||||
initPosition: _homeLocation,
|
||||
radius: 8.0,
|
||||
);
|
||||
if (p != null) {
|
||||
setState(() {
|
||||
_homeLocation = TextGeoPoint.fromGeoPoint(p);
|
||||
});
|
||||
}
|
||||
},
|
||||
child: const Text('Update'),
|
||||
),
|
||||
),
|
||||
@ -44,12 +82,28 @@ class settingsPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Text('Work', style: textHeadStyle),
|
||||
Text('32.2525, 51.2525', style: textGPSStyle),
|
||||
Text('$_workLocation', style: textGPSStyle),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: ElevatedButton(
|
||||
style: updateStyle,
|
||||
onPressed: () {},
|
||||
onPressed: () async {
|
||||
var p = await showSimplePickerLocation(
|
||||
context: context,
|
||||
isDismissible: true,
|
||||
title: "Work Location Picker",
|
||||
textConfirmPicker: "pick",
|
||||
initCurrentUserPosition: false,
|
||||
initZoom: 8,
|
||||
initPosition: _workLocation,
|
||||
radius: 8.0,
|
||||
);
|
||||
if (p != null) {
|
||||
setState(() {
|
||||
_workLocation = TextGeoPoint.fromGeoPoint(p);
|
||||
});
|
||||
}
|
||||
},
|
||||
child: const Text('Update'),
|
||||
),
|
||||
),
|
||||
|
@ -35,6 +35,7 @@ dependencies:
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^1.0.2
|
||||
http: ^0.13.4
|
||||
flutter_osm_plugin: ^0.33.0+2
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
@ -6,6 +6,9 @@
|
||||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <url_launcher_windows/url_launcher_windows.h>
|
||||
|
||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||
UrlLauncherWindowsRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
#
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
url_launcher_windows
|
||||
)
|
||||
|
||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||
|
Loading…
x
Reference in New Issue
Block a user