Skip to content

Commit

Permalink
update deps (#33) related to #27
Browse files Browse the repository at this point in the history
* update deps

* Update build-example.yml

* update deps

* update deps

* Update build-example.yml

* Apply suggestions from code review

* fix

* fix
  • Loading branch information
hoc081098 committed Jun 21, 2024
1 parent df1d04a commit 2059a72
Show file tree
Hide file tree
Showing 12 changed files with 336 additions and 241 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'

- uses: subosito/flutter-action@v2.4.0
with:
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
version: [ '3.10.0' ]
version: [ '3.19.6', '3.22.0' ]
defaults:
run:
working-directory: ./example
Expand All @@ -62,7 +62,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'

- uses: subosito/flutter-action@v2.4.0
with:
Expand All @@ -78,4 +78,4 @@ jobs:
run: flutter pub get

- name: Build APK
run: flutter build apk --no-shrink
run: flutter build apk --debug --no-shrink
5 changes: 2 additions & 3 deletions example/lib/custom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@ import 'main.dart';
// basically your widget need to extends [GooglePlacesAutocompleteWidget]
// and your state [GooglePlacesAutocompleteState]
class CustomSearchScaffold extends PlacesAutocompleteWidget {
CustomSearchScaffold({Key? key})
CustomSearchScaffold({super.key})
: super(
key: key,
apiKey: kGoogleApiKey,
sessionToken: const Uuid().v4(),
language: 'en',
components: [const Component(Component.country, 'uk')],
);

@override
_CustomSearchScaffoldState createState() => _CustomSearchScaffoldState();
PlacesAutocompleteState createState() => _CustomSearchScaffoldState();
}

class _CustomSearchScaffoldState extends PlacesAutocompleteState {
Expand Down
14 changes: 8 additions & 6 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final customTheme = ThemeData(
);

class RoutesWidget extends StatelessWidget {
const RoutesWidget({Key? key}) : super(key: key);
const RoutesWidget({super.key});

@override
Widget build(BuildContext context) {
Expand All @@ -48,10 +48,10 @@ class RoutesWidget extends StatelessWidget {
}

class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
const MyApp({super.key});

@override
_MyAppState createState() => _MyAppState();
State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
Expand Down Expand Up @@ -127,7 +127,9 @@ class _MyAppState extends State<MyApp> {
components: [const Component(Component.country, 'fr')],
resultTextStyle: Theme.of(context).textTheme.titleMedium,
);

if (!mounted) {
return;
}
await displayPrediction(p, ScaffoldMessenger.of(context));
}
}
Expand All @@ -139,12 +141,12 @@ Future<void> displayPrediction(
}

// get detail (lat/lng)
final _places = GoogleMapsPlaces(
final places = GoogleMapsPlaces(
apiKey: kGoogleApiKey,
apiHeaders: await const GoogleApiHeaders().getHeaders(),
);

final detail = await _places.getDetailsByPlaceId(p.placeId!);
final detail = await places.getDetailsByPlaceId(p.placeId!);
final geometry = detail.result.geometry!;
final lat = geometry.location.lat;
final lng = geometry.location.lng;
Expand Down
Loading

0 comments on commit 2059a72

Please sign in to comment.