mirror of
https://github.com/hackku21/nearby_connections.git
synced 2026-03-02 03:49:22 +00:00
Update askLocationPermission method (#21)
* enableLocationService return type changed to Future<bool> * typos fixes #15 * fix #15 added to changelog and bug fixes * askLocationPermission return type changed to Future<bool> : fixes #9
This commit is contained in:
@@ -3,8 +3,8 @@ import 'dart:math';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:nearby_connections/nearby_connections.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:nearby_connections/nearby_connections.dart';
|
||||
|
||||
void main() => runApp(MyApp());
|
||||
|
||||
@@ -68,8 +68,15 @@ class _MyBodyState extends State<Body> {
|
||||
),
|
||||
RaisedButton(
|
||||
child: Text("askLocationPermission"),
|
||||
onPressed: () {
|
||||
Nearby().askLocationPermission();
|
||||
onPressed: () async {
|
||||
if (await Nearby().askLocationPermission()) {
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
content: Text("Location Permission granted :)")));
|
||||
} else {
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
content:
|
||||
Text("Location permissions not granted :(")));
|
||||
}
|
||||
},
|
||||
),
|
||||
RaisedButton(
|
||||
@@ -114,11 +121,12 @@ class _MyBodyState extends State<Body> {
|
||||
child: Text("enableLocationServices"),
|
||||
onPressed: () async {
|
||||
if (await Nearby().enableLocationServices()) {
|
||||
Scaffold.of(context).showSnackBar(
|
||||
SnackBar(content: Text("Location Service Enabled :)")));
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
content: Text("Location Service Enabled :)")));
|
||||
} else {
|
||||
Scaffold.of(context).showSnackBar(
|
||||
SnackBar(content: Text("Enabling Location Service Failed :(")));
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
content:
|
||||
Text("Enabling Location Service Failed :(")));
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
@@ -108,7 +108,7 @@ packages:
|
||||
path: ".."
|
||||
relative: true
|
||||
source: path
|
||||
version: "2.0.0-dev"
|
||||
version: "2.0.1-dev"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
Reference in New Issue
Block a user