Last updated:
0 purchases
m phone scan
m_phone_scan #
扫描监听插件
Getting Started #
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: ListView(
children: [
ElevatedButton(onPressed: (){
MPhoneScanPlatform.instance.openScanner();
}, child: const Text('开启扫描')),
ElevatedButton(onPressed: (){
MPhoneScanPlatform.instance.closeScanner();
}, child: const Text('关闭扫描')),
ElevatedButton(onPressed: (){
MPhoneScanPlatform.instance.startDecode();
}, child: const Text('启动扫描(扫描头出光)')),
ElevatedButton(onPressed: (){
MPhoneScanPlatform.instance.startDecode();
}, child: const Text('取消扫描')),
ElevatedButton(onPressed: (){
MPhoneScanPlatform.instance.isScannerOpen();
}, child: const Text('扫描是否开启')),
ElevatedButton(onPressed: (){
MPhoneScanPlatform.instance.setPlaySound(true);
}, child: const Text('设置声音')),
ElevatedButton(onPressed: (){
MethodChannelMPhoneScan().listenScanData((Map<String,dynamic> data){
debugPrint("扫描到数据:$data");
});
}, child: const Text('扫描数据监听')),
ElevatedButton(onPressed: (){
MethodChannelMPhoneScan().listenScanData((Map<String,dynamic> data){
debugPrint("扫描到数据:$data");
});
}, child: const Text('关闭扫描数据监听')),
],
),
),
);
}
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.