Skip to content

Commit

Permalink
sdk 0.3.4 :
Browse files Browse the repository at this point in the history
* Updated sdk minimum to 2.15.0
* Updating web to 0.1.4
* Updating android to 0.1.5
* Updating windows to 0.1.2
* Updating linux to 0.1.2
* Updating macos to 0.1.2
  • Loading branch information
matanshukry committed Aug 19, 2023
1 parent 550fb28 commit 4a00c5b
Show file tree
Hide file tree
Showing 14 changed files with 60 additions and 42 deletions.
9 changes: 9 additions & 0 deletions flutter_google_places_sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## 0.3.4

* Updated sdk minimum to 2.15.0
* Updating web to 0.1.4
* Updating android to 0.1.5
* Updating windows to 0.1.2
* Updating linux to 0.1.2
* Updating macos to 0.1.2

## 0.3.3

* Updated sdk minimum to 2.14.0
Expand Down
4 changes: 2 additions & 2 deletions flutter_google_places_sdk/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 31
compileSdkVersion 33
ndkVersion "21.4.7075529"

sourceSets {
Expand All @@ -39,7 +39,7 @@ android {

defaultConfig {
applicationId "com.msh.flutter_google_places_sdk_example"
minSdkVersion 16
minSdkVersion 21
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
6 changes: 3 additions & 3 deletions flutter_google_places_sdk/example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.7.21'
ext.kotlin_version = '1.8.22'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.android.tools.build:gradle:7.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
5 changes: 4 additions & 1 deletion flutter_google_places_sdk/example/lib/google_places_img.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ class GooglePlacesImg extends StatelessWidget {

@override
Widget build(BuildContext context) {
return placePhotoResponse.image!;
return placePhotoResponse.maybeWhen(
image: (image) => image,
orElse: () => Text('Invalid image'),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ class GooglePlacesImg extends StatelessWidget {

@override
Widget build(BuildContext context) {
final imageUrl = placePhotoResponse.imageUrl!;
final imageUrl =
placePhotoResponse.whenOrNull(imageUrl: (imageUrl) => imageUrl);
if (imageUrl == null) {
return Text('Invalid image url!');
}

// ignore: undefined_prefixed_name
ui.platformViewRegistry.registerViewFactory(photoMetadata.photoReference,
Expand Down
8 changes: 4 additions & 4 deletions flutter_google_places_sdk/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class _MyHomePageState extends State<MyHomePage> {
//
String? _predictLastText;

PlaceTypeFilter _placeTypeFilter = PlaceTypeFilter.ESTABLISHMENT;
List<PlaceTypeFilter> _placeTypesFilter = [PlaceTypeFilter.ESTABLISHMENT];

bool _locationBiasEnabled = true;
LatLngBounds _locationBias = LatLngBounds(
Expand Down Expand Up @@ -137,7 +137,7 @@ class _MyHomePageState extends State<MyHomePage> {
void _onPlaceTypeFilterChanged(PlaceTypeFilter? value) {
if (value != null) {
setState(() {
_placeTypeFilter = value;
_placeTypesFilter = [value];
});
}
}
Expand Down Expand Up @@ -226,7 +226,7 @@ class _MyHomePageState extends State<MyHomePage> {
final result = await _places.findAutocompletePredictions(
_predictLastText!,
countries: _countriesEnabled ? _countries : null,
placeTypeFilter: _placeTypeFilter,
placeTypesFilter: _placeTypesFilter,
newSessionToken: false,
origin: LatLng(lat: 43.12, lng: 95.20),
locationBias: _locationBiasEnabled ? _locationBias : null,
Expand Down Expand Up @@ -379,7 +379,7 @@ class _MyHomePageState extends State<MyHomePage> {
.map((item) => DropdownMenuItem<PlaceTypeFilter>(
child: Text(item.value), value: item))
.toList(growable: false),
value: _placeTypeFilter,
value: _placeTypesFilter.isEmpty ? null : _placeTypesFilter[0],
onChanged: _onPlaceTypeFilterChanged,
),
// -- Location Bias
Expand Down
6 changes: 2 additions & 4 deletions flutter_google_places_sdk/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@ description: Demonstrates how to use the flutter_google_places_sdk plugin.
publish_to: 'none'

environment:
sdk: ">=2.12.0 <3.0.0"
sdk: ">=2.14.0 <4.0.0"

dependencies:
flutter:
sdk: flutter
flutter_google_places_sdk:
path: ../
path: ../../flutter_google_places_sdk

dev_dependencies:
integration_test:
sdk: flutter
flutter_test:
sdk: flutter

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ add_executable(${BINARY_NAME} WIN32
# that need different build settings.
apply_standard_settings(${BINARY_NAME})

# Add preprocessor definitions for the build version.
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"")
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}")
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}")
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}")
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}")

# Disable Windows macros that collide with C++ standard library functions.
target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")

Expand Down
10 changes: 5 additions & 5 deletions flutter_google_places_sdk/example/windows/runner/Runner.rc
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ IDI_APP_ICON ICON "resources\\app_icon.ico"
// Version
//

#ifdef FLUTTER_BUILD_NUMBER
#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD)
#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD
#else
#define VERSION_AS_NUMBER 1,0,0
#define VERSION_AS_NUMBER 1,0,0,0
#endif

#ifdef FLUTTER_BUILD_NAME
#define VERSION_AS_STRING #FLUTTER_BUILD_NAME
#if defined(FLUTTER_VERSION)
#define VERSION_AS_STRING FLUTTER_VERSION
#else
#define VERSION_AS_STRING "1.0.0"
#endif
Expand Down
4 changes: 2 additions & 2 deletions flutter_google_places_sdk/lib/flutter_google_places_sdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class FlutterGooglePlacesSdk {
Future<FindAutocompletePredictionsResponse> findAutocompletePredictions(
String query, {
List<String>? countries,
PlaceTypeFilter placeTypeFilter = PlaceTypeFilter.ALL,
List<PlaceTypeFilter> placeTypesFilter = const [],
bool? newSessionToken,
LatLng? origin,
LatLngBounds? locationBias,
Expand All @@ -129,7 +129,7 @@ class FlutterGooglePlacesSdk {
return _addMethodCall(() => platform.findAutocompletePredictions(
query,
countries: countries,
placeTypeFilter: placeTypeFilter,
placeTypesFilter: placeTypesFilter,
newSessionToken: newSessionToken,
origin: origin,
locationBias: locationBias,
Expand Down
16 changes: 8 additions & 8 deletions flutter_google_places_sdk/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
name: flutter_google_places_sdk
description: A Flutter plugin for google places sdk that uses the native libraries on each platform
version: 0.3.3
version: 0.3.4
homepage: https://github.com/matanshukry/flutter_google_places_sdk/tree/master/flutter_google_places_sdk

environment:
sdk: ">=2.14.0 <4.0.0"
sdk: ">=2.15.0 <4.0.0"
flutter: ">=1.20.0"

dependencies:
flutter:
sdk: flutter
flutter_google_places_sdk_platform_interface: ^0.2.4+3
flutter_google_places_sdk_platform_interface: ^0.2.5
flutter_google_places_sdk_ios: ^0.1.2+4
flutter_google_places_sdk_web: ^0.1.3+4
flutter_google_places_sdk_android: ^0.1.3
flutter_google_places_sdk_windows: ^0.1.1
flutter_google_places_sdk_linux: ^0.1.1
flutter_google_places_sdk_macos: ^0.1.1
flutter_google_places_sdk_web: ^0.1.4
flutter_google_places_sdk_android: ^0.1.5
flutter_google_places_sdk_windows: ^0.1.2
flutter_google_places_sdk_linux: ^0.1.2
flutter_google_places_sdk_macos: ^0.1.2

dev_dependencies:
flutter_test:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ void main() {
fullText: 'ftext6cad',
);

const kPlace = const Place(latLng: LatLng(lat: 542.13, lng: -32.43));
const kPlace = const Place(latLng: LatLng(lat: 542.13, lng: -32.43), address: '', addressComponents: [], businessStatus: null, attributions: [], name: '', openingHours: null, phoneNumber: '', photoMetadatas: [], plusCode: null, priceLevel: null, rating: null, types: [], userRatingsTotal: null, utcOffsetMinutes: null, viewport: null, websiteUri: null);

final kDefaultResponses = <dynamic, dynamic>{
'findAutocompletePredictions': <dynamic>[
kPrediction1.toMap(),
kPrediction2.toMap()
kPrediction1.toJson(),
kPrediction2.toJson()
],
'fetchPlace': kPlace.toMap(),
'fetchPlace': kPlace.toJson(),
};

const String kDefaultApiKey = 'test-api-key-23';
Expand Down Expand Up @@ -97,12 +97,12 @@ void main() {
test('default behavior', () async {
const queryTest = 'my-query-text';
const countriesTest = ['c5', 'c32'];
const placeTypeFilterTest = PlaceTypeFilter.ESTABLISHMENT;
const placeTypeFilterTest = [PlaceTypeFilter.ESTABLISHMENT];
final origin = LatLng(lat: 32.51, lng: 95.31);
final result = await flutterGooglePlacesSdk.findAutocompletePredictions(
queryTest,
countries: countriesTest,
placeTypeFilter: placeTypeFilterTest,
placeTypesFilter: placeTypeFilterTest,
newSessionToken: false,
origin: origin);

Expand All @@ -116,7 +116,7 @@ void main() {
'countries': countriesTest,
"typeFilter": "ESTABLISHMENT",
'newSessionToken': false,
'origin': origin.toMap(),
'origin': origin.toJson(),
'locationBias': null,
'locationRestriction': null,
}),
Expand All @@ -142,7 +142,7 @@ void main() {
_getInitializeMatcher(),
isMethodCall('fetchPlace', arguments: <String, dynamic>{
'placeId': placeId,
'fields': fields.map((e) => e.value).toList(growable: false),
'fields': fields.map((e) => e..name).toList(growable: false),
'newSessionToken': null,
}),
],
Expand Down

0 comments on commit 4a00c5b

Please sign in to comment.