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

Migration to flutter 3 #234

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
33 changes: 16 additions & 17 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
plugins {
id "com.android.application"
id "kotlin-android"
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
def localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localPropertiesFile.withReader("UTF-8") { reader ->
localProperties.load(reader)
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
if (flutterVersionCode == null) {
flutterVersionCode = '1'
flutterVersionCode = "1"
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
def flutterVersionName = localProperties.getProperty("flutter.versionName")
if (flutterVersionName == null) {
flutterVersionName = '1.0'
flutterVersionName = "1.0"
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 32
compileSdkVersion 34

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -36,8 +35,8 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.yourcompany.example"
minSdkVersion 16
targetSdkVersion 32
minSdkVersion 23
targetSdkVersion 34
versionCode 1
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
14 changes: 8 additions & 6 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '2.0.20'

repositories {
google()
mavenCentral()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
google()
mavenCentral()
jcenter()
}
}

rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
}
6 changes: 3 additions & 3 deletions example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Nov 03 15:28:02 CET 2021
#Tue Nov 26 13:45:53 WAT 2024
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
30 changes: 20 additions & 10 deletions example/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
include ':app'
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()

def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
pluginsFile.withInputStream { stream -> plugins.load(stream) }
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

plugins.each { name, path ->
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
include ":$name"
project(":$name").projectDir = pluginDirectory
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "org.jetbrains.kotlin.android" version "2.0.20" apply false
}

include ":app"
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import 'dart:math';

import 'package:google_api_headers/google_api_headers.dart';
import 'package:flutter/material.dart';
import 'package:flutter_google_maps_webservices/places.dart';
import 'package:flutter_google_places/flutter_google_places.dart';
import 'package:google_maps_webservice/places.dart';

const kGoogleApiKey = "API_KEY";

Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: example
description: A new Flutter project.

environment:
sdk: '>=2.12.0 <3.0.0'
sdk: '>=3.4.3 <4.0.0'

dependencies:
flutter:
Expand Down
6 changes: 3 additions & 3 deletions lib/src/flutter_google_places.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ library flutter_google_places.src;
import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter_google_maps_webservices/places.dart';
import 'package:google_api_headers/google_api_headers.dart';
import 'package:google_maps_webservice/places.dart';
import 'package:http/http.dart';
import 'package:rxdart/rxdart.dart';

Expand Down Expand Up @@ -142,7 +142,7 @@ class _PlacesAutocompleteOverlayState extends PlacesAutocompleteState {
],
),
),
const Divider()
const Divider(),
],
);

Expand Down Expand Up @@ -375,7 +375,7 @@ class PoweredByGoogleImage extends StatelessWidget {
: _poweredByGoogleBlack,
scale: 2.5,
),
)
),
],
);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/src/places_autocomplete_field.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter_google_maps_webservices/places.dart';
import 'package:flutter_google_places/src/flutter_google_places.dart';
import 'package:google_maps_webservice/places.dart';

/// A text field like widget to input places with autocomplete.
///
Expand Down Expand Up @@ -239,7 +239,7 @@ class LocationAutocompleteFieldState extends State<PlacesAutocompleteField> {
),
)
else
const SizedBox()
const SizedBox(),
],
);

Expand Down
4 changes: 2 additions & 2 deletions lib/src/places_autocomplete_form_field.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_google_maps_webservices/places.dart';
import 'package:flutter_google_places/src/flutter_google_places.dart';
import 'package:flutter_google_places/src/places_autocomplete_field.dart';
import 'package:google_maps_webservice/places.dart';

/// A [FormField] that contains a [PlacesAutocompleteField].
///
Expand Down Expand Up @@ -40,7 +40,7 @@ class PlacesAutocompleteFormField extends FormField<String> {
/// to [initalValue] or the empty string.
///
/// For documentation about the various parameters, see the [PlacesAutocompleteField] class
/// and [new PlacesAutocompleteField], the constructor.
/// and [PlacesAutocompleteField.new], the constructor.
PlacesAutocompleteFormField({
Key? key,
required String apiKey,
Expand Down
11 changes: 5 additions & 6 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
name: flutter_google_places
description: Google places autocomplete widgets for flutter. No wrapper, use https://pub.dev/packages/google_maps_webservice
version: 0.4.0
version: 1.0.0
repository: https://github.com/fluttercommunity/flutter_google_places

environment:
sdk: '>=2.12.0 <3.0.0'
flutter: ">=1.17.0"
sdk: '>=3.4.3 <4.0.0'

dependencies:
flutter:
sdk: flutter
google_api_headers: ^1.3.0
google_maps_webservice: ^0.0.20-nullsafety.5
http: ^0.13.4
flutter_google_maps_webservices: ^1.1.1
google_api_headers: ^4.2.0
http: ^1.2.2
rxdart: ^0.27.5

dev_dependencies:
Expand Down