mirror of
https://github.com/TrentSPalmer/libre_gps_parser.git
synced 2025-08-23 04:23:57 -07:00
implement share to mapquest
This commit is contained in:
@@ -55,7 +55,7 @@ InkWell aboutApp(BuildContext context) {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'Version: 0.1.4\n',
|
||||
'Version: 0.1.5\n',
|
||||
style: TextStyle(
|
||||
color: candyApple,
|
||||
),
|
||||
@@ -166,7 +166,8 @@ InkWell aboutApp(BuildContext context) {
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@@ -435,6 +435,19 @@ Future<bool> setPreferenceUseWeather(bool useWeather) async {
|
||||
return (committed);
|
||||
}
|
||||
|
||||
Future<bool> getPreferenceUseShareToMapQuest() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
bool _useShareToMapQuest = prefs.getBool("useShareToMapQuest") ?? false;
|
||||
return _useShareToMapQuest;
|
||||
}
|
||||
|
||||
Future<bool> setPreferenceUseShareToMapQuest(bool useShareToMapQuest) async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
bool committed = await prefs.setBool("useShareToMapQuest", useShareToMapQuest);
|
||||
return (committed);
|
||||
}
|
||||
|
||||
|
||||
Future<String> getPreferenceDBExportFileName() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
String dbExportFileName =
|
||||
|
132
lib/lnl_dec.dart
132
lib/lnl_dec.dart
@@ -5,8 +5,9 @@ import 'package:share/share.dart';
|
||||
|
||||
final double textHeight = 1.5;
|
||||
|
||||
Row lnlDec(String latnLong) {
|
||||
Future<void> _launchLnL() async {
|
||||
Row lnlDec(String latnLong,BuildContext context) {
|
||||
|
||||
Future<void> _launchLnLgMaps() async {
|
||||
AndroidIntent intent = AndroidIntent(
|
||||
action: 'action_view',
|
||||
data: Uri.encodeFull('geo:$latnLong?z=12'),
|
||||
@@ -15,6 +16,133 @@ Row lnlDec(String latnLong) {
|
||||
await intent.launch();
|
||||
}
|
||||
|
||||
Future<void> _launchLnLqMaps() async {
|
||||
AndroidIntent intent = AndroidIntent(
|
||||
action: 'action_view',
|
||||
data: Uri.encodeFull('geo:$latnLong'),
|
||||
package: 'com.mapquest.android.ace',
|
||||
);
|
||||
await intent.launch();
|
||||
}
|
||||
|
||||
Future<void> _launchLnL() async {
|
||||
bool _useShareToMapQuest = await getPreferenceUseShareToMapQuest();
|
||||
if (_useShareToMapQuest) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
backgroundColor: ivory,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(6.0)),
|
||||
),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
margin: EdgeInsets.only(
|
||||
top: 40,
|
||||
bottom: 10,
|
||||
),
|
||||
child: Wrap(
|
||||
runSpacing: 30,
|
||||
alignment: WrapAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(
|
||||
horizontal: 15,
|
||||
),
|
||||
child: ButtonTheme(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(6.0)),
|
||||
),
|
||||
height: 75,
|
||||
child: RaisedButton(
|
||||
color: peacockBlue,
|
||||
child: Icon(
|
||||
Icons.arrow_back,
|
||||
size: 48.0,
|
||||
color: Colors.white,
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
}),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(
|
||||
horizontal: 15,
|
||||
),
|
||||
child: ButtonTheme(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(6.0)),
|
||||
),
|
||||
height: 75,
|
||||
child: RaisedButton(
|
||||
color: peacockBlue,
|
||||
child: Text(
|
||||
"MapQuest",
|
||||
style: TextStyle(
|
||||
height: textHeight,
|
||||
color: Colors.white,
|
||||
fontSize: 24,
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
_launchLnLqMaps();
|
||||
}),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(
|
||||
horizontal: 15,
|
||||
),
|
||||
child: ButtonTheme(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(6.0)),
|
||||
),
|
||||
height: 75,
|
||||
child: RaisedButton(
|
||||
color: peacockBlue,
|
||||
child: Text(
|
||||
"GoogleMaps",
|
||||
style: TextStyle(
|
||||
height: textHeight,
|
||||
color: Colors.white,
|
||||
fontSize: 24,
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
_launchLnLgMaps();
|
||||
}
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
await _launchLnLgMaps();
|
||||
}
|
||||
}
|
||||
|
||||
List<String> _latNLong = ['x', 'y'];
|
||||
if ((latnLong == 'none') || (latnLong == null)) {
|
||||
return Row(
|
||||
|
@@ -286,8 +286,8 @@ class _LatNLongState extends State<LatNLong> {
|
||||
padding: myBoxPadding,
|
||||
decoration: myBoxDecoration(ivory),
|
||||
child: (this.latnLong != null)
|
||||
? lnlDec(this.latnLong)
|
||||
: lnlDec('none'),
|
||||
? lnlDec(this.latnLong,context)
|
||||
: lnlDec('none',context),
|
||||
),
|
||||
IntrinsicHeight(
|
||||
child: Row(
|
||||
@@ -493,8 +493,8 @@ class _LatNLongState extends State<LatNLong> {
|
||||
padding: myBoxPadding,
|
||||
decoration: myBoxDecoration(ivory),
|
||||
child: (this.latnLong != null)
|
||||
? lnlDec(this.latnLong)
|
||||
: lnlDec('none'),
|
||||
? lnlDec(this.latnLong,context)
|
||||
: lnlDec('none',context),
|
||||
),
|
||||
IntrinsicHeight(
|
||||
child: Row(
|
||||
@@ -641,8 +641,8 @@ class _LatNLongState extends State<LatNLong> {
|
||||
padding: myBoxPadding,
|
||||
decoration: myBoxDecoration(ivory),
|
||||
child: (this.latnLong != null)
|
||||
? lnlDec(this.latnLong)
|
||||
: lnlDec('none'),
|
||||
? lnlDec(this.latnLong,context)
|
||||
: lnlDec('none',context),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
|
@@ -22,6 +22,7 @@ class _SettingsState extends State<Settings> {
|
||||
final _oWMKController = TextEditingController();
|
||||
bool _useElevation = false;
|
||||
bool _useWeather = false;
|
||||
bool _useShareToMapQuest = false;
|
||||
double textHeight = 1.5;
|
||||
|
||||
@override
|
||||
@@ -600,6 +601,42 @@ class _SettingsState extends State<Settings> {
|
||||
),
|
||||
)
|
||||
: Container()),
|
||||
Container(
|
||||
padding: myBoxPadding,
|
||||
decoration: myBoxDecoration(ivory),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Enable Share Decimal Coordinates to MapQuest?',
|
||||
style: TextStyle(
|
||||
height: textHeight,
|
||||
fontSize: 20,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.all(15.0),
|
||||
child: Transform.scale(
|
||||
scale: 2,
|
||||
child: Switch(
|
||||
value: this._useShareToMapQuest,
|
||||
onChanged: (value) {
|
||||
setPreferenceUseShareToMapQuest(value).then((bool committed) {
|
||||
setState(() {
|
||||
this._useShareToMapQuest = value;
|
||||
});
|
||||
});
|
||||
},
|
||||
activeTrackColor: peacockBlue,
|
||||
activeColor: navy,
|
||||
inactiveThumbColor: candyApple,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: myBoxPadding,
|
||||
decoration: myBoxDecoration(ivory),
|
||||
@@ -706,6 +743,7 @@ class _SettingsState extends State<Settings> {
|
||||
String _dbEFNS = await getPreferenceDBExportFileName();
|
||||
bool _useElev = await getPreferenceUseElevation();
|
||||
bool _useWTHR = await getPreferenceUseWeather();
|
||||
bool _useShareToMQst = await getPreferenceUseShareToMapQuest();
|
||||
setState(() {
|
||||
this.elevationServer = _evServer;
|
||||
this.openWeatherMapKey = _oWMK;
|
||||
@@ -713,6 +751,7 @@ class _SettingsState extends State<Settings> {
|
||||
this._useWeather = _useWTHR;
|
||||
this.shortOWMAK = _oWMK.substring(0, 5);
|
||||
this._dbExportFileNameString = _dbEFNS;
|
||||
this._useShareToMapQuest = _useShareToMQst;
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user