Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement #169

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
- create snack bar when gps is disable
- set backbutton with circle bg
  • Loading branch information
satria-wardana committed Apr 5, 2022
commit 085ba08b1514fd0041842f029b6d3b0fe0e67063
44 changes: 37 additions & 7 deletions lib/src/place_picker.dart
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
import 'package:google_api_headers/google_api_headers.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:google_maps_place_picker/google_maps_place_picker.dart';
import 'package:google_maps_place_picker/providers/place_provider.dart';
@@ -61,6 +62,7 @@ class PlacePicker extends StatefulWidget {
this.automaticallyImplyAppBarLeading = true,
this.autocompleteOnTrailingWhitespace = false,
this.hidePlaceDetailsWhenDraggingPin = true,
this.errorMessageGpsIsDisable = ''
}) : super(key: key);

final String apiKey;
@@ -166,6 +168,8 @@ class PlacePicker extends StatefulWidget {

final bool hidePlaceDetailsWhenDraggingPin;

final String errorMessageGpsIsDisable;

@override
_PlacePickerState createState() => _PlacePickerState();
}
@@ -273,18 +277,23 @@ class _PlacePickerState extends State<PlacePicker> {
Widget _buildSearchBar(BuildContext context) {
return Row(
children: <Widget>[
SizedBox(width: 8),
widget.automaticallyImplyAppBarLeading
? CircleAvatar(
backgroundColor: Color(0XFF424242),
radius: 20,
child: IconButton(
onPressed: () => Navigator.maybePop(context),
icon: Icon(
Platform.isIOS ? Icons.arrow_back_ios : Icons.arrow_back,
),
padding: EdgeInsets.zero),
radius: 18,
child: Center(
child: IconButton(
onPressed: () => Navigator.maybePop(context),
icon: Icon(
Platform.isIOS ? Icons.arrow_back_ios : Icons.arrow_back,
size: 16,
),
padding: EdgeInsets.zero),
),
)
: SizedBox(width: 15),
SizedBox(width: 8),
Expanded(
child: AutoCompleteSearch(
appBarKey: appBarKey,
@@ -421,6 +430,27 @@ class _PlacePickerState extends State<PlacePicker> {
});
await provider!.updateCurrentLocation(widget.forceAndroidLocationManager);
await _moveToCurrentPosition();
}else {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
backgroundColor: Colors.transparent,
elevation: 0,
content: Container(
width: double.infinity,
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
gradient: LinearGradient(colors: [Color(0xFFF6BA22), Color(0xFFF68522)])),
child: Text(widget.errorMessageGpsIsDisable,
style: GoogleFonts.roboto(
textStyle: Theme.of(context).textTheme.caption!.copyWith(leadingDistribution: TextLeadingDistribution.even),
fontSize: 12,
color: Color(0xFF000000),
fontWeight: FontWeight.bold,
height: 1.5,
letterSpacing: 0.4),
),
),
));
}
},
onMoveStart: () {
125 changes: 115 additions & 10 deletions pubspec.lock
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0"
version: "2.8.2"
boolean_selector:
dependency: transitive
description:
@@ -21,14 +21,14 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.1"
clock:
dependency: transitive
description:
@@ -43,13 +43,34 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
ffi:
dependency: transitive
description:
name: ffi
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
file:
dependency: transitive
description:
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.2"
flutter:
dependency: "direct main"
description: flutter
@@ -100,6 +121,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
google_fonts:
dependency: "direct main"
description:
name: google_fonts
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
google_maps_flutter:
dependency: "direct main"
description:
@@ -155,14 +183,14 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.10"
version: "0.12.11"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.7.0"
nested:
dependency: transitive
description:
@@ -184,6 +212,55 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
path_provider:
dependency: transitive
description:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.9"
path_provider_android:
dependency: transitive
description:
name: path_provider_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.12"
path_provider_ios:
dependency: transitive
description:
name: path_provider_ios
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.5"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
pedantic:
dependency: transitive
description:
@@ -205,13 +282,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0+1"
platform:
dependency: transitive
description:
name: platform
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
process:
dependency: transitive
description:
name: process
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.4"
provider:
dependency: "direct main"
description:
@@ -237,7 +328,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
version: "1.8.1"
stack_trace:
dependency: transitive
description:
@@ -279,7 +370,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.19"
version: "0.4.3"
tuple:
dependency: "direct main"
description:
@@ -300,7 +391,21 @@ packages:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.1.1"
win32:
dependency: transitive
description:
name: win32
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.1"
xdg_directories:
dependency: transitive
description:
name: xdg_directories
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0+1"
sdks:
dart: ">=2.12.0 <3.0.0"
flutter: ">=1.22.0"
dart: ">=2.15.0 <3.0.0"
flutter: ">=2.8.0"
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ dependencies:
google_api_headers: ^1.0.0
tuple: ^2.0.0-nullsafety.0
http: ^0.13.0
google_fonts: 2.1.0

dev_dependencies:
flutter_test: