Commit 22e4b256 by Karthik Ponnam

Fixed Unresolved reference: R

parent 1a3ce5cf
## [8.0.4]
- Fixed Unresolved reference: R (Issue with Android API 30)
## [8.0.3] ## [8.0.3]
- flutter analyze fixes - flutter analyze fixes
......
...@@ -34,7 +34,7 @@ This one has limited features and no control over UI ...@@ -34,7 +34,7 @@ This one has limited features and no control over UI
```yaml ```yaml
# add this line to your dependencies # add this line to your dependencies
fluttertoast: ^8.0.3 fluttertoast: ^8.0.4
``` ```
```dart ```dart
......
...@@ -25,7 +25,7 @@ apply plugin: 'com.android.library' ...@@ -25,7 +25,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
android { android {
compileSdkVersion 30 compileSdkVersion 29
sourceSets { sourceSets {
main.java.srcDirs += 'src/main/kotlin' main.java.srcDirs += 'src/main/kotlin'
......
...@@ -34,7 +34,7 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler { ...@@ -34,7 +34,7 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
"center" -> Gravity.CENTER "center" -> Gravity.CENTER
else -> Gravity.BOTTOM else -> Gravity.BOTTOM
} }
val mDuration: Int val mDuration: Int
mDuration = if (length == "long") { mDuration = if (length == "long") {
Toast.LENGTH_LONG Toast.LENGTH_LONG
...@@ -42,7 +42,7 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler { ...@@ -42,7 +42,7 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
Toast.LENGTH_SHORT Toast.LENGTH_SHORT
} }
if (bgcolor != null && Build.VERSION.SDK_INT < Build.VERSION_CODES.R) { if (bgcolor != null && Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
val layout = (context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater).inflate(R.layout.toast_custom, null) val layout = (context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater).inflate(R.layout.toast_custom, null)
val text = layout.findViewById<TextView>(R.id.text) val text = layout.findViewById<TextView>(R.id.text)
text.text = mMessage text.text = mMessage
...@@ -52,14 +52,14 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler { ...@@ -52,14 +52,14 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
} else { } else {
context.resources.getDrawable(R.drawable.corner) context.resources.getDrawable(R.drawable.corner)
} }
if(bgcolor != null) { if (bgcolor != null) {
gradientDrawable.setColorFilter(bgcolor.toInt(), PorterDuff.Mode.SRC_IN) gradientDrawable.setColorFilter(bgcolor.toInt(), PorterDuff.Mode.SRC_IN)
} }
text.background = gradientDrawable text.background = gradientDrawable
if(textSize != null) { if (textSize != null) {
text.textSize = textSize.toFloat() text.textSize = textSize.toFloat()
} }
if(textcolor != null) { if (textcolor != null) {
text.setTextColor(textcolor.toInt()) text.setTextColor(textcolor.toInt())
} }
mToast = Toast(context) mToast = Toast(context)
...@@ -67,34 +67,34 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler { ...@@ -67,34 +67,34 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
mToast.view = layout mToast.view = layout
} else { } else {
mToast = Toast.makeText(context, mMessage, mDuration) mToast = Toast.makeText(context, mMessage, mDuration)
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.R) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
try { try {
val textView: TextView = mToast.view!!.findViewById(android.R.id.message) val textView: TextView = mToast.view!!.findViewById(android.R.id.message)
if(textSize != null) { if (textSize != null) {
textView.textSize = textSize.toFloat() textView.textSize = textSize.toFloat()
} }
if (textcolor != null) { if (textcolor != null) {
textView.setTextColor(textcolor.toInt()) textView.setTextColor(textcolor.toInt())
} }
} catch(e: Exception) { } catch (e: Exception) {
} }
} }
} }
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.R) { // if(Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
when (mGravity) { when (mGravity) {
Gravity.CENTER -> { Gravity.CENTER -> {
mToast.setGravity(mGravity, 0, 0) mToast.setGravity(mGravity, 0, 0)
} }
Gravity.TOP -> { Gravity.TOP -> {
mToast.setGravity(mGravity, 0, 100) mToast.setGravity(mGravity, 0, 100)
} }
else -> { else -> {
mToast.setGravity(mGravity, 0, 100) mToast.setGravity(mGravity, 0, 100)
}
} }
} }
// }
if (context is Activity) { if (context is Activity) {
(context as Activity).runOnUiThread { mToast.show() } (context as Activity).runOnUiThread { mToast.show() }
} else { } else {
......
...@@ -26,7 +26,7 @@ apply plugin: 'kotlin-android' ...@@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android { android {
compileSdkVersion 30 compileSdkVersion 28
sourceSets { sourceSets {
main.java.srcDirs += 'src/main/kotlin' main.java.srcDirs += 'src/main/kotlin'
...@@ -40,7 +40,7 @@ android { ...@@ -40,7 +40,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.FlutterToast_example" applicationId "com.example.FlutterToast_example"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 30 targetSdkVersion 28
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
} }
......
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
# This is a generated file; do not edit or check into version control. # This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/usr/local/Caskroom/flutter/1.22.3/flutter" export "FLUTTER_ROOT=/usr/local/Caskroom/flutter/1.22.3/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/karthikponnam/Desktop/my/plugins/FlutterToast/example" export "FLUTTER_APPLICATION_PATH=/Users/karthikponnam/Desktop/my/plugins/FlutterToast/example"
export "FLUTTER_TARGET=lib/main.dart" export "FLUTTER_TARGET=/Users/karthikponnam/Desktop/my/plugins/FlutterToast/example/lib/main.dart"
export "FLUTTER_BUILD_DIR=build" export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios" export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "FLUTTER_BUILD_NAME=1.0.0" export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1" export "FLUTTER_BUILD_NUMBER=1"
export "DART_OBFUSCATION=false" export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=false" export "TRACK_WIDGET_CREATION=true"
export "TREE_SHAKE_ICONS=false" export "TREE_SHAKE_ICONS=false"
export "PACKAGE_CONFIG=.packages" export "PACKAGE_CONFIG=/Users/karthikponnam/Desktop/my/plugins/FlutterToast/example/.dart_tool/package_config.json"
...@@ -20,7 +20,7 @@ EXTERNAL SOURCES: ...@@ -20,7 +20,7 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/fluttertoast/ios" :path: ".symlinks/plugins/fluttertoast/ios"
SPEC CHECKSUMS: SPEC CHECKSUMS:
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
fluttertoast: 6122fa75143e992b1d3470f61000f591a798cc58 fluttertoast: 6122fa75143e992b1d3470f61000f591a798cc58
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196 Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
......
...@@ -150,7 +150,6 @@ ...@@ -150,7 +150,6 @@
97C146EC1CF9000F007C117D /* Resources */, 97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */, 9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
4C8EBA6CE2BCF49B821A0E38 /* [CP] Embed Pods Frameworks */,
); );
buildRules = ( buildRules = (
); );
...@@ -222,23 +221,6 @@ ...@@ -222,23 +221,6 @@
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
}; };
4C8EBA6CE2BCF49B821A0E38 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
738D6934AB90330F1F008F9A /* [CP] Check Pods Manifest.lock */ = { 738D6934AB90330F1F008F9A /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
<Workspace <Workspace
version = "1.0"> version = "1.0">
<FileRef <FileRef
location = "group:Runner.xcodeproj"> location = "self:">
</FileRef> </FileRef>
</Workspace> </Workspace>
...@@ -8,7 +8,7 @@ class ToastContext extends StatefulWidget { ...@@ -8,7 +8,7 @@ class ToastContext extends StatefulWidget {
} }
class _ToastContextState extends State<ToastContext> { class _ToastContextState extends State<ToastContext> {
FToast fToast; late FToast fToast;
Widget toast = Container( Widget toast = Container(
padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0), padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
...@@ -128,7 +128,7 @@ class _ToastContextState extends State<ToastContext> { ...@@ -128,7 +128,7 @@ class _ToastContextState extends State<ToastContext> {
void initState() { void initState() {
super.initState(); super.initState();
fToast = FToast(); fToast = FToast();
fToast.init(globalKey.currentState.context); fToast.init(globalKey.currentState!.context);
} }
@override @override
......
...@@ -78,7 +78,7 @@ packages: ...@@ -78,7 +78,7 @@ packages:
path: ".." path: ".."
relative: true relative: true
source: path source: path
version: "8.0.3" version: "8.0.4"
js: js:
dependency: transitive dependency: transitive
description: description:
......
...@@ -6,7 +6,7 @@ description: Demonstrates how to use the FlutterToast plugin. ...@@ -6,7 +6,7 @@ description: Demonstrates how to use the FlutterToast plugin.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev publish_to: 'none' # Remove this line if you wish to publish to pub.dev
environment: environment:
sdk: ">=2.7.0 <3.0.0" sdk: '>=2.12.0 <3.0.0'
dependencies: dependencies:
flutter: flutter:
......
...@@ -19,7 +19,7 @@ void main() { ...@@ -19,7 +19,7 @@ void main() {
expect( expect(
find.byWidgetPredicate( find.byWidgetPredicate(
(Widget widget) => widget is Text && (Widget widget) => widget is Text &&
widget.data.startsWith('Running on:'), widget.data!.startsWith('Running on:'),
), ),
findsOneWidget, findsOneWidget,
); );
......
name: fluttertoast name: fluttertoast
description: Toast Library for Flutter, Easily create toast messages in single line of code description: Toast Library for Flutter, Easily create toast messages in single line of code
version: 8.0.3 version: 8.0.4
homepage: https://github.com/PonnamKarthik/FlutterToast homepage: https://github.com/PonnamKarthik/FlutterToast
issue_tracker: https://github.com/ponnamkarthik/FlutterToast/issues issue_tracker: https://github.com/ponnamkarthik/FlutterToast/issues
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment