feat: 获取sn
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_webrtc/flutter_webrtc.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
import 'config/ice_servers.dart';
|
||||
import 'controller/remote_controller.dart';
|
||||
import 'utils/control_commands.dart';
|
||||
import 'utils/device_utils.dart';
|
||||
import 'widgets/remote_touch_view.dart';
|
||||
|
||||
void main() {
|
||||
@@ -54,7 +54,15 @@ class _ControllerHomeState extends State<ControllerHome> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_deviceIdController.text = 'controller_${const Uuid().v4().substring(0, 8)}';
|
||||
_initDeviceId();
|
||||
}
|
||||
|
||||
/// 异步获取设备标识并填入设备ID输入框(非系统签名,使用兜底方案)。
|
||||
Future<void> _initDeviceId() async {
|
||||
final id = await DeviceUtils.getSerialNumber();
|
||||
if (mounted) {
|
||||
setState(() => _deviceIdController.text = id);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user