Skip to content

Commit c33d468

Browse files
committed
initial commit
0 parents commit c33d468

File tree

82 files changed

+2014
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+2014
-0
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.DS_Store
2+
.dart_tool/
3+
4+
.packages
5+
.pub/
6+
pubspec.lock
7+
8+
build/

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 0.0.1
2+
3+
* Now you can show toast for android and alert for ios.

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TODO: Add your license here.

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# flutter_toast
2+
3+
A new Flutter plugin for showing toast in android and ios.
4+
5+
## Getting Started
6+
7+
For help getting started with Flutter, view our online
8+
[documentation](https://flutter.io/).
9+
10+
For help on editing plugin code, view the [documentation](https://flutter.io/platform-plugins/#edit-code).

android/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/workspace.xml
5+
/.idea/libraries
6+
.DS_Store
7+
/build
8+
/captures

android/build.gradle

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
group 'com.mtechviral.fluttertoast'
2+
version '1.0-SNAPSHOT'
3+
4+
buildscript {
5+
repositories {
6+
google()
7+
jcenter()
8+
}
9+
10+
dependencies {
11+
classpath 'com.android.tools.build:gradle:3.0.1'
12+
}
13+
}
14+
15+
rootProject.allprojects {
16+
repositories {
17+
google()
18+
jcenter()
19+
}
20+
}
21+
22+
apply plugin: 'com.android.library'
23+
24+
android {
25+
compileSdkVersion 27
26+
27+
defaultConfig {
28+
minSdkVersion 16
29+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
30+
}
31+
lintOptions {
32+
disable 'InvalidPackage'
33+
}
34+
}

android/gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.gradle.jvmargs=-Xmx1536M

android/settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'flutter_toast'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.mtechviral.fluttertoast">
3+
</manifest>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package com.mtechviral.fluttertoast;
2+
3+
import android.app.Activity;
4+
import android.widget.Toast;
5+
6+
import io.flutter.plugin.common.MethodCall;
7+
import io.flutter.plugin.common.MethodChannel;
8+
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
9+
import io.flutter.plugin.common.MethodChannel.Result;
10+
import io.flutter.plugin.common.PluginRegistry.Registrar;
11+
12+
/** FlutterToastPlugin */
13+
public class FlutterToastPlugin implements MethodCallHandler {
14+
15+
private final MethodChannel channel;
16+
private Activity activity;
17+
18+
/** Plugin registration. */
19+
public static void registerWith(Registrar registrar) {
20+
final MethodChannel channel = new MethodChannel(registrar.messenger(), "flutter_toast");
21+
channel.setMethodCallHandler(new FlutterToastPlugin(registrar.activity(),channel));
22+
}
23+
24+
private FlutterToastPlugin(Activity activity, MethodChannel channel){
25+
this.activity = activity;
26+
this.channel = channel;
27+
this.channel.setMethodCallHandler(this);
28+
}
29+
30+
31+
@Override
32+
public void onMethodCall(MethodCall call, Result result) {
33+
if (call.method.equals("getPlatformVersion")) {
34+
result.success("Android " + android.os.Build.VERSION.RELEASE);
35+
}
36+
else if(call.method.equals("showToast")){
37+
String msg = call.argument("msg").toString();
38+
Toast.makeText(activity,msg,Toast.LENGTH_LONG).show();
39+
}
40+
41+
else {
42+
result.notImplemented();
43+
}
44+
}
45+
}

0 commit comments

Comments
 (0)