Skip to content

Commit 1d000e4

Browse files
author
xulinfeng
committed
Initial commit.
1 parent 75ec4ba commit 1d000e4

File tree

84 files changed

+2685
-18
lines changed

Some content is hidden

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

84 files changed

+2685
-18
lines changed

.github/workflows/dart.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Flutter Test
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
runs-on: macos-latest
12+
steps:
13+
- uses: actions/checkout@v1
14+
- uses: subosito/flutter-action@v1
15+
with:
16+
channel: 'stable'
17+
- run: flutter pub get
18+
- run: flutter test
19+
- run: cd ./example && flutter build ios --simulator
20+

.github/workflows/publish.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- v*.*
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: subosito/flutter-action@v1
13+
with:
14+
channel: 'stable'
15+
- uses: modool/flutter-package-publisher@master
16+
with:
17+
credentialJson: ${{ secrets.CREDENTIAL_JSON }}

.gitignore

+75-16
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,80 @@
1-
# See https://www.dartlang.org/guides/libraries/private-files
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
211

3-
# Files and directories created by pub
12+
# blutter
13+
blutter_tools
14+
15+
# IntelliJ related
16+
*.iml
17+
*.ipr
18+
*.iws
19+
.idea/
20+
21+
# Visual Studio Code related
22+
.vscode/
23+
24+
# Flutter/Dart/Pub related
25+
**/doc/api/
426
.dart_tool/
27+
.flutter-plugins
528
.packages
29+
.pub-cache/
30+
.pub/
31+
.flutter-plugins-dependencies
632
build/
7-
# If you're building an application, you may want to check-in your pubspec.lock
8-
pubspec.lock
33+
coverage/
34+
artifacts/
935

10-
# Directory created by dartdoc
11-
# If you don't generate documentation locally you can remove this line.
12-
doc/api/
13-
14-
# Avoid committing generated Javascript files:
15-
*.dart.js
16-
*.info.json # Produced by the --dump-info flag.
17-
*.js # When generated by dart2js. Don't specify *.js if your
18-
# project includes source files written in JavaScript.
19-
*.js_
20-
*.js.deps
21-
*.js.map
36+
# Android related
37+
**/android/**/gradle-wrapper.jar
38+
**/android/.gradle
39+
**/android/captures/
40+
**/android/gradlew
41+
**/android/gradlew.bat
42+
**/android/local.properties
43+
**/android/**/GeneratedPluginRegistrant.java
44+
**/android/**/gen/
45+
46+
# iOS/XCode related
47+
**/ios/**/*.mode1v3
48+
**/ios/**/*.mode2v3
49+
**/ios/**/*.moved-aside
50+
**/ios/**/*.pbxuser
51+
**/ios/**/*.perspectivev3
52+
**/ios/**/*sync/
53+
**/ios/**/.sconsign.dblite
54+
**/ios/**/.tags*
55+
**/ios/**/.vagrant/
56+
**/ios/**/DerivedData/
57+
**/ios/**/Icon?
58+
**/ios/**/Pods/
59+
**/ios/**/.symlinks/
60+
**/ios/**/profile
61+
**/ios/**/xcuserdata
62+
**/ios/.generated/
63+
**/ios/Flutter/App.framework
64+
**/ios/Flutter/Flutter.framework
65+
**/ios/Flutter/Generated.xcconfig
66+
**/ios/Flutter/app.flx
67+
**/ios/Flutter/app.zip
68+
**/ios/Flutter/flutter_assets/
69+
**/ios/ServiceDefinitions.json
70+
**/ios/Runner/GeneratedPluginRegistrant.*
71+
72+
# Exceptions to above rules.
73+
!**/ios/**/default.mode1v3
74+
!**/ios/**/default.mode2v3
75+
!**/ios/**/default.pbxuser
76+
!**/ios/**/default.perspectivev3
77+
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
78+
79+
pubspec.lock
80+
!**/example/pubspec.lock

.metadata

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This file tracks properties of this Flutter project.
2+
# Used by Flutter tool to assess capabilities and perform upgrades etc.
3+
#
4+
# This file should be version controlled and should not be manually edited.
5+
6+
version:
7+
revision: 7a4c33425ddd78c54aba07d86f3f9a4a0051769b
8+
channel: stable
9+
10+
project_type: plugin

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 0.0.1
2+
3+

CONTRIBUTING.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
Contributing to the Flutter Easy Plugin
2+
=============================================
3+
4+
What you will need
5+
------------------
6+
7+
* A Linux, Mac OS X, or Windows machine (note: to run and compile iOS specific parts you'll need access to a Mac OS X machine);
8+
* git (used for source version control, installation instruction can be found [here](https://git-scm.com/));
9+
* The Flutter SDK (installation instructions can be found [here](https://flutter.io/get-started/install/));
10+
* A personal GitHub account (if you don't have one, you can sign-up for free [here](https://github.com/))
11+
12+
Setting up your development environment
13+
---------------------------------------
14+
15+
* Fork `https://github.com/modool/flutter_easy_plugin` into your own GitHub account. If you already have a fork and moving to a new computer, make sure you update you fork.
16+
* If you haven't configured your machine with an SSH key that's known to github, then
17+
follow [GitHub's directions](https://help.github.com/articles/generating-ssh-keys/)
18+
to generate an SSH key.
19+
* Clone your forked repo on your local development machine: `git clone [email protected]:<your_name_here>/flutter_easy_plugin.git`
20+
* Change into the `flutter_easy_plugin` directory: `cd flutter_easy_plugin`
21+
* Add an upstream to the original repo, so that fetch from the master repository and not your clone: `git remote add upstream [email protected]:Modool/flutter_easy_plugin.git`
22+
23+
Running the example project
24+
---------------------------
25+
26+
* Change into the example directory: `cd example`
27+
* Run the App: `flutter run`
28+
29+
Contribute
30+
----------
31+
32+
We really appreciate contributions via GitHub pull requests. To contribute take the following steps:
33+
34+
* Make sure you are up to date with the latest code on the master:
35+
* `git fetch upstream`
36+
* `git checkout upstream/develop -b <name_of_your_branch>`
37+
* Apply your changes
38+
* Verify your changes and fix potential warnings/ errors:
39+
* Check formatting: `flutter format .`
40+
* Run static analyses: `flutter analyzes`
41+
* Run unit-tests: `flutter test`
42+
* Commit your changes: `git commit -am "<your informative commit message>"`
43+
* Push changes to your fork: `git push origin <name_of_your_branch>`
44+
45+
Send us your pull request:
46+
47+
* Go to `https://github.com/modool/flutter_easy_plugin` and click the "Compare & pull request" button.
48+
49+
Please make sure you solved all warnings and errors reported by the static code analyses and that you fill in the full pull request template. Failing to do so will result in us asking you to fix it.

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 Modool
3+
Copyright (c) 2018 Baseflow
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+92-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,92 @@
1-
# flutter_easy_plugin
1+
# Flutter Easy Plugin
2+
3+
A plugin basic class for Flutter. To implement method of plugin class directly without `handleMethodCall` or `onMethodCall` .
4+
5+
![Flutter Test](https://github.com/Modool/flutter_easy_plugin/workflows/Flutter%20Test/badge.svg) [![pub package](https://img.shields.io/pub/v/flutter_easy_plugin.svg)](https://pub.dartlang.org/packages/flutter_easy_plugin) [![Build Status](https://app.bitrise.io/app/fa4f5d4bf452bcfb/status.svg?token=HorGpL_AOw2llYz39CjmdQ&branch=master)](https://app.bitrise.io/app/fa4f5d4bf452bcfb) [![style: effective dart](https://img.shields.io/badge/style-effective_dart-40c4ff.svg)](https://github.com/tenhobi/effective_dart)
6+
7+
## Features
8+
9+
* Class `FlutterEasyPlugin` must be as parent class.
10+
* Subclass implement plugin method directly without `handleMethodCall` or `onMethodCall`.
11+
* Just like an native method implementation for Flutter channel call.
12+
* Support result such as return-value, async-return-value and error for implemented method.
13+
* Try to see examples for detail or see method `getPlatformVersion`.
14+
15+
## Usage
16+
17+
To use this plugin, add `flutter_easy_plugin` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/). For example:
18+
19+
```yaml
20+
dependencies:
21+
flutter_easy_plugin: 0.0.1
22+
```
23+
24+
## API
25+
26+
### iOS
27+
28+
```objc
29+
30+
// iOS result
31+
@interface FlutterEasyPluginResult : NSObject
32+
33+
+ (instancetype)notImplemention;
34+
35+
+ (instancetype)return:(id)value;
36+
37+
+ (instancetype)error:(NSError *)error;
38+
39+
+ (instancetype)async:(void (^)(void (^done)(id value, NSError *_Nullable error)))block;
40+
41+
@end
42+
43+
// iOS base class
44+
@interface FlutterEasyPlugin : NSObject<FlutterPlugin>
45+
46+
@property (nonatomic, copy, class, readonly) NSString *channelName;
47+
48+
@property (nonatomic, strong, readonly) FlutterMethodChannel *methodChannel;
49+
50+
- (instancetype)initWithMethodChannel:(FlutterMethodChannel *)methodChannel NS_DESIGNATED_INITIALIZER;
51+
52+
@end
53+
54+
```
55+
56+
### Android
57+
58+
```java
59+
// Android Result
60+
public abstract class FlutterEasyPluginResult {
61+
public static FlutterEasyPluginResult success(Object object) {
62+
return new FlutterEasyPluginReturnResult(object);
63+
}
64+
65+
public static FlutterEasyPluginResult error(Error error) {
66+
return new FlutterEasyPluginErrorResult(error);
67+
}
68+
69+
public static FlutterEasyPluginResult notImplemented() {
70+
return new FlutterEasyPluginNotImplementedResult();
71+
}
72+
public static FlutterEasyPluginResult async(AsyncExcutor excutor) {
73+
return new FlutterEasyPluginAsyncResult(excutor);
74+
}
75+
}
76+
77+
// Android base class
78+
public class FlutterEasyPlugin implements MethodCallHandler {}
79+
```
80+
81+
82+
## Issues
83+
84+
Please file any issues, bugs or feature request as an issue on our [Github](https://github.com/modool/flutter_easy_plugin/issues) page.
85+
86+
## Want to contribute
87+
88+
If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our [contribution guide](CONTRIBUTING.md) and send us your [pull request](https://github.com/modool/flutter_easy_plugin/pulls).
89+
90+
## Author
91+
92+
This Flutter easy plugin for Flutter is developed by [modool](https://github.com/modool). You can contact us at <[email protected]>

android/.gitignore

+8
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

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
group 'com.modool.flutter_easy_plugin'
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.2.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 28
26+
27+
defaultConfig {
28+
minSdkVersion 16
29+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
30+
consumerProguardFiles 'proguard-rules.pro'
31+
}
32+
lintOptions {
33+
disable 'InvalidPackage'
34+
}
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Fri Jun 19 17:04:21 CST 2020
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

android/proguard-rules.pro

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-keep public class * extends com.modool.flutter_easy_plugin.FlutterEasyPlugin { *; }

android/settings.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'flutter_easy_plugin'

android/src/main/AndroidManifest.xml

+3
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.modool.flutter_easy_plugin">
3+
</manifest>

0 commit comments

Comments
 (0)