Skip to content

Commit

Permalink
edited loading spinner
Browse files Browse the repository at this point in the history
  • Loading branch information
ninest committed Apr 10, 2020
1 parent 24490ca commit 7b3465b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
7 changes: 6 additions & 1 deletion lib/components/core/loading/circular_spinner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ class CircularSpinner extends StatelessWidget {
return Column(
children: [
Spacing(height: Values.marginBelowTitle),
CircularProgressIndicator(),
Text(
"Loading ...",
style: Theme.of(context).textTheme.title.copyWith(
fontSize: Values.em * 1.5,
),
),
Spacing(height: Values.marginBelowTitle),
],
);
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/permission.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class _RequestPermissionButton extends StatelessWidget {
text: "Grant permission",
onTap: () async {
var status = await LocationPermsProvider.requestPerm();
// print("STATUS: $status");

if (status == PermissionStatus.granted) {
print("Location permission given");
final HomeRebuilderProvider homeRebuilderProvider =
Expand Down
13 changes: 10 additions & 3 deletions lib/services/location.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import 'package:geolocator/geolocator.dart';
import 'package:nextbussg/providers/location_perms.dart';

class LocationServices {
static Future<Position> getLocation() async {
Position position =
await Geolocator().getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
return position;
try {
Position position =
await Geolocator().getCurrentPosition(desiredAccuracy: LocationAccuracy.lowest);
return position;
} catch (e) {
// request location
await LocationPermsProvider.requestPerm();
return LocationServices.getLocation();
}
}

static Future<double> distanceBetween(Position point1, Position point2) => Geolocator()
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Routing {
static void openReplacementRoute(BuildContext context, Widget page) {
Navigator.of(context).pushReplacement(
MaterialPageRoute(
maintainState: false,
maintainState: true,
builder: (BuildContext context) => ScrollConfiguration(
child: page,
behavior: BounceScrollBehavior(),
Expand Down

0 comments on commit 7b3465b

Please sign in to comment.