From 222df7b655c51992580b832f5e06c6772d27d9d6 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 12 三月 2022 15:21:20 +0800 Subject: [PATCH] 'Android集成flutter插件' --- src/main/resources/code/android/library-flutter/src/main/res/values-night/themes.xml | 16 src/main/resources/code/flutter_module/pubspec.yaml | 163 ++++ src/main/resources/code/android/library-flutter/.gitignore | 1 src/main/resources/code/android/app/src/main/java/com/demo/app/MyApplication.java | 88 ++ src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/message/DataMethodChannel.java | 71 + src/main/resources/code/android/library-flutter/src/main/res/drawable/ic_launcher_background.xml | 170 ++++ src/main/resources/code/flutter_module/.gitignore | 48 + src/main/resources/code/android/library-flutter/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp | 0 src/main/resources/code/android/library-flutter/src/main/res/mipmap-xhdpi/ic_launcher_round.webp | 0 src/main/resources/code/android/library-flutter/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp | 0 src/main/resources/code/android/library-flutter/src/main/res/values/colors.xml | 10 src/main/resources/code/android/library-flutter/src/main/res/values/themes.xml | 16 src/main/resources/code/flutter_module/analysis_options.yaml | 4 src/main/resources/code/android/library-flutter/src/main/res/mipmap-xxxhdpi/ic_launcher.webp | 0 src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/FlutterCommonActivity.java | 14 src/main/resources/code/android/settings.gradle | 69 + src/main/resources/code/android/library-flutter/build.gradle | 46 + src/main/resources/code/android/library-flutter/src/androidTest/java/com/demo/library_flutter/ExampleInstrumentedTest.java | 26 src/main/resources/code/flutter_module/README.md | 11 src/main/resources/code/android/library-flutter/src/main/res/mipmap-hdpi/ic_launcher.webp | 0 src/main/resources/code/android/library-flutter/src/main/res/mipmap-mdpi/ic_launcher.webp | 0 src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/message/UIMethodChannel.java | 58 + src/main/resources/code/flutter_module/.metadata | 10 src/main/resources/code/flutter_module/settings.gradle | 3 src/main/resources/code/android/library-flutter/src/main/res/layout/activity_main.xml | 18 src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/message/AdMethodChannel.java | 62 + src/main/resources/code/android/library-flutter/src/main/res/mipmap-mdpi/ic_launcher_round.webp | 0 src/main/resources/code/android/library-ad/build.gradle | 4 src/main/resources/code/flutter_module/lib/main.dart | 112 ++ src/main/resources/code/flutter_module/pubspec.lock | 791 +++++++++++++++++++ src/main/resources/code/android/library-common/src/com/demo/lib/common/util/ui/MyActivityManager.java | 33 src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/nativeview/GDTExpressNativeViewFactory.java | 33 src/main/resources/code/android/library-flutter/src/main/res/mipmap-xxhdpi/ic_launcher.webp | 0 src/main/resources/code/android/library-flutter/src/main/res/mipmap-hdpi/ic_launcher_round.webp | 0 src/main/resources/code/android/library-flutter/src/main/AndroidManifest.xml | 31 src/main/resources/code/android/library-flutter/src/main/res/values/strings.xml | 3 src/main/resources/code/android/library-flutter/src/main/res/mipmap-xhdpi/ic_launcher.webp | 0 src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/nativeview/CSJExpressNativeView.java | 131 +++ src/main/resources/code/android/library-flutter/src/main/res/mipmap-anydpi-v26/ic_launcher.xml | 5 src/main/resources/code/android/app/build.gradle | 2 src/main/resources/code/android/library-flutter/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml | 5 src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/nativeview/GDTExpressNativeView.java | 138 +++ src/main/resources/code/android/library-flutter/proguard-rules.pro | 21 src/main/resources/code/android/library-flutter/src/main/res/drawable-v24/ic_launcher_foreground.xml | 30 src/main/resources/code/android/library-flutter/src/test/java/com/demo/library_flutter/ExampleUnitTest.java | 17 src/main/resources/code/android/build.gradle | 47 + src/main/resources/code/flutter_module/test/widget_test.dart | 30 src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/nativeview/CSJExpressNativeViewFactory.java | 32 48 files changed, 2,337 insertions(+), 32 deletions(-) diff --git a/src/main/resources/code/android/app/build.gradle b/src/main/resources/code/android/app/build.gradle index 1d2455f..4157a04 100644 --- a/src/main/resources/code/android/app/build.gradle +++ b/src/main/resources/code/android/app/build.gradle @@ -34,7 +34,6 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.2.0' - implementation 'com.google.android.material:material:1.3.0' implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation project(path: ':library-common') @@ -42,6 +41,7 @@ implementation project(path: ':library-ad') implementation project(path: ':library-ec') implementation project(path: ':library-login') + implementation project(path: ':library-flutter') testImplementation 'junit:junit:4.+' androidTestImplementation 'androidx.test.ext:junit:1.1.2' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' diff --git a/src/main/resources/code/android/app/src/main/java/com/demo/app/MyApplication.java b/src/main/resources/code/android/app/src/main/java/com/demo/app/MyApplication.java index feff1ac..a8d56f7 100644 --- a/src/main/resources/code/android/app/src/main/java/com/demo/app/MyApplication.java +++ b/src/main/resources/code/android/app/src/main/java/com/demo/app/MyApplication.java @@ -1,19 +1,47 @@ package com.demo.app; +import android.Manifest; +import android.app.Activity; import android.app.Application; import android.content.Context; +import android.content.Intent; +import android.os.Bundle; import com.bytedance.sdk.dp.DPSdkConfig; import com.bytedance.sdk.openadsdk.TTAdSdk; import com.demo.app.utils.Constant; import com.demo.app.utils.UserUtil; +import com.demo.app.utils.api.HttpApiUtil; +import com.demo.lib.common.util.ui.MyActivityManager; import com.demo.library_ad.AdUtil; import com.demo.library_dp.DPUtil; import com.demo.lib.common.util.ManifestDataUtil; +import com.demo.library_flutter.FlutterCommonActivity; +import com.demo.library_flutter.message.AdMethodChannel; +import com.demo.library_flutter.message.DataMethodChannel; +import com.demo.library_flutter.message.UIMethodChannel; +import com.demo.library_flutter.nativeview.CSJExpressNativeViewFactory; +import com.demo.library_flutter.nativeview.GDTExpressNativeViewFactory; +import com.idlefish.flutterboost.FlutterBoost; +import com.idlefish.flutterboost.FlutterBoostDelegate; +import com.idlefish.flutterboost.FlutterBoostRouteOptions; +import com.idlefish.flutterboost.containers.FlutterBoostActivity; import com.umeng.analytics.MobclickAgent; import com.umeng.commonsdk.UMConfigure; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.Map; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.multidex.MultiDex; +import io.flutter.embedding.android.FlutterActivityLaunchConfigs; +import io.flutter.embedding.engine.FlutterEngine; +import io.flutter.plugin.common.MethodCall; +import io.flutter.plugin.common.MethodChannel; +import io.flutter.plugin.common.StandardMessageCodec; +import io.flutter.plugin.platform.PlatformViewRegistry; public class MyApplication extends Application { public static MyApplication application = null; @@ -57,6 +85,8 @@ initNovel(application); //绌垮北鐢插皬瑙嗛 initDPSDK(application); + + initFlutter(application); } @@ -107,6 +137,64 @@ } } + public static void initFlutter(Application application) { + + FlutterBoost.instance().setup(application, new FlutterBoostDelegate() { + @Override + public void pushNativeRoute(FlutterBoostRouteOptions options) { + //杩欓噷鏍规嵁options.pageName鏉ュ垽鏂綘鎯宠烦杞摢涓〉闈紝杩欓噷绠�鍗曠粰涓�涓� + Intent intent = new Intent(FlutterBoost.instance().currentActivity(), FlutterCommonActivity.class); + FlutterBoost.instance().currentActivity().startActivityForResult(intent, options.requestCode()); + } + + @Override + public void pushFlutterRoute(FlutterBoostRouteOptions options) { + Intent intent = new FlutterBoostActivity.CachedEngineIntentBuilder(FlutterBoostActivity.class) + .backgroundMode(FlutterActivityLaunchConfigs.BackgroundMode.transparent) + .destroyEngineWithActivity(false) + .uniqueId(options.uniqueId()) + .url(options.pageName()) + .urlParams(options.arguments()) + .build(FlutterBoost.instance().currentActivity()); + FlutterBoost.instance().currentActivity().startActivity(intent); + } + }, engine -> { + PlatformViewRegistry registry = engine.getPlatformViewsController().getRegistry(); + registry.registerViewFactory("ad-csj-express-view", new CSJExpressNativeViewFactory(engine.getDartExecutor().getBinaryMessenger(), StandardMessageCodec.INSTANCE)); + registry.registerViewFactory("ad-gdt-express-view", new GDTExpressNativeViewFactory(engine.getDartExecutor().getBinaryMessenger(), StandardMessageCodec.INSTANCE)); + + //鏁版嵁鎺ュ彛 + new DataMethodChannel(engine.getDartExecutor().getBinaryMessenger(), application.getApplicationContext(), new DataMethodChannel.DataListener() { + @Override + public Map<String, Object> getBaseRequestParams(Map<String, Object> params) { + LinkedHashMap<String, String> ps = new LinkedHashMap<>(); + if (params != null) + for (Iterator<String> its = params.keySet().iterator(); its.hasNext(); ) { + String key = its.next(); + if (params.get(key) != null) { + ps.put(key, params.get(key).toString()); + } + } + HttpApiUtil.getRequestParams(application.getApplicationContext(), ps); + return null; + } + }); + //UI鎺ュ彛 + new UIMethodChannel(engine.getDartExecutor().getBinaryMessenger(), application.getApplicationContext(), new UIMethodChannel.DataListener() { + @Override + public boolean isStatusBarDefaultLight() { + return true; + } + }); + //骞垮憡鎺ュ彛 + new AdMethodChannel(engine.getDartExecutor().getBinaryMessenger(), application.getApplicationContext(), new AdMethodChannel.DataListener() { + + }); + + + }); + } + public interface InitListener { public void onFinish(); diff --git a/src/main/resources/code/android/build.gradle b/src/main/resources/code/android/build.gradle index dafbeab..7a188ec 100644 --- a/src/main/resources/code/android/build.gradle +++ b/src/main/resources/code/android/build.gradle @@ -27,6 +27,13 @@ maven { url 'https://jitpack.io' } + maven { + url 'D:\\workspace\\codegenerator\\src\\main\\resources\\flutter_module\\build\\host\\outputs\\repo' + } + maven { + url 'https://storage.googleapis.com/download.flutter.io' + } + } dependencies { classpath 'com.android.tools.build:gradle:4.1.3' @@ -35,6 +42,46 @@ } } +allprojects { + + repositories { + maven { + url "https://maven.aliyun.com/repository/public" + } + + maven { + url "https://maven.aliyun.com/repository/google" + } + mavenCentral() + + //绌垮北鐢� + maven { + url 'https://artifact.bytedance.com/repository/pangle' + } + + //鐏北寮曟搸maven浠撳簱鍦板潃 + maven { url 'https://artifact.bytedance.com/repository/Volcengine/' } + + //闃块噷鐧惧窛 + maven { + url "http://repo.baichuan-android.taobao.com/content/groups/BaichuanRepositories/" + } + + jcenter() + + maven { url 'https://jitpack.io' } + + maven { + url 'D:\\workspace\\codegenerator\\src\\main\\resources\\flutter_module\\build\\host\\outputs\\repo' + } + maven { + url 'https://storage.googleapis.com/download.flutter.io' + } + + } + +} + task clean(type: Delete) { delete rootProject.buildDir } \ No newline at end of file diff --git a/src/main/resources/code/android/library-ad/build.gradle b/src/main/resources/code/android/library-ad/build.gradle index 67365a9..b8d9aec 100644 --- a/src/main/resources/code/android/library-ad/build.gradle +++ b/src/main/resources/code/android/library-ad/build.gradle @@ -36,7 +36,7 @@ implementation project(path: ':library-common') //绌垮北鐢� - api 'com.pangle.cn:ads-sdk-pro:4.2.0.3' + api 'com.pangle.cn:ads-sdk-pro:4.3.0.8' //骞跨偣閫� - api 'com.qq.e.union:union:4.440.1310' + api 'com.qq.e.union:union:4.452.1322' } \ No newline at end of file diff --git a/src/main/resources/code/android/library-common/src/com/demo/lib/common/util/ui/MyActivityManager.java b/src/main/resources/code/android/library-common/src/com/demo/lib/common/util/ui/MyActivityManager.java new file mode 100644 index 0000000..12e1252 --- /dev/null +++ b/src/main/resources/code/android/library-common/src/com/demo/lib/common/util/ui/MyActivityManager.java @@ -0,0 +1,33 @@ +package com.demo.lib.common.util.ui; + +import android.app.Activity; + +import java.lang.ref.WeakReference; + +public class MyActivityManager { + private static MyActivityManager sInstance = new MyActivityManager(); + private WeakReference<Activity> sCurrentActivityWeakRef; + + + private MyActivityManager() { + + } + + public static MyActivityManager getInstance() { + return sInstance; + } + + public Activity getCurrentActivity() { + Activity currentActivity = null; + if (sCurrentActivityWeakRef != null) { + currentActivity = sCurrentActivityWeakRef.get(); + } + return currentActivity; + } + + public void setCurrentActivity(Activity activity) { + sCurrentActivityWeakRef = new WeakReference<Activity>(activity); + } + + +} diff --git a/src/main/resources/code/android/library-flutter/.gitignore b/src/main/resources/code/android/library-flutter/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/src/main/resources/code/android/library-flutter/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/src/main/resources/code/android/library-flutter/build.gradle b/src/main/resources/code/android/library-flutter/build.gradle new file mode 100644 index 0000000..d81fadb --- /dev/null +++ b/src/main/resources/code/android/library-flutter/build.gradle @@ -0,0 +1,46 @@ +plugins { + id 'com.android.library' +} + +android { + compileSdkVersion 31 + + defaultConfig { + applicationId "com.demo.library_flutter" + minSdkVersion 19 + targetSdkVersion 31 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + profile { + initWith debug + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'com.google.android.material:material:1.3.0' + implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + implementation project(path: ':library-ad') + implementation project(path: ':library-common') + testImplementation 'junit:junit:4.+' + androidTestImplementation 'androidx.test.ext:junit:1.1.2' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' + + api project(':flutter') + api project(':flutter_boost') +} \ No newline at end of file diff --git a/src/main/resources/code/android/library-flutter/proguard-rules.pro b/src/main/resources/code/android/library-flutter/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/src/main/resources/code/android/library-flutter/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/src/main/resources/code/android/library-flutter/src/androidTest/java/com/demo/library_flutter/ExampleInstrumentedTest.java b/src/main/resources/code/android/library-flutter/src/androidTest/java/com/demo/library_flutter/ExampleInstrumentedTest.java new file mode 100644 index 0000000..92c2a03 --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/androidTest/java/com/demo/library_flutter/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.demo.library_flutter; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("com.demo.library_flutter", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/src/main/resources/code/android/library-flutter/src/main/AndroidManifest.xml b/src/main/resources/code/android/library-flutter/src/main/AndroidManifest.xml new file mode 100644 index 0000000..54081ae --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/AndroidManifest.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.demo.library_flutter"> + + <application + android:allowBackup="true" + android:icon="@mipmap/ic_launcher" + android:label="@string/app_name" + android:roundIcon="@mipmap/ic_launcher_round" + android:supportsRtl="true" + android:theme="@style/Theme.Android"> + <activity + android:name=".FlutterCommonActivity" + android:exported="true"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + + <activity + android:name="io.flutter.embedding.android.FlutterActivity" + android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" + android:hardwareAccelerated="true" + android:windowSoftInputMode="adjustResize" + /> + + </application> + +</manifest> \ No newline at end of file diff --git a/src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/FlutterCommonActivity.java b/src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/FlutterCommonActivity.java new file mode 100644 index 0000000..cf8a92a --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/FlutterCommonActivity.java @@ -0,0 +1,14 @@ +package com.demo.library_flutter; + +import androidx.appcompat.app.AppCompatActivity; + +import android.os.Bundle; + +public class FlutterCommonActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + } +} \ No newline at end of file diff --git a/src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/message/AdMethodChannel.java b/src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/message/AdMethodChannel.java new file mode 100644 index 0000000..8a2eb8a --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/message/AdMethodChannel.java @@ -0,0 +1,62 @@ +package com.demo.library_flutter.message; + +import android.content.Context; +import android.content.SharedPreferences; + +import com.alibaba.fastjson.JSONObject; +import com.demo.library_ad.AdUtil; +import com.demo.library_ad.FullVideoAdManager; +import com.demo.library_ad.IntertitialAdUtil; +import com.idlefish.flutterboost.FlutterBoost; + +import java.util.Map; + +import androidx.annotation.NonNull; +import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugin.common.MethodCall; +import io.flutter.plugin.common.MethodChannel; +import io.flutter.plugin.common.MethodCodec; +import io.flutter.plugin.common.StandardMessageCodec; + +public class AdMethodChannel extends MethodChannel { + public AdMethodChannel(BinaryMessenger messenger, Context context, DataListener dataListener) { + super(messenger, "com.yeshi.video/ad", (MethodCodec) StandardMessageCodec.INSTANCE); + setMethodCallHandler(new MethodCallHandler() { + @Override + public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) { + + switch (call.method) { + case "loadCSJFullScreenAd": { + String pid = call.argument("pid"); + FullVideoAdManager.getInstance().loadAd(FlutterBoost.instance().currentActivity(), AdUtil.AD_TYPE.csj, pid, new FullVideoAdManager.IFullVideoAdListener() { + @Override + public void onFail(String msg) { + + } + + @Override + public void onFinish() { + + } + }); + } + break; + + case "loadGDTInterstitialAd": { + String pid = call.argument("pid"); + IntertitialAdUtil.showAd(FlutterBoost.instance().currentActivity(), AdUtil.AD_TYPE.gdt, pid); + } + break; + } + + + } + + + }); + } + + public interface DataListener { + + } +} diff --git a/src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/message/DataMethodChannel.java b/src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/message/DataMethodChannel.java new file mode 100644 index 0000000..cbe1e79 --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/message/DataMethodChannel.java @@ -0,0 +1,71 @@ +package com.demo.library_flutter.message; + +import android.content.Context; +import android.content.SharedPreferences; + +import com.alibaba.fastjson.JSONObject; + +import java.util.Map; + +import androidx.annotation.NonNull; +import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugin.common.JSONUtil; +import io.flutter.plugin.common.MethodCall; +import io.flutter.plugin.common.MethodChannel; +import io.flutter.plugin.common.MethodCodec; +import io.flutter.plugin.common.StandardMessageCodec; + +public class DataMethodChannel extends MethodChannel { + public DataMethodChannel(BinaryMessenger messenger, Context context, DataListener dataListener) { + super(messenger, "com.yeshi.video/data", (MethodCodec) StandardMessageCodec.INSTANCE); + setMethodCallHandler(new MethodCallHandler() { + @Override + public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) { + + switch (call.method) { + case "setSharedValue": { + String key = call.argument("key"); + String value = call.argument("value"); + SharedPreferences sharedPreferences = context.getSharedPreferences("flutter", Context.MODE_PRIVATE); + SharedPreferences.Editor editor = sharedPreferences.edit(); + editor.putString(key, value); + editor.commit(); + } + break; + + case "getSharedValue": { + SharedPreferences sharedPreferences = context.getSharedPreferences("flutter", Context.MODE_PRIVATE); + result.success(sharedPreferences.getString(call.arguments + "", "")); + } + break; + case "removeSharedValue": { + SharedPreferences sharedPreferences = context.getSharedPreferences("flutter", Context.MODE_PRIVATE); + SharedPreferences.Editor editor = sharedPreferences.edit(); + editor.remove(call.arguments + ""); + editor.commit(); + } + break; + case "getAdConfig": + SharedPreferences sharedPreferences = context.getSharedPreferences("flutter", Context.MODE_PRIVATE); + result.success(sharedPreferences.getString("adConfig", "")); + break; + case "getBaseRequestParams": + //鑾峰彇璇锋眰鍙傛暟 + Map<String, Object> params = (Map<String, Object>) call.arguments; + params = dataListener.getBaseRequestParams(params); + //杞琷son杩斿洖 + result.success(JSONObject.toJSON(params)); + break; + } + + + } + + + }); + } + + public interface DataListener { + public Map<String, Object> getBaseRequestParams(Map<String, Object> params); + } +} diff --git a/src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/message/UIMethodChannel.java b/src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/message/UIMethodChannel.java new file mode 100644 index 0000000..bc497ac --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/message/UIMethodChannel.java @@ -0,0 +1,58 @@ +package com.demo.library_flutter.message; + +import android.content.Context; +import android.content.SharedPreferences; +import android.widget.Toast; + +import com.alibaba.fastjson.JSONObject; +import com.idlefish.flutterboost.FlutterBoost; +import com.jaeger.library.StatusBarUtil; + +import java.util.Map; + +import androidx.annotation.NonNull; +import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugin.common.MethodCall; +import io.flutter.plugin.common.MethodChannel; +import io.flutter.plugin.common.MethodCodec; +import io.flutter.plugin.common.StandardMessageCodec; + +public class UIMethodChannel extends MethodChannel { + public UIMethodChannel(BinaryMessenger messenger, Context context, DataListener dataListener) { + super(messenger, "com.yeshi.video/ui", (MethodCodec) StandardMessageCodec.INSTANCE); + setMethodCallHandler(new MethodCallHandler() { + @Override + public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) { + + switch (call.method) { + case "toast": { + Toast.makeText(context, call.arguments + "", Toast.LENGTH_SHORT).show(); + } + break; + + case "setStatusBarLight": { + StatusBarUtil.setLightMode(FlutterBoost.instance().currentActivity()); + } + break; + + case "setStatusBarDark": { + StatusBarUtil.setDarkMode(FlutterBoost.instance().currentActivity()); + } + break; + case "setStatusBarDefault": + if (dataListener.isStatusBarDefaultLight()) { + StatusBarUtil.setLightMode(FlutterBoost.instance().currentActivity()); + } else { + StatusBarUtil.setDarkMode(FlutterBoost.instance().currentActivity()); + } + break; + } + } + }); + } + + public interface DataListener { + //鐘舵�佹爮鏄惁榛樿娴呰壊 + public boolean isStatusBarDefaultLight(); + } +} diff --git a/src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/nativeview/CSJExpressNativeView.java b/src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/nativeview/CSJExpressNativeView.java new file mode 100644 index 0000000..066807d --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/nativeview/CSJExpressNativeView.java @@ -0,0 +1,131 @@ +package com.demo.library_flutter.nativeview; + +import android.app.Activity; +import android.app.ActivityManager; +import android.content.Context; +import android.view.View; +import android.view.ViewGroup; +import android.widget.FrameLayout; + +import com.bytedance.sdk.openadsdk.AdSlot; +import com.bytedance.sdk.openadsdk.TTAdConstant; +import com.bytedance.sdk.openadsdk.TTAdDislike; +import com.bytedance.sdk.openadsdk.TTAdManager; +import com.bytedance.sdk.openadsdk.TTAdNative; +import com.bytedance.sdk.openadsdk.TTNativeExpressAd; +import com.demo.lib.common.util.ui.MyActivityManager; +import com.demo.library_ad.TTAdManagerHolder; +import com.idlefish.flutterboost.FlutterBoost; + +import java.util.List; +import java.util.Map; + +import androidx.annotation.NonNull; +import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugin.common.MessageCodec; +import io.flutter.plugin.common.MethodCall; +import io.flutter.plugin.common.MethodChannel; +import io.flutter.plugin.platform.PlatformView; +import io.flutter.plugin.platform.PlatformViewFactory; + +class CSJExpressNativeView implements PlatformView { + private Map<String, Object> params; + private TTAdNative mTTAdNative; + private MethodChannel methodChannel; + + public CSJExpressNativeView(int viewId, Map<String, Object> params, Context context, BinaryMessenger binaryMessenger) { + this.params = params; + try { + TTAdManager ttAdManager = TTAdManagerHolder.get(); + mTTAdNative = ttAdManager.createAdNative(context); + } catch (Exception e) { + e.printStackTrace(); + } + methodChannel = new MethodChannel(binaryMessenger, "ad-csj-express-view-" + viewId); + methodChannel.setMethodCallHandler(new MethodChannel.MethodCallHandler() { + @Override + public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result result) { + if ("refresh".equalsIgnoreCase(call.method)) { + //鍒锋柊 + if (fl_container != null && adSlot != null) { + loadAd(adSlot, fl_container); + } + + } + } + }); + } + + private AdSlot adSlot = null; + private FrameLayout fl_container; + + @Override + public View getView() { + if (fl_container == null) { + fl_container = new FrameLayout(getView().getContext()); + } + if (adSlot == null) { + float width = Float.parseFloat(params.get("width") + ""); + float height = Float.parseFloat(params.get("height") + ""); + String pid = params.get("pid") + ""; + adSlot = new AdSlot.Builder() + .setCodeId(pid) + .setSupportDeepLink(true) + .setExpressViewAcceptedSize(width, height) + .setAdCount(1) //璇锋眰骞垮憡鏁伴噺涓�1鍒�3鏉� + .build(); + } + loadAd(adSlot, fl_container); + return fl_container; + } + + private void loadAd(AdSlot adSlot, FrameLayout container) { + mTTAdNative.loadNativeExpressAd(adSlot, new TTAdNative.NativeExpressAdListener() { + @Override + public void onError(int i, String s) { + //鍔犺浇澶辫触 + methodChannel.invokeMethod("loadFail", s); + } + + @Override + public void onNativeExpressAdLoad(List<TTNativeExpressAd> list) { + + if (list != null && list.size() > 0) { + + if (FlutterBoost.instance().currentActivity() != null) { + list.get(0).setDislikeCallback(FlutterBoost.instance().currentActivity(), new TTAdDislike.DislikeInteractionCallback() { + @Override + public void onShow() { + + } + + @Override + public void onSelected(int i, String s, boolean b) { + //鍏抽棴骞垮憡 + methodChannel.invokeMethod("close", null); + } + + @Override + public void onCancel() { + + } + }); + } + list.get(0).render(); + fl_container.removeAllViews(); + if (list.get(0).getExpressAdView().getParent() != null) { + ((ViewGroup) list.get(0).getExpressAdView().getParent()).removeAllViews(); + } + fl_container.addView(list.get(0).getExpressAdView()); + } + } + }); + + } + + @Override + public void dispose() { + + } +} + diff --git a/src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/nativeview/CSJExpressNativeViewFactory.java b/src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/nativeview/CSJExpressNativeViewFactory.java new file mode 100644 index 0000000..7526f88 --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/nativeview/CSJExpressNativeViewFactory.java @@ -0,0 +1,32 @@ +package com.demo.library_flutter.nativeview; + + +import android.content.Context; + +import java.util.Map; + +import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugin.common.MessageCodec; +import io.flutter.plugin.platform.PlatformView; +import io.flutter.plugin.platform.PlatformViewFactory; + +public class CSJExpressNativeViewFactory extends PlatformViewFactory { + + private BinaryMessenger binaryMessenger; + + /** + * @param createArgsCodec the codec used to decode the args parameter of {@link #create}. + */ + public CSJExpressNativeViewFactory(BinaryMessenger binaryMessenger, MessageCodec<Object> createArgsCodec) { + super(createArgsCodec); + this.binaryMessenger = binaryMessenger; + } + + @Override + public PlatformView create(Context context, int viewId, Object args) { + //鍙傛暟 + Map params = (Map) args; + CSJExpressNativeView view = new CSJExpressNativeView(viewId, params, context, binaryMessenger); + return view; + } +} \ No newline at end of file diff --git a/src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/nativeview/GDTExpressNativeView.java b/src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/nativeview/GDTExpressNativeView.java new file mode 100644 index 0000000..1736f34 --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/nativeview/GDTExpressNativeView.java @@ -0,0 +1,138 @@ +package com.demo.library_flutter.nativeview; + +import android.app.Activity; +import android.content.Context; +import android.view.View; +import android.view.ViewGroup; +import android.widget.FrameLayout; + +import com.bytedance.sdk.openadsdk.AdSlot; +import com.bytedance.sdk.openadsdk.TTAdDislike; +import com.bytedance.sdk.openadsdk.TTAdManager; +import com.bytedance.sdk.openadsdk.TTAdNative; +import com.bytedance.sdk.openadsdk.TTNativeExpressAd; +import com.demo.lib.common.util.common.DimenUtils; +import com.demo.lib.common.util.ui.MyActivityManager; +import com.demo.library_ad.TTAdManagerHolder; +import com.qq.e.ads.cfg.VideoOption; +import com.qq.e.ads.nativ.ADSize; +import com.qq.e.ads.nativ.NativeExpressAD; +import com.qq.e.ads.nativ.NativeExpressADView; +import com.qq.e.comm.util.AdError; + +import java.util.List; +import java.util.Map; + +import androidx.annotation.NonNull; +import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugin.common.MethodCall; +import io.flutter.plugin.common.MethodChannel; +import io.flutter.plugin.platform.PlatformView; + +class GDTExpressNativeView implements PlatformView { + private Map<String, Object> params; + private NativeExpressAD nativeExpressAD; + private MethodChannel methodChannel; + + public GDTExpressNativeView(int viewId, Map<String, Object> params, BinaryMessenger binaryMessenger) { + this.params = params; + methodChannel = new MethodChannel(binaryMessenger, "ad-gdt-express-view-" + viewId); + methodChannel.setMethodCallHandler(new MethodChannel.MethodCallHandler() { + @Override + public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result result) { + if ("refresh".equalsIgnoreCase(call.method)) { + //鍒锋柊 + loadAd(); + } + } + }); + } + + private FrameLayout fl_container; + private NativeExpressADView nativeExpressADView; + + @Override + public View getView() { + if (fl_container == null) { + fl_container = new FrameLayout(getView().getContext()); + } + + if (nativeExpressAD == null) { + float width = Float.parseFloat(params.get("width") + ""); + float height = Float.parseFloat(params.get("height") + ""); + String pid = params.get("pid") + ""; + nativeExpressAD = new NativeExpressAD(getView().getContext(), new ADSize(DimenUtils.dipToPixels((int) width, getView().getContext()), ADSize.AUTO_HEIGHT), pid, new NativeExpressAD.NativeExpressADListener() { + @Override + public void onADLoaded(List<NativeExpressADView> list) { + if (nativeExpressADView != null) { + nativeExpressADView.destroy(); + } + nativeExpressADView = list.get(0); + nativeExpressADView.render(); + if (fl_container.getChildCount() > 0) { + fl_container.removeAllViews(); + } + if (nativeExpressADView.getParent() != null) { + ((ViewGroup) nativeExpressADView.getParent()).removeAllViews(); + } + // 闇�瑕佷繚璇� View 琚粯鍒剁殑鏃跺�欐槸鍙鐨勶紝鍚﹀垯灏嗘棤娉曚骇鐢熸洕鍏夊拰鏀剁泭銆� + fl_container.addView(nativeExpressADView); + } + + @Override + public void onRenderFail(NativeExpressADView nativeExpressADView) { + methodChannel.invokeMethod("loadFail", "娓叉煋澶辫触"); + } + + @Override + public void onRenderSuccess(NativeExpressADView nativeExpressADView) { + + } + + @Override + public void onADExposure(NativeExpressADView nativeExpressADView) { + + } + + @Override + public void onADClicked(NativeExpressADView nativeExpressADView) { + + } + + @Override + public void onADClosed(NativeExpressADView nativeExpressADView) { + methodChannel.invokeMethod("close", null); + } + + @Override + public void onADLeftApplication(NativeExpressADView nativeExpressADView) { + + } + + @Override + public void onNoAD(AdError adError) { + methodChannel.invokeMethod("loadFail", adError.getErrorMsg()); + } + }); + + nativeExpressAD.setVideoOption(new VideoOption.Builder() + .setAutoPlayPolicy(VideoOption.AutoPlayPolicy.WIFI) // WIFI 鐜涓嬪彲浠ヨ嚜鍔ㄦ挱鏀捐棰� + .setAutoPlayMuted(true) // 鑷姩鎾斁鏃朵负闈欓煶 + .build()); + } + loadAd(); + return fl_container; + } + + private void loadAd() { + if (nativeExpressAD != null) { + nativeExpressAD.loadAD(1); + } + } + + @Override + public void dispose() { + + } +} + diff --git a/src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/nativeview/GDTExpressNativeViewFactory.java b/src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/nativeview/GDTExpressNativeViewFactory.java new file mode 100644 index 0000000..7c71a47 --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/java/com/demo/library_flutter/nativeview/GDTExpressNativeViewFactory.java @@ -0,0 +1,33 @@ +package com.demo.library_flutter.nativeview; + + +import android.content.Context; + +import java.util.Map; + +import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugin.common.MessageCodec; +import io.flutter.plugin.platform.PlatformView; +import io.flutter.plugin.platform.PlatformViewFactory; + +public class GDTExpressNativeViewFactory extends PlatformViewFactory { + + + private BinaryMessenger binaryMessenger; + + /** + * @param createArgsCodec the codec used to decode the args parameter of {@link #create}. + */ + public GDTExpressNativeViewFactory(BinaryMessenger binaryMessenger, MessageCodec<Object> createArgsCodec) { + super(createArgsCodec); + this.binaryMessenger = binaryMessenger; + } + + @Override + public PlatformView create(Context context, int viewId, Object args) { + //鍙傛暟 + Map params = (Map) args; + GDTExpressNativeView view = new GDTExpressNativeView(viewId, params, binaryMessenger); + return view; + } +} \ No newline at end of file diff --git a/src/main/resources/code/android/library-flutter/src/main/res/drawable-v24/ic_launcher_foreground.xml b/src/main/resources/code/android/library-flutter/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:aapt="http://schemas.android.com/aapt" + android:width="108dp" + android:height="108dp" + android:viewportWidth="108" + android:viewportHeight="108"> + <path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z"> + <aapt:attr name="android:fillColor"> + <gradient + android:endX="85.84757" + android:endY="92.4963" + android:startX="42.9492" + android:startY="49.59793" + android:type="linear"> + <item + android:color="#44000000" + android:offset="0.0" /> + <item + android:color="#00000000" + android:offset="1.0" /> + </gradient> + </aapt:attr> + </path> + <path + android:fillColor="#FFFFFF" + android:fillType="nonZero" + android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z" + android:strokeWidth="1" + android:strokeColor="#00000000" /> +</vector> \ No newline at end of file diff --git a/src/main/resources/code/android/library-flutter/src/main/res/drawable/ic_launcher_background.xml b/src/main/resources/code/android/library-flutter/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ +<?xml version="1.0" encoding="utf-8"?> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="108dp" + android:height="108dp" + android:viewportWidth="108" + android:viewportHeight="108"> + <path + android:fillColor="#3DDC84" + android:pathData="M0,0h108v108h-108z" /> + <path + android:fillColor="#00000000" + android:pathData="M9,0L9,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,0L19,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M29,0L29,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M39,0L39,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M49,0L49,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M59,0L59,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M69,0L69,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M79,0L79,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M89,0L89,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M99,0L99,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,9L108,9" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,19L108,19" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,29L108,29" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,39L108,39" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,49L108,49" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,59L108,59" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,69L108,69" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,79L108,79" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,89L108,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,99L108,99" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,29L89,29" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,39L89,39" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,49L89,49" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,59L89,59" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,69L89,69" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,79L89,79" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M29,19L29,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M39,19L39,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M49,19L49,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M59,19L59,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M69,19L69,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M79,19L79,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> +</vector> diff --git a/src/main/resources/code/android/library-flutter/src/main/res/layout/activity_main.xml b/src/main/resources/code/android/library-flutter/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..5ba7ac3 --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/res/layout/activity_main.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".FlutterCommonActivity"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Hello World!" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/src/main/resources/code/android/library-flutter/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/src/main/resources/code/android/library-flutter/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> + <background android:drawable="@drawable/ic_launcher_background" /> + <foreground android:drawable="@drawable/ic_launcher_foreground" /> +</adaptive-icon> \ No newline at end of file diff --git a/src/main/resources/code/android/library-flutter/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/src/main/resources/code/android/library-flutter/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> + <background android:drawable="@drawable/ic_launcher_background" /> + <foreground android:drawable="@drawable/ic_launcher_foreground" /> +</adaptive-icon> \ No newline at end of file diff --git a/src/main/resources/code/android/library-flutter/src/main/res/mipmap-hdpi/ic_launcher.webp b/src/main/resources/code/android/library-flutter/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 0000000..c209e78 --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/res/mipmap-hdpi/ic_launcher.webp Binary files differ diff --git a/src/main/resources/code/android/library-flutter/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/src/main/resources/code/android/library-flutter/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 0000000..b2dfe3d --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/res/mipmap-hdpi/ic_launcher_round.webp Binary files differ diff --git a/src/main/resources/code/android/library-flutter/src/main/res/mipmap-mdpi/ic_launcher.webp b/src/main/resources/code/android/library-flutter/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 0000000..4f0f1d6 --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/res/mipmap-mdpi/ic_launcher.webp Binary files differ diff --git a/src/main/resources/code/android/library-flutter/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/src/main/resources/code/android/library-flutter/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 0000000..62b611d --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/res/mipmap-mdpi/ic_launcher_round.webp Binary files differ diff --git a/src/main/resources/code/android/library-flutter/src/main/res/mipmap-xhdpi/ic_launcher.webp b/src/main/resources/code/android/library-flutter/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 0000000..948a307 --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/res/mipmap-xhdpi/ic_launcher.webp Binary files differ diff --git a/src/main/resources/code/android/library-flutter/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/src/main/resources/code/android/library-flutter/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..1b9a695 --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/res/mipmap-xhdpi/ic_launcher_round.webp Binary files differ diff --git a/src/main/resources/code/android/library-flutter/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/src/main/resources/code/android/library-flutter/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 0000000..28d4b77 --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/res/mipmap-xxhdpi/ic_launcher.webp Binary files differ diff --git a/src/main/resources/code/android/library-flutter/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/src/main/resources/code/android/library-flutter/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9287f50 --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp Binary files differ diff --git a/src/main/resources/code/android/library-flutter/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/src/main/resources/code/android/library-flutter/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 0000000..aa7d642 --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/res/mipmap-xxxhdpi/ic_launcher.webp Binary files differ diff --git a/src/main/resources/code/android/library-flutter/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/src/main/resources/code/android/library-flutter/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9126ae3 --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp Binary files differ diff --git a/src/main/resources/code/android/library-flutter/src/main/res/values-night/themes.xml b/src/main/resources/code/android/library-flutter/src/main/res/values-night/themes.xml new file mode 100644 index 0000000..7046965 --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ +<resources xmlns:tools="http://schemas.android.com/tools"> + <!-- Base application theme. --> + <style name="Theme.Android" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> + <!-- Primary brand color. --> + <item name="colorPrimary">@color/purple_200</item> + <item name="colorPrimaryVariant">@color/purple_700</item> + <item name="colorOnPrimary">@color/black</item> + <!-- Secondary brand color. --> + <item name="colorSecondary">@color/teal_200</item> + <item name="colorSecondaryVariant">@color/teal_200</item> + <item name="colorOnSecondary">@color/black</item> + <!-- Status bar color. --> + <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item> + <!-- Customize your theme here. --> + </style> +</resources> \ No newline at end of file diff --git a/src/main/resources/code/android/library-flutter/src/main/res/values/colors.xml b/src/main/resources/code/android/library-flutter/src/main/res/values/colors.xml new file mode 100644 index 0000000..f8c6127 --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <color name="purple_200">#FFBB86FC</color> + <color name="purple_500">#FF6200EE</color> + <color name="purple_700">#FF3700B3</color> + <color name="teal_200">#FF03DAC5</color> + <color name="teal_700">#FF018786</color> + <color name="black">#FF000000</color> + <color name="white">#FFFFFFFF</color> +</resources> \ No newline at end of file diff --git a/src/main/resources/code/android/library-flutter/src/main/res/values/strings.xml b/src/main/resources/code/android/library-flutter/src/main/res/values/strings.xml new file mode 100644 index 0000000..20c46c4 --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ +<resources> + <string name="app_name">library-flutter</string> +</resources> \ No newline at end of file diff --git a/src/main/resources/code/android/library-flutter/src/main/res/values/themes.xml b/src/main/resources/code/android/library-flutter/src/main/res/values/themes.xml new file mode 100644 index 0000000..eb6839e --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/main/res/values/themes.xml @@ -0,0 +1,16 @@ +<resources xmlns:tools="http://schemas.android.com/tools"> + <!-- Base application theme. --> + <style name="Theme.Android" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> + <!-- Primary brand color. --> + <item name="colorPrimary">@color/purple_500</item> + <item name="colorPrimaryVariant">@color/purple_700</item> + <item name="colorOnPrimary">@color/white</item> + <!-- Secondary brand color. --> + <item name="colorSecondary">@color/teal_200</item> + <item name="colorSecondaryVariant">@color/teal_700</item> + <item name="colorOnSecondary">@color/black</item> + <!-- Status bar color. --> + <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item> + <!-- Customize your theme here. --> + </style> +</resources> \ No newline at end of file diff --git a/src/main/resources/code/android/library-flutter/src/test/java/com/demo/library_flutter/ExampleUnitTest.java b/src/main/resources/code/android/library-flutter/src/test/java/com/demo/library_flutter/ExampleUnitTest.java new file mode 100644 index 0000000..8bb75d5 --- /dev/null +++ b/src/main/resources/code/android/library-flutter/src/test/java/com/demo/library_flutter/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.demo.library_flutter; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/src/main/resources/code/android/settings.gradle b/src/main/resources/code/android/settings.gradle index f862837..52df347 100644 --- a/src/main/resources/code/android/settings.gradle +++ b/src/main/resources/code/android/settings.gradle @@ -1,37 +1,48 @@ -dependencyResolutionManagement { - repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) - repositories { - maven { - url "https://maven.aliyun.com/repository/public" - } +//dependencyResolutionManagement { +// repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) +// repositories { +// maven { +// url "https://maven.aliyun.com/repository/public" +// } +// +// maven { +// url "https://maven.aliyun.com/repository/google" +// } +// mavenCentral() +// +// //绌垮北鐢� +// maven { +// url 'https://artifact.bytedance.com/repository/pangle' +// } +// +// //鐏北寮曟搸maven浠撳簱鍦板潃 +// maven { url 'https://artifact.bytedance.com/repository/Volcengine/' } +// +// //闃块噷鐧惧窛 +// maven { +// url "http://repo.baichuan-android.taobao.com/content/groups/BaichuanRepositories/" +// } +// +// jcenter() +// +// maven { url 'https://jitpack.io' } +// } +//} - maven { - url "https://maven.aliyun.com/repository/google" - } - mavenCentral() +setBinding(new Binding([gradle: this])) +evaluate(new File( + settingsDir.parentFile, + 'flutter_module/.android/include_flutter.groovy' +)) - //绌垮北鐢� - maven { - url 'https://artifact.bytedance.com/repository/pangle' - } - - //鐏北寮曟搸maven浠撳簱鍦板潃 - maven { url 'https://artifact.bytedance.com/repository/Volcengine/' } - - //闃块噷鐧惧窛 - maven { - url "http://repo.baichuan-android.taobao.com/content/groups/BaichuanRepositories/" - } - - jcenter() - - maven { url 'https://jitpack.io' } - } -} rootProject.name = "Android" include ':app' include ':library-common' include ':library-ad' include ':library-ec' include ':library-dp' -include ':library-login' \ No newline at end of file +include ':library-login' +include ':library-flutter' + +include ':flutter_module' +project(':flutter_module').projectDir = new File('../flutter_module') diff --git a/src/main/resources/code/flutter_module/.gitignore b/src/main/resources/code/flutter_module/.gitignore new file mode 100644 index 0000000..ff612b3 --- /dev/null +++ b/src/main/resources/code/flutter_module/.gitignore @@ -0,0 +1,48 @@ +.DS_Store +.dart_tool/ + +.packages +.pub/ + +.idea/ +.vagrant/ +.sconsign.dblite +.svn/ + +*.swp +profile + +DerivedData/ + +.generated/ + +*.pbxuser +*.mode1v3 +*.mode2v3 +*.perspectivev3 + +!default.pbxuser +!default.mode1v3 +!default.mode2v3 +!default.perspectivev3 + +xcuserdata + +*.moved-aside + +*.pyc +*sync/ +Icon? +.tags* + +build/ +.android/ +.ios/ +.flutter-plugins +.flutter-plugins-dependencies + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json diff --git a/src/main/resources/code/flutter_module/.metadata b/src/main/resources/code/flutter_module/.metadata new file mode 100644 index 0000000..d6a7995 --- /dev/null +++ b/src/main/resources/code/flutter_module/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: 18116933e77adc82f80866c928266a5b4f1ed645 + channel: stable + +project_type: module diff --git a/src/main/resources/code/flutter_module/README.md b/src/main/resources/code/flutter_module/README.md new file mode 100644 index 0000000..4ff4cc1 --- /dev/null +++ b/src/main/resources/code/flutter_module/README.md @@ -0,0 +1,11 @@ +# flutter_module + +A new Flutter module. + +## Getting Started + +For help getting started with Flutter, view our online +[documentation](https://flutter.dev/). + +For instructions integrating Flutter modules to your existing applications, +see the [add-to-app documentation](https://flutter.dev/docs/development/add-to-app). diff --git a/src/main/resources/code/flutter_module/analysis_options.yaml b/src/main/resources/code/flutter_module/analysis_options.yaml new file mode 100644 index 0000000..a5744c1 --- /dev/null +++ b/src/main/resources/code/flutter_module/analysis_options.yaml @@ -0,0 +1,4 @@ +include: package:flutter_lints/flutter.yaml + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/src/main/resources/code/flutter_module/lib/main.dart b/src/main/resources/code/flutter_module/lib/main.dart new file mode 100644 index 0000000..358c6ce --- /dev/null +++ b/src/main/resources/code/flutter_module/lib/main.dart @@ -0,0 +1,112 @@ +import 'package:flutter/material.dart'; + +void main() => runApp(const MyApp()); + +class MyApp extends StatelessWidget { + const MyApp({Key? key}) : super(key: key); + + // This widget is the root of your application. + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Flutter Demo', + theme: ThemeData( + // This is the theme of your application. + // + // Try running your application with "flutter run". You'll see the + // application has a blue toolbar. Then, without quitting the app, try + // changing the primarySwatch below to Colors.green and then invoke + // "hot reload" (press "r" in the console where you ran "flutter run", + // or press Run > Flutter Hot Reload in a Flutter IDE). Notice that the + // counter didn't reset back to zero; the application is not restarted. + primarySwatch: Colors.blue, + ), + home: const MyHomePage(title: 'Flutter Demo Home Page'), + ); + } +} + +class MyHomePage extends StatefulWidget { + const MyHomePage({Key? key, required this.title}) : super(key: key); + + // This widget is the home page of your application. It is stateful, meaning + // that it has a State object (defined below) that contains fields that affect + // how it looks. + + // This class is the configuration for the state. It holds the values (in this + // case the title) provided by the parent (in this case the App widget) and + // used by the build method of the State. Fields in a Widget subclass are + // always marked "final". + + final String title; + + @override + State<MyHomePage> createState() => _MyHomePageState(); +} + +class _MyHomePageState extends State<MyHomePage> { + int _counter = 0; + + void _incrementCounter() { + setState(() { + // This call to setState tells the Flutter framework that something has + // changed in this State, which causes it to rerun the build method below + // so that the display can reflect the updated values. If we changed + // _counter without calling setState(), then the build method would not be + // called again, and so nothing would appear to happen. + _counter++; + }); + } + + @override + Widget build(BuildContext context) { + // This method is rerun every time setState is called, for instance as done + // by the _incrementCounter method above. + // + // The Flutter framework has been optimized to make rerunning build methods + // fast, so that you can just rebuild anything that needs updating rather + // than having to individually change instances of widgets. + return Scaffold( + appBar: AppBar( + // Here we take the value from the MyHomePage object that was created by + // the App.build method, and use it to set our appbar title. + title: Text(widget.title), + ), + body: Center( + // Center is a layout widget. It takes a single child and positions it + // in the middle of the parent. + child: Column( + // Column is also a layout widget. It takes a list of children and + // arranges them vertically. By default, it sizes itself to fit its + // children horizontally, and tries to be as tall as its parent. + // + // Invoke "debug painting" (press "p" in the console, choose the + // "Toggle Debug Paint" action from the Flutter Inspector in Android + // Studio, or the "Toggle Debug Paint" command in Visual Studio Code) + // to see the wireframe for each widget. + // + // Column has various properties to control how it sizes itself and + // how it positions its children. Here we use mainAxisAlignment to + // center the children vertically; the main axis here is the vertical + // axis because Columns are vertical (the cross axis would be + // horizontal). + mainAxisAlignment: MainAxisAlignment.center, + children: <Widget>[ + const Text( + 'You have pushed the button this many times:', + ), + Text( + '$_counter', + style: Theme.of(context).textTheme.headline4, + ), + ], + ), + ), + floatingActionButton: FloatingActionButton( + onPressed: _incrementCounter, + tooltip: 'Increment', + child: const Icon(Icons.add), + ), // This trailing comma makes auto-formatting nicer for build methods. + ); + } +} diff --git a/src/main/resources/code/flutter_module/pubspec.lock b/src/main/resources/code/flutter_module/pubspec.lock new file mode 100644 index 0000000..446550e --- /dev/null +++ b/src/main/resources/code/flutter_module/pubspec.lock @@ -0,0 +1,791 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.8.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.0" + cached_network_image: + dependency: "direct dev" + description: + name: cached_network_image + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.2.0" + cached_network_image_platform_interface: + dependency: transitive + description: + name: cached_network_image_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.0" + cached_network_image_web: + dependency: transitive + description: + name: cached_network_image_web + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.1" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.0" + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.3.1" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.0" + collection: + dependency: transitive + description: + name: collection + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.15.0" + cross_file: + dependency: transitive + description: + name: cross_file + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.3.2" + crypto: + dependency: "direct dev" + description: + name: crypto + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.1" + csslib: + dependency: transitive + description: + name: csslib + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.17.1" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.4" + date_format: + dependency: "direct dev" + description: + name: date_format + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.5" + device_info: + dependency: "direct dev" + description: + name: device_info + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.3" + device_info_platform_interface: + dependency: transitive + description: + name: device_info_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.1" + dio: + dependency: "direct dev" + description: + name: dio + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.0.4" + event_bus: + dependency: "direct dev" + description: + name: event_bus + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.0" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.0" + ffi: + dependency: transitive + description: + name: ffi + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.2" + file: + dependency: transitive + description: + name: file + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.1.2" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_blurhash: + dependency: transitive + description: + name: flutter_blurhash + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.6.4" + flutter_boost: + dependency: "direct dev" + description: + path: "." + ref: "v3.0-null-safety-preview.18" + resolved-ref: c4e5ed7c0471fe11b202b5df70b6ee6fe28369ed + url: "https://github.com/alibaba/flutter_boost.git" + source: git + version: "3.0.0" + flutter_cache_manager: + dependency: transitive + description: + name: flutter_cache_manager + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.3.0" + flutter_datetime_picker: + dependency: "direct dev" + description: + name: flutter_datetime_picker + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.5.1" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.4" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.5" + flutter_spinkit: + dependency: "direct dev" + description: + name: flutter_spinkit + url: "https://pub.flutter-io.cn" + source: hosted + version: "5.1.0" + flutter_swiper_null_safety: + dependency: "direct dev" + description: + name: flutter_swiper_null_safety + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.2" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + flutter_widget_from_html_core: + dependency: "direct dev" + description: + name: flutter_widget_from_html_core + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.8.5+1" + fluwx_no_pay: + dependency: "direct dev" + description: + name: fluwx_no_pay + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.8.1" + fwfh_text_style: + dependency: transitive + description: + name: fwfh_text_style + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.5.1" + html: + dependency: transitive + description: + name: html + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.15.0" + http: + dependency: transitive + description: + name: http + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.13.4" + http_parser: + dependency: transitive + description: + name: http_parser + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.0.0" + image_cropper: + dependency: "direct dev" + description: + name: image_cropper + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.5.0" + image_gallery_saver: + dependency: "direct dev" + description: + name: image_gallery_saver + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.7.1" + image_picker: + dependency: "direct dev" + description: + name: image_picker + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.8.4+11" + image_picker_for_web: + dependency: transitive + description: + name: image_picker_for_web + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.6" + image_picker_platform_interface: + dependency: transitive + description: + name: image_picker_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.4.4" + js: + dependency: transitive + description: + name: js + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.6.3" + launch_review: + dependency: "direct dev" + description: + name: launch_review + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.1" + lints: + dependency: transitive + description: + name: lints + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.1" + matcher: + dependency: transitive + description: + name: matcher + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.12.10" + meta: + dependency: transitive + description: + name: meta + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.7.0" + mime: + dependency: transitive + description: + name: mime + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.1" + octo_image: + dependency: transitive + description: + name: octo_image + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.1" + oktoast: + dependency: "direct dev" + description: + name: oktoast + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.1.5" + package_info: + dependency: "direct dev" + description: + name: package_info + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.2" + path: + dependency: transitive + description: + name: path + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.8.0" + path_provider: + dependency: "direct dev" + description: + name: path_provider + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.9" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.11" + path_provider_ios: + dependency: transitive + description: + name: path_provider_ios + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.7" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.5" + path_provider_macos: + dependency: transitive + description: + name: path_provider_macos + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.5" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.3" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.5" + pedantic: + dependency: transitive + description: + name: pedantic + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.11.1" + permission_handler: + dependency: "direct dev" + description: + name: permission_handler + url: "https://pub.flutter-io.cn" + source: hosted + version: "8.3.0" + permission_handler_platform_interface: + dependency: transitive + description: + name: permission_handler_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.7.0" + platform: + dependency: transitive + description: + name: platform + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.1.0" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.2" + process: + dependency: transitive + description: + name: process + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.2.4" + pull_to_refresh: + dependency: "direct dev" + description: + name: pull_to_refresh + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.0" + qr: + dependency: transitive + description: + name: qr + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.0" + qr_flutter: + dependency: "direct dev" + description: + name: qr_flutter + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.0.0" + rxdart: + dependency: transitive + description: + name: rxdart + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.27.3" + screenshot: + dependency: "direct dev" + description: + name: screenshot + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.3" + share_plus: + dependency: "direct dev" + description: + name: share_plus + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.1.0" + share_plus_linux: + dependency: transitive + description: + name: share_plus_linux + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.4" + share_plus_macos: + dependency: transitive + description: + name: share_plus_macos + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.2" + share_plus_platform_interface: + dependency: transitive + description: + name: share_plus_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.1" + share_plus_web: + dependency: transitive + description: + name: share_plus_web + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.4" + share_plus_windows: + dependency: transitive + description: + name: share_plus_windows + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.3" + shared_preferences: + dependency: "direct dev" + description: + name: shared_preferences + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.13" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.10" + shared_preferences_ios: + dependency: transitive + description: + name: shared_preferences_ios + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.9" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.0" + shared_preferences_macos: + dependency: transitive + description: + name: shared_preferences_macos + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.3" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.0" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.3" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.8.1" + sqflite: + dependency: "direct dev" + description: + name: sqflite + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.2" + sqflite_common: + dependency: transitive + description: + name: sqflite_common + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.1+1" + stack_trace: + dependency: transitive + description: + name: stack_trace + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.10.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.0" + synchronized: + dependency: transitive + description: + name: synchronized + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.0" + test_api: + dependency: transitive + description: + name: test_api + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.4.2" + toast: + dependency: "direct dev" + description: + name: toast + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.1.5" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.3.0" + url_launcher: + dependency: "direct dev" + description: + name: url_launcher + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.0.20" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.0.14" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.0.14" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.0" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.0" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.5" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.7" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.0" + uuid: + dependency: transitive + description: + name: uuid + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.6" + vector_math: + dependency: transitive + description: + name: vector_math + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.0" + webview_flutter: + dependency: "direct dev" + description: + name: webview_flutter + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.8.0" + webview_flutter_android: + dependency: transitive + description: + name: webview_flutter_android + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.8.3" + webview_flutter_platform_interface: + dependency: transitive + description: + name: webview_flutter_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.8.1" + webview_flutter_wkwebview: + dependency: transitive + description: + name: webview_flutter_wkwebview + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.7.1" + win32: + dependency: transitive + description: + name: win32 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.3.6" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.2.0+1" +sdks: + dart: ">=2.14.0 <3.0.0" + flutter: ">=2.5.0" diff --git a/src/main/resources/code/flutter_module/pubspec.yaml b/src/main/resources/code/flutter_module/pubspec.yaml new file mode 100644 index 0000000..4d43c65 --- /dev/null +++ b/src/main/resources/code/flutter_module/pubspec.yaml @@ -0,0 +1,163 @@ +name: flutter_module +description: A new Flutter module. + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# +# This version is used _only_ for the Runner app, which is used if you just do +# a `flutter run` or a `flutter make-host-app-editable`. It has no impact +# on any other native host app that you embed your Flutter project into. +version: 1.0.0+1 + +environment: + sdk: ">=2.12.0 <3.0.0" + +dependencies: + flutter: + sdk: flutter + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.2 + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^1.0.0 + cupertino_icons: ^1.0.3 + permission_handler: ^8.2.6 + + + shared_preferences: ^2.0.8 + + oktoast: ^3.1.5 + + dio: ^4.0.4 + + #杞挱鍥炬彃浠� + flutter_swiper_null_safety: ^1.0.2 + + toast: ^0.1.5 + + webview_flutter: ^2.8.0 + + flutter_widget_from_html_core: ^0.8.3 + + #鏃堕棿鏃ユ湡閫夋嫨 + flutter_datetime_picker: ^1.5.1 + #浜岀淮鐮佺敓鎴� + qr_flutter: ^4.0.0 + + #鍒嗕韩缁勪欢 + share_plus: ^3.0.4 + path_provider: ^2.0.6 + + #寰俊鐧诲綍 + fluwx_no_pay: ^3.6.1+5 + + event_bus: ^2.0.0 + + #鏋佸厜鎺ㄩ�� + # jpush_flutter: ^2.1.8 + + #鑾峰彇璁惧淇℃伅 + device_info: ^2.0.3 + + #鍔犲瘑 + crypto: ^3.0.1 + + flutter_spinkit: ^5.1.0 + + #涓嬫媺鍒锋柊 + pull_to_refresh: ^2.0.0 + + url_launcher: ^6.0.17 + + package_info: ^2.0.2 + + launch_review: ^3.0.1 + + date_format: ^2.0.4 + + #鎴浘鎻掍欢 + screenshot: ^1.2.3 + + #缃戠粶鍥剧墖鍔犺浇妗嗘灦 + cached_network_image: ^3.2.0 + + #鍥剧墖閫夋嫨 + image_picker: ^0.8.4+9 + #鍥剧墖瑁佸壀 + image_cropper: ^1.5.0 + + sqflite: ^2.0.2 + + #淇濆瓨鍥剧墖鍒扮浉鍐� + image_gallery_saver: ^1.7.1 + + flutter_boost: + git: + url: 'https://github.com/alibaba/flutter_boost.git' + ref: 'v3.0-null-safety-preview.18' + + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +flutter: + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add Flutter specific assets to your application, add an assets section, + # like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware. + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + + # To add Flutter specific custom fonts to your application, add a fonts + # section here, in this "flutter" section. Each entry in this list should + # have a "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages + + + # This section identifies your Flutter project as a module meant for + # embedding in a native host app. These identifiers should _not_ ordinarily + # be changed after generation - they are used to ensure that the tooling can + # maintain consistency when adding or modifying assets and plugins. + # They also do not have any bearing on your native host application's + # identifiers, which may be completely independent or the same as these. + module: + androidX: true + androidPackage: com.demo.flutter_module + iosBundleIdentifier: com.demo.flutterModule diff --git a/src/main/resources/code/flutter_module/settings.gradle b/src/main/resources/code/flutter_module/settings.gradle new file mode 100644 index 0000000..c77f617 --- /dev/null +++ b/src/main/resources/code/flutter_module/settings.gradle @@ -0,0 +1,3 @@ + +// Generated file. Do not edit. +include ':.android' diff --git a/src/main/resources/code/flutter_module/test/widget_test.dart b/src/main/resources/code/flutter_module/test/widget_test.dart new file mode 100644 index 0000000..0c7ffca --- /dev/null +++ b/src/main/resources/code/flutter_module/test/widget_test.dart @@ -0,0 +1,30 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility that Flutter provides. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:flutter_module/main.dart'; + +void main() { + testWidgets('Counter increments smoke test', (WidgetTester tester) async { + // Build our app and trigger a frame. + await tester.pumpWidget(const MyApp()); + + // Verify that our counter starts at 0. + expect(find.text('0'), findsOneWidget); + expect(find.text('1'), findsNothing); + + // Tap the '+' icon and trigger a frame. + await tester.tap(find.byIcon(Icons.add)); + await tester.pump(); + + // Verify that our counter has incremented. + expect(find.text('0'), findsNothing); + expect(find.text('1'), findsOneWidget); + }); +} -- Gitblit v1.8.0