Skip to content

Commit

Permalink
fix(storage): 网页上并不支持控制闪光灯和恢复摄像头
Browse files Browse the repository at this point in the history
  • Loading branch information
he0119 committed Feb 6, 2024
1 parent d0b7858 commit 73f62b9
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions lib/storage/view/widgets/scan_qr_icon_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,21 @@ class _ScanQRPageState extends State<ScanQRPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('二维码')),
body: Column(
children: <Widget>[
Expanded(
flex: 4,
child: GestureDetector(
child: _buildQrView(context),
onTap: () async {
await controller?.resumeCamera();
setState(() {
jumped = false;
});
if (!kIsWeb) {
await controller?.resumeCamera();
}
},
child: _buildQrView(context),
),
),
Expanded(
Expand All @@ -75,21 +78,23 @@ class _ScanQRPageState extends State<ScanQRPage> {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(jumped ? '请单击屏幕再次扫描' : '请扫描二维码'),
Container(
margin: const EdgeInsets.all(8),
child: ElevatedButton(
onPressed: () async {
await controller?.toggleFlash();
setState(() {});
},
child: FutureBuilder(
future: controller?.getFlashStatus(),
builder: (context, snapshot) {
return Text(snapshot.data ?? false ? '关闭闪光灯' : '打开闪光灯');
if (!kIsWeb)
Container(
margin: const EdgeInsets.all(8),
child: ElevatedButton(
onPressed: () async {
await controller?.toggleFlash();
setState(() {});
},
child: FutureBuilder(
future: controller?.getFlashStatus(),
builder: (context, snapshot) {
return Text(
snapshot.data ?? false ? '关闭闪光灯' : '打开闪光灯');
},
),
),
),
),
],
),
)
Expand Down

0 comments on commit 73f62b9

Please sign in to comment.