|
@@ -1,7 +1,11 @@
|
|
|
import 'package:flutter/material.dart';
|
|
|
+import 'package:flutter_blue/flutter_blue.dart';
|
|
|
import 'package:flutter_tracker/utils/app_util.dart';
|
|
|
import 'package:flutter_tracker/views/contact_card.dart';
|
|
|
-/// Description:
|
|
|
+
|
|
|
+import 'bluetooth_off_page.dart';
|
|
|
+
|
|
|
+/// Description:
|
|
|
/// Time : 2021年12月03日 Friday
|
|
|
/// Author : liuyuqi.gov@msncn
|
|
|
class TrackPage extends StatefulWidget {
|
|
@@ -19,11 +23,24 @@ class _TrackPageState extends State<TrackPage> {
|
|
|
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
+ return StreamBuilder<BluetoothState>(
|
|
|
+ stream: FlutterBlue.instance.state,
|
|
|
+ initialData: BluetoothState.unknown,
|
|
|
+ builder: (c, snapshot) {
|
|
|
+ final state = snapshot.data;
|
|
|
+ if (state == BluetoothState.on) {
|
|
|
+ return buildContent();
|
|
|
+ }
|
|
|
+ return BluetoothOffPage(state: state);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ Column buildContent() {
|
|
|
return Column(
|
|
|
children: <Widget>[
|
|
|
Expanded(
|
|
|
child: Padding(
|
|
|
- padding: EdgeInsets.only(
|
|
|
+ padding: const EdgeInsets.only(
|
|
|
left: 25.0,
|
|
|
right: 25.0,
|
|
|
bottom: 10.0,
|