imin_vice_screen

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

imin vice screen

imin_vice_screen #
A Flutter plugin for using imin vice screen sdk in Android
Resources: #

Pub Package
GitHub Repository

Platform Support



Android








Getting Started #
Installation #
flutter pub add imin_vice_screen
copied to clipboard
or
Make a reference in the “pubspec.yaml” file
dependencies:
imin_vice_screen: ^0.0.1
copied to clipboard
Just see the example folder! #
How to use: #
Use flutter to draw the main and secondary screens, and use the encapsulation capability to communicate the main and secondary screens:
1. Distinguish the main screen from the secondary screen at the main entrance: #
void main() {
var defaultRouteName = window.defaultRouteName;
if ("viceMain" == defaultRouteName) {
viceScreenMain();
} else {
defaultMain();
}
}

//主屏ui
void defaultMain() {
runApp(MainApp());
}

//副屏ui
void viceScreenMain() {
runApp(SubApp());
}
copied to clipboard
2. Use the encapsulation capability to communicate the main and secondary screens: #
1.1 mainScreen to subScreen
import 'package:imin_vice_screen/imin_vice_screen.dart';
final _iminViceScreenPlugin = IminViceScreen();
/// 1. send Message
_iminViceScreenPlugin.sendMsgToViceScreen("data", params: {"params": "123"});
/// 2. receive subScreen Message
_iminViceScreenPlugin.mainStream.listen((event) {
print("mainScreen receive data:${event}");
})

copied to clipboard
1.2 subScreen to mainScreen #
import 'package:imin_vice_screen/imin_vice_screen.dart';
final _iminViceScreenPlugin = IminViceScreen();
/// 1. send Message
_iminViceScreenPlugin.sendMsgToMainScreen("data", params: {"params": "456"});
/// 2. receive mainScreen Message
_iminViceScreenPlugin.viceStream.listen((event) {
print("mainScreen receive data:${event}");
})

copied to clipboard
1.3 (other Methods) Obtain whether the current device environment supports dual screens #
bool isSupportMultipleScreen = await _iminViceScreenPlugin.isMultipleScreen();
print("isSupportMultipleScreen:$isSupportMultipleScreen");
copied to clipboard
1.4 (other Methods) Determine whether the current application has overlay window permissions #
bool checkOverlayPermission = await _iminViceScreenPlugin.checkOverlayPermission();
print("checkOverlayPermission:$checkOverlayPermission");
copied to clipboard
1.5 (other Methods) Apply for an overlay window permission to set the secondary screen as a persistent window #
await _iminViceScreenPlugin.requestOverlayPermission();
copied to clipboard
1.6 (other Methods) Open and close the secondary screen #
await _iminViceScreenPlugin.doubleScreenOpen(); /// open
await _iminViceScreenPlugin.doubleScreenClose(); /// close
copied to clipboard
3. After the initialization is complete, the secondary screen is displayed #
android -> values -> attrs.xml Add configuration
<!-- 是否在初始化时自动显示副屏 -->
<bool name="autoShowSubScreenWhenInit">true</bool>
copied to clipboard
4. LCD Vice screen display #
1. LCD INIT #
-- sendLCDCommand
import 'package:imin_vice_screen/enums.dart';
import 'package:imin_vice_screen/imin_vice_screen.dart';
final iminViceScreenPlugin = IminViceScreen();
await iminViceScreenPlugin.sendLCDCommand(LCDCommand.initLCD); // init LCD
await iminViceScreenPlugin.sendLCDCommand(LCDCommand.wakeLCD); // wake LCD
await iminViceScreenPlugin.sendLCDCommand(LCDCommand.sleepLCD); // sleep LCD
await iminViceScreenPlugin.sendLCDCommand(LCDCommand.cleanScreenLCD); // clean Screen
copied to clipboard
2. Send a string for display on the secondary screen #
-- sendLCDString
import 'package:imin_vice_screen/imin_vice_screen.dart';
final iminViceScreenPlugin = IminViceScreen();
await iminViceScreenPlugin.sendLCDString('hello world');
copied to clipboard
3. Send a string for display on the secondary screen #
-- sendLCDString
-- parameter:
--- String content
import 'package:imin_vice_screen/imin_vice_screen.dart';
final iminViceScreenPlugin = IminViceScreen();
await iminViceScreenPlugin.sendLCDString('hello world');
copied to clipboard
4. Sends a multi-line subscreen content string #
-- sendLCDMultiString
-- parameter:
-- String[] contents
-- int[] aligns
import 'package:imin_vice_screen/imin_vice_screen.dart';
final iminViceScreenPlugin = IminViceScreen();
await iminViceScreenPlugin.sendLCDMultiString(contents: ["سعيد بلقائك", "Des", "Hi"], aligns: [0, 1, 2]);
copied to clipboard
4. Sends a two-line subscreen content string #
-- sendLCDDoubleString
-- parameter:
-- String topText
-- String bottomText
import 'package:imin_vice_screen/imin_vice_screen.dart';
final iminViceScreenPlugin = IminViceScreen();
await iminViceScreenPlugin.sendLCDDoubleString(
topText: 'Top Cotent', bottomText: 'Bottom Cotent');
copied to clipboard
4. Send pictures to display on the secondary screen #
-- sendLCDBitmap
-- parameter:
-- dynamic byte -> img URL Or Byte
import 'package:imin_vice_screen/imin_vice_screen.dart';
final iminViceScreenPlugin = IminViceScreen();
// use Byte
Uint8List byte = await readFileBytes('assets/images/logo.png');
await iminViceScreenPlugin.sendLCDBitmap(byte);

// or use URL
await iminViceScreenPlugin.sendLCDBitmap(
'https://oss-sg.imin.sg/web/iMinPartner2/images/logo.png',
pictureStyle: IminPictureStyle(
width: 240,
height: 320,
));
copied to clipboard
4. Set font size #
-- setTextSize
-- parameter:
-- int size -> font size
import 'package:imin_vice_screen/imin_vice_screen.dart';
final iminViceScreenPlugin = IminViceScreen();
await iminViceScreenPlugin.setTextSize(15);
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files:

Customer Reviews

There are no reviews.