-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ee9f38f
Showing
384 changed files
with
62,173 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Miscellaneous | ||
*.class | ||
*.log | ||
*.pyc | ||
*.swp | ||
.DS_Store | ||
.atom/ | ||
.buildlog/ | ||
.history | ||
.svn/ | ||
migrate_working_dir/ | ||
example/ | ||
|
||
# IntelliJ related | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
# The .vscode folder contains launch configuration and tasks you configure in | ||
# VS Code which you may wish to be included in version control, so this line | ||
# is commented out by default. | ||
#.vscode/ | ||
|
||
# Flutter/Dart/Pub related | ||
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. | ||
/pubspec.lock | ||
**/doc/api/ | ||
.dart_tool/ | ||
.packages | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# 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. | ||
|
||
version: | ||
revision: eb6d86ee27deecba4a83536aa20f366a6044895c | ||
channel: stable | ||
|
||
project_type: plugin | ||
|
||
# Tracks metadata for the flutter migrate command | ||
migration: | ||
platforms: | ||
- platform: root | ||
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c | ||
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c | ||
- platform: android | ||
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c | ||
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c | ||
- platform: ios | ||
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c | ||
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c | ||
|
||
# User provided section | ||
|
||
# List of Local paths (relative to this file) that should be | ||
# ignored by the migrate tool. | ||
# | ||
# Files that are not part of the templates will be ignored by default. | ||
unmanaged_files: | ||
- 'lib/main.dart' | ||
- 'ios/Runner.xcodeproj/project.pbxproj' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## 0.0.1 | ||
|
||
* TODO: Describe initial release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TODO: Add your license here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# dxwidget | ||
|
||
A new Flutter UI | ||
|
||
## Getting Started | ||
|
||
This project is a starting point for a Flutter | ||
[plug-in package](https://flutter.dev/developing-packages/), | ||
a specialized package that includes platform-specific implementation code for | ||
Android and/or iOS. | ||
|
||
For help getting started with Flutter development, view the | ||
[online documentation](https://flutter.dev/docs), which offers tutorials, | ||
samples, guidance on mobile development, and a full API reference. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/workspace.xml | ||
/.idea/libraries | ||
.DS_Store | ||
/build | ||
/captures | ||
.cxx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
group 'com.dxwidget.dxwidget' | ||
version '1.0-SNAPSHOT' | ||
|
||
buildscript { | ||
ext.kotlin_version = '1.6.10' | ||
repositories { | ||
google() | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
classpath 'com.android.tools.build:gradle:7.1.2' | ||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | ||
} | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
google() | ||
mavenCentral() | ||
} | ||
} | ||
|
||
apply plugin: 'com.android.library' | ||
apply plugin: 'kotlin-android' | ||
|
||
android { | ||
compileSdkVersion 31 | ||
|
||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
|
||
kotlinOptions { | ||
jvmTarget = '1.8' | ||
} | ||
|
||
sourceSets { | ||
main.java.srcDirs += 'src/main/kotlin' | ||
} | ||
|
||
defaultConfig { | ||
minSdkVersion 16 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rootProject.name = 'dxwidget' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.dxwidget.android"> | ||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
</manifest> |
46 changes: 46 additions & 0 deletions
46
android/src/main/kotlin/com/dxwidget/android/DxwidgetPlugin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.dxwidget.android | ||
|
||
import android.content.Context | ||
import android.content.pm.PackageManager | ||
import com.dxwidget.android.plugins.NetworkConnectivity | ||
import com.dxwidget.android.plugins.PackageInfo | ||
import io.flutter.embedding.engine.plugins.FlutterPlugin | ||
import io.flutter.embedding.engine.plugins.FlutterPlugin.FlutterPluginBinding | ||
import io.flutter.plugin.common.MethodCall | ||
import io.flutter.plugin.common.MethodChannel | ||
import io.flutter.plugin.common.MethodChannel.MethodCallHandler | ||
|
||
/** DxwidgetPlugin */ | ||
class DxwidgetPlugin : MethodCallHandler, FlutterPlugin { | ||
private var applicationContext: Context? = null | ||
private var methodChannel: MethodChannel? = null | ||
|
||
companion object { | ||
private const val CHANNEL_NAME = "com.dxwidget/channel" | ||
} | ||
|
||
/** Plugin registration. */ | ||
override fun onAttachedToEngine(binding: FlutterPluginBinding) { | ||
applicationContext = binding.applicationContext | ||
methodChannel = MethodChannel(binding.binaryMessenger, CHANNEL_NAME) | ||
methodChannel!!.setMethodCallHandler(this) | ||
} | ||
|
||
override fun onDetachedFromEngine(binding: FlutterPluginBinding) { | ||
applicationContext = null | ||
methodChannel!!.setMethodCallHandler(null) | ||
methodChannel = null | ||
} | ||
|
||
override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) { | ||
try { | ||
when (call.method) { | ||
"getAppVersion" -> result.success(PackageInfo().getAppVersion(applicationContext!!)) | ||
"isNetworkAvailable" -> result.success(NetworkConnectivity().isNetworkAvailable(applicationContext)) | ||
else -> result.notImplemented() | ||
} | ||
} catch (ex: PackageManager.NameNotFoundException) { | ||
result.error("Name not found", ex.message, null) | ||
} | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
android/src/main/kotlin/com/dxwidget/android/plugins/NetworkConnectivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package com.dxwidget.android.plugins | ||
|
||
import android.content.BroadcastReceiver | ||
import android.content.Context | ||
import android.content.Intent | ||
import android.net.ConnectivityManager | ||
import android.net.NetworkCapabilities | ||
import android.os.Build | ||
|
||
/// github地址:https://github.com/praveen-gm/flutter_network_connectivity/blob/main/lib/flutter_network_connectivity.dart | ||
class NetworkConnectivity : BroadcastReceiver() { | ||
|
||
private var connectivityListener: ConnectivityListener? = null | ||
|
||
override fun onReceive(context: Context?, intent: Intent?) { | ||
connectivityListener?.onNetworkConnectionChanged( | ||
isNetworkAvailable(context!!) | ||
) | ||
} | ||
|
||
fun setConnectivityListener(connectivityListener: ConnectivityListener) { | ||
this.connectivityListener = connectivityListener | ||
} | ||
|
||
interface ConnectivityListener { | ||
fun onNetworkConnectionChanged(isConnected: Boolean) | ||
} | ||
|
||
@Suppress("Deprecation") | ||
fun isNetworkAvailable(context: Context?): Boolean { | ||
/// Requires context to access SystemService | ||
if (context == null) return false | ||
|
||
val connectivityManager = | ||
context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager | ||
|
||
/// Android SDK Version Q and above makes use of Network Capabilities | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { | ||
val capabilities = | ||
connectivityManager.getNetworkCapabilities(connectivityManager.activeNetwork) | ||
if (capabilities != null) { | ||
when { | ||
capabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR) -> { | ||
return true | ||
} | ||
capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI) -> { | ||
return true | ||
} | ||
capabilities.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET) -> { | ||
return true | ||
} | ||
} | ||
} | ||
} else { | ||
val activeNetworkInfo = connectivityManager.activeNetworkInfo | ||
if (activeNetworkInfo != null && activeNetworkInfo.isConnected) { | ||
return true | ||
} | ||
} | ||
return false | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
android/src/main/kotlin/com/dxwidget/android/plugins/PackageInfo.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.dxwidget.android.plugins | ||
|
||
import android.content.Context | ||
import androidx.core.content.pm.PackageInfoCompat | ||
|
||
/** | ||
* 获取版本信息 | ||
*/ | ||
class PackageInfo { | ||
|
||
fun getAppVersion(applicationContext: Context): HashMap<String, String> { | ||
val packageManager = applicationContext.packageManager | ||
val info = packageManager.getPackageInfo(applicationContext.packageName, 0) | ||
val infoMap = HashMap<String, String>() | ||
infoMap | ||
infoMap.apply { | ||
put("appName", info.applicationInfo.loadLabel(packageManager).toString()) | ||
put("packageName", applicationContext.packageName) | ||
put("version", info.versionName) | ||
put("buildNumber", PackageInfoCompat.getLongVersionCode(info).toString()) | ||
} | ||
return infoMap | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
.idea/ | ||
.vagrant/ | ||
.sconsign.dblite | ||
.svn/ | ||
|
||
.DS_Store | ||
*.swp | ||
profile | ||
|
||
DerivedData/ | ||
build/ | ||
GeneratedPluginRegistrant.h | ||
GeneratedPluginRegistrant.m | ||
|
||
.generated/ | ||
|
||
*.pbxuser | ||
*.mode1v3 | ||
*.mode2v3 | ||
*.perspectivev3 | ||
|
||
!default.pbxuser | ||
!default.mode1v3 | ||
!default.mode2v3 | ||
!default.perspectivev3 | ||
|
||
xcuserdata | ||
|
||
*.moved-aside | ||
|
||
*.pyc | ||
*sync/ | ||
Icon? | ||
.tags* | ||
|
||
/Flutter/Generated.xcconfig | ||
/Flutter/ephemeral/ | ||
/Flutter/flutter_export_environment.sh |
Empty file.
Oops, something went wrong.