-
Notifications
You must be signed in to change notification settings - Fork 0
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 eca8a92
Showing
48 changed files
with
2,011 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,9 @@ | ||
.DS_Store | ||
.dart_tool/ | ||
|
||
.packages | ||
.pub/ | ||
|
||
build/ | ||
|
||
.idea/ |
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,19 @@ | ||
## 2.0.4 | ||
|
||
* Improved pub scores. | ||
|
||
## 2.0.3 | ||
|
||
* Updated README.md. | ||
|
||
## 2.0.2 | ||
|
||
* Updated README.md. | ||
|
||
## 2.0.1 | ||
|
||
* Improved pub scores. | ||
|
||
## 2.0.0 | ||
|
||
* 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,13 @@ | ||
Copyright (c) 2020, Nankai | ||
All rights reserved. | ||
|
||
Copyright (c) 2024, Elriz Technology | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
Redistributions of source code must retain the above copyright notice, this list of conditions, and the following disclaimer. | ||
|
||
Redistributions in binary form must reproduce the above copyright notice, this list of conditions, and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
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,107 @@ | ||
# Flutter Presentation Display | ||
|
||
`Flutter Presentation Display` is a Flutter plugin designed to run on multiple displays, including handling secondary (presentation) display. It provides methods to interact with connected displays, transfer data, and respond to display connection changes. Tested on SUNMI T2s. | ||
|
||
## Features | ||
|
||
- Retrieve a list of connected displays | ||
- Show and hide secondary (presentation) display | ||
- Transfer data from the main display to the secondary display or vice versa | ||
- Listen to display connection changes | ||
|
||
## Installation | ||
|
||
Add `flutter_presentation_display` to your `pubspec.yaml` file: | ||
|
||
```yaml | ||
dependencies: | ||
flutter: | ||
sdk: flutter | ||
flutter_presentation_display: any # Replace with the latest version | ||
``` | ||
## Usage | ||
### Import the Package | ||
``` | ||
import 'package:flutter_presentation_display/flutter_presentation_display.dart'; | ||
``` | ||
|
||
### Initialize FlutterPresentationDisplay | ||
Create an instance of FlutterPresentationDisplay: | ||
``` | ||
final display = FlutterPresentationDisplay(); | ||
``` | ||
|
||
### Retrieve Displays | ||
Get a list of connected displays: | ||
``` | ||
List<Display>? displays = await display.getDisplays(); | ||
``` | ||
Get Display Name by ID | ||
Retrieve the name of a display using its ID: | ||
``` | ||
String? displayName = await display.getNameByDisplayId(1); | ||
``` | ||
Get Display Name by Index | ||
Retrieve the name of a display using its index in the list: | ||
``` | ||
String? displayName = await display.getNameByIndex(0); | ||
``` | ||
|
||
### Show and Hide Secondary Display | ||
Show a secondary display with a specific ID and router name: | ||
``` | ||
bool? result = await display.showSecondaryDisplay( | ||
displayId: 1, | ||
routerName: "presentation", | ||
); | ||
``` | ||
Hide a secondary display using its ID: | ||
``` | ||
bool? result = await display.hideSecondaryDisplay(displayId: 1); | ||
``` | ||
|
||
### Transfer Data to and from Displays | ||
Transfer data to the secondary (presentation) display: | ||
``` | ||
bool? result = await display.transferDataToPresentation({"key": "value"}); | ||
``` | ||
Transfer data to the main display: | ||
``` | ||
bool? result = await display.transferDataToMain({"key": "value"}); | ||
``` | ||
|
||
### Listen to Display Connection Changes | ||
Listen to changes in connected displays: | ||
``` | ||
display.connectedDisplaysChangedStream.listen((int? displayId) { | ||
print('Connected display ID: $displayId'); | ||
}); | ||
``` | ||
|
||
### Listen for Data from Displays | ||
Listen for data sent from the secondary (presentation) display: | ||
``` | ||
display.listenDataFromPresentationDisplay((dynamic data) { | ||
print('Data from Presentation Display: $data'); | ||
}); | ||
``` | ||
Listen for data sent from the main display: | ||
``` | ||
display.listenDataFromMainDisplay((dynamic data) { | ||
print('Data from Main Display: $data'); | ||
}); | ||
``` | ||
|
||
|
||
## Example | ||
Check out the [example](example) directory for a complete sample app demonstrating the use of the `flutter_presentation_display` package. | ||
|
||
## License | ||
This package is based on [presentation_displays](https://github.com/VNAPNIC/presentation-displays) which is licensed under the BSD 2-Clause License.<br/> | ||
[flutter_presentation_display](https://github.com/elrizwiraswara/flutter_presentation_display) is a modified version of the original version. | ||
|
||
|
||
## Support | ||
|
||
<a href="https://trakteer.id/elrizwiraswara/tip" target="_blank"><img id="wse-buttons-preview" src="https://cdn.trakteer.id/images/embed/trbtn-red-6.png?date=18-11-2023" height="40" style="border:0px;height:40px;margin-top:14px" alt="Trakteer Saya"></a> |
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,29 @@ | ||
# This file configures the analyzer, which statically analyzes Dart code to | ||
# check for errors, warnings, and lints. | ||
# | ||
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled | ||
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be | ||
# invoked from the command line by running `flutter analyze`. | ||
|
||
# The following line activates a set of recommended lints for Flutter apps, | ||
# packages, and plugins designed to encourage good coding practices. | ||
# include: package:flutter_lints/flutter.yaml | ||
|
||
linter: | ||
# The lint rules applied to this project can be customized in the | ||
# section below to disable rules from the `package:flutter_lints/flutter.yaml` | ||
# included above or to enable additional rules. A list of all available lints | ||
# and their documentation is published at | ||
# https://dart-lang.github.io/linter/lints/index.html. | ||
# | ||
# Instead of disabling a lint rule for the entire project in the | ||
# section below, it can also be suppressed for a single line of code | ||
# or a specific dart file by using the `// ignore: name_of_lint` and | ||
# `// ignore_for_file: name_of_lint` syntax on the line or in the file | ||
# producing the lint. | ||
rules: | ||
# avoid_print: false # Uncomment to disable the `avoid_print` rule | ||
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule | ||
|
||
# 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,13 @@ | ||
gradle-wrapper.jar | ||
/.gradle | ||
/captures/ | ||
/gradlew | ||
/gradlew.bat | ||
/local.properties | ||
GeneratedPluginRegistrant.java | ||
|
||
# Remember to never publicly share your keystore. | ||
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app | ||
key.properties | ||
**/*.keystore | ||
**/*.jks |
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,48 @@ | ||
group 'com.elriztechnology.flutter_presentation_display' | ||
version '1.0-SNAPSHOT' | ||
|
||
buildscript { | ||
ext.kotlin_version = '1.7.20' | ||
repositories { | ||
google() | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
classpath 'com.android.tools.build:gradle:7.4.2' | ||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | ||
} | ||
} | ||
|
||
rootProject.allprojects { | ||
repositories { | ||
google() | ||
mavenCentral() | ||
} | ||
} | ||
|
||
apply plugin: 'com.android.library' | ||
apply plugin: 'kotlin-android' | ||
|
||
android { | ||
compileSdkVersion 34 | ||
|
||
sourceSets { | ||
main.java.srcDirs += 'src/main/kotlin' | ||
} | ||
|
||
defaultConfig { | ||
minSdkVersion 21 | ||
} | ||
|
||
lintOptions { | ||
disable 'InvalidPackage' | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" | ||
implementation 'com.google.code.gson:gson:2.10.1' | ||
implementation 'com.android.support:support-annotations:28.0.0' | ||
// implementation files('D:\\Softwares\\Developments\\flutter\\bin\\cache\\artifacts\\engine\\android-x64\\flutter.jar') | ||
} |
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 @@ | ||
org.gradle.jvmargs=-Xmx1536M | ||
android.useAndroidX=true | ||
android.enableJetifier=true |
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 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip |
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 = 'flutter_presentation_display' |
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 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.elriztechnology.flutter_presentation_display"> | ||
</manifest> |
16 changes: 16 additions & 0 deletions
16
android/src/main/kotlin/com/elriztechnology/flutter_presentation_display/DisplayModel.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,16 @@ | ||
package com.elriztechnology.flutter_presentation_display | ||
|
||
import androidx.annotation.Keep | ||
import com.google.gson.annotations.SerializedName | ||
|
||
@Keep | ||
data class DisplayModel( | ||
@SerializedName("displayId") | ||
val displayId: Int, | ||
@SerializedName("flags") | ||
val flags: Int, | ||
@SerializedName("rotation") | ||
val rotation: Int, | ||
@SerializedName("name") | ||
val name: String | ||
) |
Oops, something went wrong.