From 64145fe17b495fbfdefeeb664ab1b957dc3eefc4 Mon Sep 17 00:00:00 2001 From: nikhil Date: Mon, 3 Jul 2023 23:38:06 +0530 Subject: [PATCH 1/3] migrated this app to the V2 embedding --- android/app/src/main/AndroidManifest.xml | 11 +- .../example/flutter_chat_ui/MainActivity.kt | 10 +- android/app/src/main/res/values/styles.xml | 14 +- android/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- pubspec.lock | 173 ++++++++---------- 6 files changed, 100 insertions(+), 112 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 8c82273..aa6b15f 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -6,11 +6,12 @@ additional functionality it is fine to subclass or reimplement FlutterApplication and put your custom class here. --> + android:name="io.flutter.embedding.android.NormalTheme" + android:resource="@style/NormalTheme" + /> + diff --git a/android/app/src/main/kotlin/com/example/flutter_chat_ui/MainActivity.kt b/android/app/src/main/kotlin/com/example/flutter_chat_ui/MainActivity.kt index 96bc45f..dccff48 100644 --- a/android/app/src/main/kotlin/com/example/flutter_chat_ui/MainActivity.kt +++ b/android/app/src/main/kotlin/com/example/flutter_chat_ui/MainActivity.kt @@ -1,12 +1,8 @@ package com.example.flutter_chat_ui -import android.os.Bundle -import io.flutter.app.FlutterActivity -import io.flutter.plugins.GeneratedPluginRegistrant +import io.flutter.embedding.android.FlutterActivity + class MainActivity: FlutterActivity() { - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - GeneratedPluginRegistrant.registerWith(this) - } + } diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml index 00fa441..cb1ef88 100644 --- a/android/app/src/main/res/values/styles.xml +++ b/android/app/src/main/res/values/styles.xml @@ -1,8 +1,18 @@ - + + diff --git a/android/build.gradle b/android/build.gradle index 3100ad2..297621a 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -6,7 +6,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' + classpath 'com.android.tools.build:gradle:4.2.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 296b146..90f271d 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip diff --git a/pubspec.lock b/pubspec.lock index d0de369..8081a5e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,69 +1,62 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - archive: - dependency: transitive - description: - name: archive - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.10" - args: - dependency: transitive - description: - name: args - url: "https://pub.dartlang.org" - source: hosted - version: "1.5.2" async: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.10.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "1.0.5" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.2" - collection: + version: "2.1.1" + characters: dependency: transitive description: - name: collection - url: "https://pub.dartlang.org" + name: characters + sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + url: "https://pub.dev" source: hosted - version: "1.14.11" - convert: + version: "1.2.1" + clock: dependency: transitive description: - name: convert - url: "https://pub.dartlang.org" + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted - version: "2.1.1" - crypto: + version: "1.1.1" + collection: dependency: transitive description: - name: crypto - url: "https://pub.dartlang.org" + name: collection + sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "1.17.0" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + sha256: e590b4212f085195dce802c2ae4c93dc3963e7e5f30a8f86ee212858c29ce186 + url: "https://pub.dev" source: hosted version: "0.1.2" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" flutter: dependency: "direct main" description: flutter @@ -74,55 +67,46 @@ packages: description: flutter source: sdk version: "0.0.0" - image: + js: dependency: transitive description: - name: image - url: "https://pub.dartlang.org" + name: js + sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "0.6.5" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + url: "https://pub.dev" source: hosted - version: "0.12.5" + version: "0.12.13" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + url: "https://pub.dev" + source: hosted + version: "0.2.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + url: "https://pub.dev" source: hosted - version: "1.1.7" + version: "1.8.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" - source: hosted - version: "1.6.4" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" + sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + url: "https://pub.dev" source: hosted - version: "1.8.0+1" - petitparser: - dependency: transitive - description: - name: petitparser - url: "https://pub.dartlang.org" - source: hosted - version: "2.4.0" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.5" + version: "1.8.2" sky_engine: dependency: transitive description: flutter @@ -132,64 +116,57 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + url: "https://pub.dev" source: hosted - version: "1.5.5" + version: "1.9.1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + url: "https://pub.dev" source: hosted - version: "1.9.3" + version: "1.11.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.1.1" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.0.5" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.5" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" + sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 + url: "https://pub.dev" source: hosted - version: "1.1.6" + version: "0.4.16" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "2.0.8" - xml: - dependency: transitive - description: - name: xml - url: "https://pub.dartlang.org" - source: hosted - version: "3.5.0" + version: "2.1.4" sdks: - dart: ">=2.4.0 <3.0.0" + dart: ">=2.18.0 <3.0.0" From 45c1737b0640651e19623cafd0637de105bde398 Mon Sep 17 00:00:00 2001 From: nikhil Date: Tue, 4 Jul 2023 00:38:59 +0530 Subject: [PATCH 2/3] Updated and fully migrated to the V2 embedding - updated compileSdkVersion from 28 to 31 - updated ext.kotlin_version = '1.7.10' - updated Android Gradle plugin to 7.2.0 - updated Project Gradle Version to 7.3.3 - updated flutter sdk '>=2.19.6 <3.0.0' --- android/app/build.gradle | 2 +- android/build.gradle | 4 ++-- android/gradle/wrapper/gradle-wrapper.properties | 2 +- pubspec.yaml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index f350442..467165f 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 28 + compileSdkVersion 31 sourceSets { main.java.srcDirs += 'src/main/kotlin' diff --git a/android/build.gradle b/android/build.gradle index 297621a..9f81b70 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.3.50' + ext.kotlin_version = '1.7.10' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.2.2' + classpath 'com.android.tools.build:gradle:7.2.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 90f271d..562c5e4 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip diff --git a/pubspec.yaml b/pubspec.yaml index 6764bf8..ffa7966 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -14,7 +14,7 @@ description: A new Flutter project. version: 1.0.0+1 environment: - sdk: ">=2.1.0 <3.0.0" + sdk: '>=2.19.6 <3.0.0' dependencies: flutter: From b222bab7c94017e22efe831a6ad54602ec0bc284 Mon Sep 17 00:00:00 2001 From: nikhil Date: Tue, 4 Jul 2023 00:39:37 +0530 Subject: [PATCH 3/3] Updated flutter sdk and added null safety --- lib/models/message_model.dart | 10 +++++----- lib/models/user_model.dart | 6 +++--- lib/screens/chat_screen.dart | 2 +- pubspec.lock | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/models/message_model.dart b/lib/models/message_model.dart index d181543..ab6c3e2 100644 --- a/lib/models/message_model.dart +++ b/lib/models/message_model.dart @@ -9,11 +9,11 @@ class Message { final bool unread; Message({ - this.sender, - this.time, - this.text, - this.isLiked, - this.unread, + required this.sender, + required this.time, + required this.text, + required this.isLiked, + required this.unread, }); } diff --git a/lib/models/user_model.dart b/lib/models/user_model.dart index 23558e4..29412df 100644 --- a/lib/models/user_model.dart +++ b/lib/models/user_model.dart @@ -4,8 +4,8 @@ class User { final String imageUrl; User({ - this.id, - this.name, - this.imageUrl, + required this.id, + required this.name, + required this.imageUrl, }); } diff --git a/lib/screens/chat_screen.dart b/lib/screens/chat_screen.dart index 847749b..60ccdc6 100644 --- a/lib/screens/chat_screen.dart +++ b/lib/screens/chat_screen.dart @@ -5,7 +5,7 @@ import 'package:flutter_chat_ui/models/user_model.dart'; class ChatScreen extends StatefulWidget { final User user; - ChatScreen({this.user}); + ChatScreen({required this.user}); @override _ChatScreenState createState() => _ChatScreenState(); diff --git a/pubspec.lock b/pubspec.lock index 8081a5e..387a715 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -169,4 +169,4 @@ packages: source: hosted version: "2.1.4" sdks: - dart: ">=2.18.0 <3.0.0" + dart: ">=2.19.6 <3.0.0"