location_context 1.0.3+1
location_context #
Helper functions to share location data using InheritedWidgets
This plugin is also available on pub
Getting Started #
For help getting started with Flutter, view our online documentation. You can also visit us at Flutter Institute
For help on editing package code, view the documentation.
[1.0.3+1] - 2018-08-24
- Fixing version numbers in the changelog, because I forgot to save it.
[1.0.3] - 2018-08-24
- Streamlining the Location dependency injection in context.dart
- Fixing the compiler errors in context.dart related to dart 2
- Adding an example application for how to use this
- Updating quiver dependency to match the flutter sdk dependency
[1.0.2] - 2018-08-03
- Optimizing the Postion class for better comparisons
[1.0.1] - 2018-07-18
- Removing unused import from the test files
[1.0.0] - 2018-07-17
- Initial release for sharing location data using InheritedWidget
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:location_context/location_context.dart';
const MAPS_API_KEY = 'AIzaSyB0vykgvACInKwdBKsrgvJwOVIvC2AHEdU';
void main() => runApp(LocationContextExampleApp());
class LocationContextExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return LocationContext.around(
MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MapViewPage(),
),
);
}
}
class MapViewPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final LocationContext loc = LocationContext.of(context);
final Size size = MediaQuery.of(context).size;
final List<Widget> children = List();
if (loc.error != null) {
children.add(Center(
child: Text('Error ${loc.error}', style: TextStyle(color: Colors.red)),
));
} else {
final Position pos = loc.currentLocation;
if (pos != null) {
Uri uri = Uri.https('maps.googleapis.com', 'maps/api/staticmap', {
'center': '${pos.latitude},${pos.longitude}',
'zoom': '18',
'size': '${size.width.floor()}x${size.height.floor()}',
'key': MAPS_API_KEY,
'markers': 'color:blue|size:small|${pos.latitude},${pos.longitude}',
});
children.addAll(<Widget>[
Expanded(
child: Image.network(uri.toString()),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Expanded(child: Center(child: Text('Latitude: ${pos.latitude}'))),
Expanded(child: Center(child: Text('Longitude: ${pos.longitude}'))),
],
),
]);
} else {
children.add(Center(child: Text('Location Not Found')));
}
}
return Scaffold(
appBar: AppBar(
title: Text('Location Context Example'),
),
body: Column(
children: children,
),
);
}
}
Use this package as a library
1. Depend on it
Add this to your package's pubspec.yaml file:
dependencies:
location_context: ^1.0.3+1
2. Install it
You can install packages from the command line:
with Flutter:
$ flutter pub get
Alternatively, your editor might support flutter pub get
.
Check the docs for your editor to learn more.
3. Import it
Now in your Dart code, you can use:
import 'package:location_context/location_context.dart';
Popularity:
Describes how popular the package is relative to other packages.
[more]
|
13
|
Health:
Code health derived from static analysis.
[more]
|
100
|
Maintenance:
Reflects how tidy and up-to-date the package is.
[more]
|
62
|
Overall:
Weighted score of the above.
[more]
|
49
|
We analyzed this package on Dec 7, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
- Dart: 2.6.1
- pana: 0.12.21
- Flutter: 1.9.1+hotfix.6
Platforms
Detected platforms: Flutter
References Flutter, and has no conflicting libraries.
Maintenance issues and suggestions
Support latest dependencies. (-10 points)
The version constraint in pubspec.yaml
does not support the latest published versions for 1 dependency (location
).
Package is getting outdated. (-28.49 points)
The package was last published 67 weeks ago.
Dependencies
Package | Constraint | Resolved | Available |
---|---|---|---|
Direct dependencies | |||
Dart SDK | >=1.20.1 <3.0.0 | ||
flutter | 0.0.0 | ||
location | ^1.3.4 | 1.4.1 | 2.3.5 |
quiver | ^2.0.0+1 | 2.1.2+1 | |
Transitive dependencies | |||
collection | 1.14.11 | 1.14.12 | |
matcher | 0.12.6 | ||
meta | 1.1.7 | 1.1.8 | |
path | 1.6.4 | ||
sky_engine | 0.0.99 | ||
stack_trace | 1.9.3 | ||
typed_data | 1.1.6 | ||
vector_math | 2.0.8 | ||
Dev dependencies | |||
flutter_test |