Browse Source

完善track和submit页面

liuyuqi-dellpc 2 years ago
parent
commit
7576e4755e

+ 1 - 0
README.md

@@ -3,3 +3,4 @@
 追踪者app,基于蓝牙提供疫情追踪功能。
 
 
+flutter_blue 依赖安卓19,编译28,其他版本都会出错

+ 10 - 0
android/app/src/main/AndroidManifest.xml

@@ -10,6 +10,16 @@
     <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
     <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
     <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
+    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
+
+    <uses-feature android:name="android.hardware.location.gps" />
+    <uses-feature android:name="android.hardware.location.network" />
+    <uses-feature
+        android:name="android.hardware.bluetooth_le"
+        android:required="true" />
+
+    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
+    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
 
     <application
         android:icon="@drawable/ic_launcher"

+ 3 - 1
lib/dio/api.dart

@@ -1,5 +1,6 @@
 import 'package:flutter_tracker/model/user_model.dart';
-/// Description: 
+
+/// Description:
 /// Time       : 2021年12月03日 Friday
 /// Author     : liuyuqi.gov@msncn
 abstract class Api {
@@ -8,6 +9,7 @@ abstract class Api {
   static String logoutUrl = _host + "/logout";
   static String registerUrl = _host + "/register";
   static String getUserInfoUrl = _host + "/getUserInfo";
+  static String getUserByDeviceId = _host + "'getUserByDeviceId";
   static String uploadImgUrl = _host + "/uploadImg";
   static String uploadTrackUrl = _host + "/uploadTrack";
 

+ 10 - 2
lib/dio/login_dao.dart

@@ -3,7 +3,8 @@ import 'package:flutter_tracker/dio/api.dart';
 import 'package:flutter_tracker/model/login_entity.dart';
 import 'package:flutter_tracker/model/message_model.dart';
 import 'package:flutter_tracker/model/user_model.dart';
-/// Description: 
+
+/// Description:
 /// Time       : 2021年12月03日 Friday
 /// Author     : liuyuqi.gov@msncn
 class LoginDao {
@@ -45,4 +46,11 @@ class LoginDao {
     Response response = await Dio().post(Api.getUserInfoUrl, data: params);
     return UserModel.fromJson(response.data);
   }
-}
+
+  //通过设备id查找用户
+  static Future<UserModel> getUserByDeviceId(String deviceid) async {
+    params.addAll({"deviceid": deviceid});
+    Response response = await Dio().post(Api.getUserByDeviceId, data: params);
+    return UserModel.fromJson(response.data);
+  }
+}

+ 12 - 7
lib/dio/track_dao.dart

@@ -1,24 +1,27 @@
 import 'package:dio/dio.dart';
 import 'package:flutter_tracker/dio/api.dart';
 import 'package:flutter_tracker/model/submit_model.dart';
-/// Description: 
+
+/// Description:
 /// Time       : 2021年12月03日 Friday
 /// Author     : liuyuqi.gov@msncn
 class TrackDao {
-  Map<String, dynamic> params = <String, dynamic>{};
+  static Map<String, dynamic> params = <String, dynamic>{};
 
-  Future<SubmitModel> uploadImg(
+  static Future<SubmitModel> uploadImg(
       String token, String filePath, String fileName) async {
     params.addAll({"token": token, "filePath": filePath, "fileName": fileName});
 
-    await Dio().post(Api.uploadImgUrl, queryParameters: params).then((response) {
+    await Dio()
+        .post(Api.uploadImgUrl, queryParameters: params)
+        .then((response) {
       return SubmitModel.fromJson(response.data);
     });
     return null;
   }
 
-  Future<SubmitModel> uploadTrack(
-      String token, String telphone, String address, String health) async {
+  static Future<SubmitModel> uploadTrack(String token, String telphone,
+      String address, bool health, String filePath) async {
     params.addAll({
       "token": token,
       "telphone": telphone,
@@ -26,7 +29,9 @@ class TrackDao {
       "health": health
     });
 
-    await Dio().post(Api.uploadTrackUrl, queryParameters: params).then((response) {
+    await Dio()
+        .post(Api.uploadTrackUrl, queryParameters: params)
+        .then((response) {
       return SubmitModel.fromJson(response.data);
     });
     return null;

+ 2 - 1
lib/main.dart

@@ -1,5 +1,6 @@
 import 'package:flutter/material.dart';
 import 'package:flutter_screenutil/flutter_screenutil.dart';
+import 'package:flutter_tracker/pages/submit_page.dart';
 import 'package:flutter_tracker/pages/welcome_page.dart';
 import 'package:flutter_tracker/routes/routes.dart';
 import 'package:shared_preferences/shared_preferences.dart';
@@ -37,7 +38,7 @@ class MyApp extends StatelessWidget {
           primarySwatch: Colors.blue,
         ),
         debugShowCheckedModeBanner: false,
-        home: isLogin ? IndexPage() : WelComePage(),
+        home: isLogin ? IndexPage() : SubmitPage(),
         onGenerateRoute: Routes.generateRoute,
       ),
     );

+ 6 - 1
lib/model/user_model.dart

@@ -1,11 +1,14 @@
 import 'package:flutter_tracker/model/message_model.dart';
-/// Description: 
+
+/// Description:
 /// Time       : 2021年12月03日 Friday
 /// Author     : liuyuqi.gov@msncn
 class UserModel {
   String id; // 用户id
   String username; //用户名
   String pwd; // 密码
+  String deviceid;
+  String updateTime;
   String nickname;
   int sex; // 性别:1男2女
   String avatar; // 头像
@@ -15,6 +18,8 @@ class UserModel {
       {this.id,
       this.username,
       this.nickname,
+      this.deviceid,
+      this.updateTime,
       this.pwd,
       this.sex,
       this.avatar,

+ 5 - 4
lib/pages/mine_page.dart

@@ -5,7 +5,8 @@ import 'package:flutter_tracker/model/message_model.dart';
 import 'package:flutter_tracker/routes/routes.dart';
 import 'package:flutter_tracker/utils/app_util.dart';
 import 'package:shared_preferences/shared_preferences.dart';
-/// Description: 
+
+/// Description:
 /// Time       : 2021年12月03日 Friday
 /// Author     : liuyuqi.gov@msncn
 class MinePage extends StatefulWidget {
@@ -134,7 +135,7 @@ class _MinePageState extends State<MinePage> {
               //   ),
               // ),
               Offstage(
-                offstage: true,
+                offstage: false,
                 child: Container(
                   width: 200,
                   child: InkWell(
@@ -147,14 +148,14 @@ class _MinePageState extends State<MinePage> {
                       padding: EdgeInsets.only(right: 20, left: 20),
                       decoration: BoxDecoration(
                           gradient: const LinearGradient(colors: [
-                            ThemeColor.loignColor,
+                            ThemeColor.subTextColor,
                             ThemeColor.loignColor
                           ]),
                           borderRadius: BorderRadius.circular(10),
                           boxShadow: const [
                             BoxShadow(
                               offset: Offset(1.0, 5.0),
-                              color: ThemeColor.loignColor,
+                              color: ThemeColor.subTextColor,
                               blurRadius: 5.0,
                             )
                           ]),

+ 198 - 131
lib/pages/submit_page.dart

@@ -1,7 +1,12 @@
+import 'package:file_picker/file_picker.dart';
 import 'package:flutter/material.dart';
+import 'package:flutter_tracker/dio/track_dao.dart';
 import 'package:flutter_tracker/model/config.dart';
+import 'package:flutter_tracker/model/submit_model.dart';
 import 'package:flutter_tracker/utils/app_util.dart';
-/// Description: 
+import 'package:shared_preferences/shared_preferences.dart';
+
+/// Description:
 /// Time       : 2021年12月03日 Friday
 /// Author     : liuyuqi.gov@msncn
 class SubmitPage extends StatefulWidget {
@@ -12,7 +17,6 @@ class SubmitPage extends StatefulWidget {
 }
 
 class _SubmitPageState extends State<SubmitPage> {
-  Size get _size => MediaQuery.of(context).size;
   final TextEditingController _controllerUsn = TextEditingController();
   final TextEditingController _controllerTel = TextEditingController();
   final TextEditingController _controllerAddress = TextEditingController();
@@ -21,6 +25,11 @@ class _SubmitPageState extends State<SubmitPage> {
   String _userName = "";
   String _tel = "";
   String _addresds = "";
+  bool _heathStatus = false;
+
+  String _filePath;
+
+  Size get _size => MediaQuery.of(context).size;
 
   @override
   Widget build(BuildContext context) {
@@ -28,154 +37,212 @@ class _SubmitPageState extends State<SubmitPage> {
       appBar: AppBar(
         title: Text("疫情上报"),
       ),
-      body: SizedBox(
-        width: _size.width,
-        child: SingleChildScrollView(
-          child: Padding(
-            padding:
-                const EdgeInsets.symmetric(vertical: 16.0, horizontal: 24.0),
-            child: Column(
-              children: [
-                TextFormField(
-                  autofocus: true,
-                  controller: _controllerUsn,
-                  decoration: const InputDecoration(
-                      labelText: "姓名:",
-                      hintText: "请输入真实姓名",
-                      icon: Icon(Icons.person)),
-                  // 校验用户名
-                  validator: (v) {
-                    return v.trim().length > 0 ? null : "姓名不能为空";
-                  },
-                  onChanged: (inputStr) {
-                    _userName = inputStr;
-                  },
+      body: SingleChildScrollView(
+        child: Padding(
+          padding: const EdgeInsets.only(left: 8.0, right: 8),
+          child: Column(
+            children: [
+              TextFormField(
+                autofocus: true,
+                controller: _controllerUsn,
+                decoration: const InputDecoration(
+                    labelText: "姓名:",
+                    hintText: "请输入真实姓名",
+                    icon: Icon(Icons.person)),
+                // 校验用户名
+                validator: (v) {
+                  return v.trim().length > 0 ? null : "姓名不能为空";
+                },
+                onChanged: (inputStr) {
+                  _userName = inputStr;
+                },
+              ),
+              TextFormField(
+                controller: _controllerTel,
+                decoration: const InputDecoration(
+                    labelText: "电话:",
+                    hintText: "联系电话",
+                    icon: Icon(Icons.phone)),
+                validator: (v) {
+                  return v.trim().length > 11 ? null : "手机号错误";
+                },
+                onChanged: (inputStr) {
+                  _tel = inputStr;
+                },
+              ),
+              TextFormField(
+                controller: _controllerAddress,
+                decoration: const InputDecoration(
+                    labelText: "住址:",
+                    hintText: "请输入家庭住址",
+                    icon: Icon(Icons.house)),
+                validator: (v) {
+                  return v.trim().length > 0 ? null : "请输入地址";
+                },
+                onChanged: (inputStr) {
+                  _addresds = inputStr;
+                },
+              ),
+              SizedBox(
+                height: 10,
+              ),
+              Align(
+                child: Text(
+                  "健康状态:",
+                  style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
                 ),
-                TextFormField(
-                  controller: _controllerTel,
-                  decoration: const InputDecoration(
-                      labelText: "电话:",
-                      hintText: "联系电话",
-                      icon: Icon(Icons.phone)),
-                  validator: (v) {
-                    return v.trim().length > 11 ? null : "手机号错误";
-                  },
-                  onChanged: (inputStr) {
-                    _tel = inputStr;
-                  },
+                alignment: Alignment.centerLeft,
+              ),
+              RadioListTile(
+                title: Text("阴性"),
+                value: true,
+                groupValue: _heathStatus,
+                onChanged: (value) {
+                  setState(() {
+                    _heathStatus = value;
+                  });
+                },
+              ),
+              RadioListTile(
+                title: Text("阳性"),
+                value: false,
+                groupValue: _heathStatus,
+                onChanged: (value) {
+                  setState(() {
+                    _heathStatus = value;
+                  });
+                },
+              ),
+              SizedBox(
+                height: 10,
+              ),
+              Align(
+                child: Text(
+                  "核酸检测:",
+                  style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
                 ),
-                TextFormField(
-                  controller: _controllerAddress,
-                  decoration: const InputDecoration(
-                      labelText: "住址:",
-                      hintText: "请输入家庭住址",
-                      icon: Icon(Icons.house)),
-                  validator: (v) {
-                    return v.trim().length > 0 ? null : "请输入地址";
-                  },
-                  onChanged: (inputStr) {
-                    _addresds = inputStr;
-                  },
-                ),
-                SizedBox(
-                  height: 10,
-                ),
-                Align(
-                  child: Text(
-                    "健康状态:",
-                    style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
+                alignment: Alignment.centerLeft,
+              ),
+              Text("请拍照上传清晰的核酸证明图片"),
+              InkWell(
+                onTap: () {
+                  chooseImg();
+                },
+                child: Container(
+                  child: Image.asset(
+                    "assets/images/add.png",
+                    width: 160,
+                    height: 160,
                   ),
-                  alignment: Alignment.centerLeft,
-                ),
-                Row(
-                  children: [
-                    RadioListTile(
-                      title: Text("阴性"),
-                      value: 0,
-                      groupValue: 0,
-                      onChanged: (value) {},
-                    ),
-                    RadioListTile(
-                      title: Text("阳性"),
-                      value: 1,
-                      groupValue: 0,
-                      onChanged: (value) {},
-                    ),
-                  ],
                 ),
-                SizedBox(
-                  height: 10,
+              ),
+              Container(
+                child: Image.asset(
+                  "",
+                  width: 160,
+                  height: 160,
                 ),
-                Align(
-                  child: Text(
-                    "核酸检测:",
-                    style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
-                  ),
-                  alignment: Alignment.centerLeft,
-                ),
-                Text("请拍照上传清晰的核酸证明图片"),
-                InkWell(
+              ),
+              SizedBox(
+                height: 10,
+              ),
+              Container(
+                width: 150,
+                child: InkWell(
                   onTap: () {
-                    chooseImg();
+                    // 登录
+                    submitInfo();
                   },
                   child: Container(
-                    child: Image.asset(
-                      "assets/images/add.png",
-                      width: 160,
-                      height: 160,
-                    ),
-                  ),
-                ),
-                SizedBox(
-                  height: 10,
-                ),
-                Container(
-                  width: 150,
-                  child: InkWell(
-                    onTap: () {
-                      // 登录
-                      submitInfo();
-                    },
-                    child: Container(
-                      width: double.infinity,
-                      height: AppUtil.height(80),
-                      padding: EdgeInsets.only(
-                          right: AppUtil.width(20), left: AppUtil.width(20)),
-                      decoration: BoxDecoration(
-                          gradient: const LinearGradient(colors: [
-                            ThemeColor.loignColor,
-                            ThemeColor.loignColor
-                          ]),
-                          borderRadius: BorderRadius.circular(10),
-                          boxShadow: const [
-                            BoxShadow(
-                              offset: Offset(1.0, 5.0),
-                              color: ThemeColor.loignColor,
-                              blurRadius: 5.0,
-                            )
-                          ]),
-                      child: const Center(
-                        child: Text(
-                          "登录",
-                          style: TextStyle(fontSize: 20, color: Colors.white),
-                        ),
+                    width: double.infinity,
+                    height: AppUtil.height(80),
+                    padding: EdgeInsets.only(
+                        right: AppUtil.width(20), left: AppUtil.width(20)),
+                    decoration: BoxDecoration(
+                        gradient: const LinearGradient(colors: [
+                          ThemeColor.loignColor,
+                          ThemeColor.loignColor
+                        ]),
+                        borderRadius: BorderRadius.circular(10),
+                        boxShadow: const [
+                          BoxShadow(
+                            offset: Offset(1.0, 5.0),
+                            color: ThemeColor.loignColor,
+                            blurRadius: 5.0,
+                          )
+                        ]),
+                    child: const Center(
+                      child: Text(
+                        "提交",
+                        style: TextStyle(fontSize: 20, color: Colors.white),
                       ),
                     ),
                   ),
                 ),
-              ],
-            ),
+              ),
+            ],
           ),
         ),
       ),
     );
   }
 
-  void submitInfo() {
-
+  void submitInfo() async {
+    SharedPreferences prefs = await SharedPreferences.getInstance();
+    String token = prefs.getString("token");
+    var uploadTrack =
+        TrackDao.uploadTrack(token, _tel, _addresds, _heathStatus, _filePath);
   }
 
-  void chooseImg() {
-
+  void chooseImg() async {
+    FilePickerResult result = await FilePicker.platform.pickFiles(
+      type: FileType.custom,
+      allowedExtensions: ['jpg', 'pdf', 'doc'],
+    );
+    if (result != null) {
+      print('---选择的路径---' + result.files.single.path);
+      showDialog<Null>(
+          context: context,
+          barrierDismissible: false,
+          builder: (BuildContext context) {
+            return AlertDialog(
+              //可滑动
+              content: SingleChildScrollView(
+                child: ListBody(
+                  children: <Widget>[
+                    Text('是否确定上传文件?'),
+                  ],
+                ),
+              ),
+              actions: <Widget>[
+                TextButton(
+                  child: Text('确定'),
+                  onPressed: () async {
+                    SharedPreferences prefs =
+                        await SharedPreferences.getInstance();
+                    var token = prefs.getString("token");
+                    SubmitModel fileEntity = await TrackDao.uploadImg(token,
+                        result.files.single.path, result.files.single.name);
+                    AppUtil.buildToast("fileEntity.msgModel.msg");
+                    prefs.setString("fileName", result.files.single.name);
+                    prefs.setInt("fileid", 11);
+                    setState(() {
+                      _filePath = result.files.single.path;
+                    });
+                    Navigator.of(context).pop();
+                  },
+                ),
+                TextButton(
+                  child: Text('取消'),
+                  onPressed: () {
+                    Navigator.of(context).pop();
+                  },
+                ),
+              ],
+            );
+          });
+    } else {
+      print('用户停止了选择文件');
+    }
   }
 }

+ 79 - 30
lib/pages/track_page.dart

@@ -1,5 +1,7 @@
 import 'package:flutter/material.dart';
 import 'package:flutter_blue/flutter_blue.dart';
+import 'package:flutter_tracker/dio/login_dao.dart';
+import 'package:flutter_tracker/model/user_model.dart';
 import 'package:flutter_tracker/utils/app_util.dart';
 import 'package:flutter_tracker/views/contact_card.dart';
 
@@ -17,9 +19,11 @@ class TrackPage extends StatefulWidget {
 
 class _TrackPageState extends State<TrackPage> {
   String testText = '';
-  List<dynamic> contactTraces = [];
-  List<dynamic> contactTimes = [];
-  List<dynamic> contactLocations = [];
+
+  List<UserModel> blueList = [];
+  List<BluetoothDevice> devices = [];
+  List<ScanResult> myScanResult = [];
+  List<String> updateTime = [];
   FlutterBlue flutterBlue = FlutterBlue.instance;
 
   @override
@@ -91,23 +95,32 @@ class _TrackPageState extends State<TrackPage> {
           flex: 2,
           child: Padding(
             padding: const EdgeInsets.symmetric(horizontal: 25.0),
-            child: ListView.builder(
-              itemBuilder: (context, index) {
-                return ContactCard(
-                  imagePath: 'assets/images/head.jpg',
-                  infection: '健康',
-                  contactUsername: contactTraces[index],
-                  contactTime: contactTimes[index],
-                );
-              },
-              itemCount: contactTraces.length,
-            ),
+            child: buildListView(),
           ),
         ),
       ],
     );
   }
 
+  Widget buildListView() {
+    if (blueList.isNotEmpty) {
+      return ListView.builder(
+        itemBuilder: (context, index) {
+          return ContactCard(
+            imagePath: 'assets/images/green.jpg',
+            infection: '健康',
+            username: "李四",
+            updateTime: updateTime[index],
+            deviceid: blueList[index].deviceid,
+          );
+        },
+        itemCount: blueList.length,
+      );
+    } else {
+      return Text("");
+    }
+  }
+
   StreamBuilder<bool> buildStartButton() {
     return StreamBuilder<bool>(
         stream: flutterBlue.isScanning,
@@ -159,28 +172,52 @@ class _TrackPageState extends State<TrackPage> {
         });
   }
 
+  @override
+  void initState() {
+    super.initState();
+    uploadMyId();
+    // startTrack(true);
+  }
+
   void startTrack(bool flag) async {
     if (flag) {
       flutterBlue.stopScan();
     } else {
+      setState(() {
+        blueList = [];
+        updateTime = [];
+        myScanResult = [];
+      });
       AppUtil.buildToast("正在搜索附近的人...");
-      flutterBlue.startScan(timeout: const Duration(seconds: 4));
+      flutterBlue.startScan(timeout: const Duration(seconds: 20));
       //  扫描周围蓝牙设备
-      // List<BluetoothService> services = await device.discoverServices();
-      var subscription = flutterBlue.scanResults.listen((scanResult) {
+      flutterBlue.scanResults.listen((scanResult) {
         for (ScanResult scan in scanResult) {
-          BluetoothDevice device = scan.device;
-          print("------------------------------" +
-              '${device.name} found! rssi: ${scan.rssi}dBm' +
-              device.id.toString());
+          if (!myScanResult.contains(scan)) {
+            print("-----------------id------:" + scan.device.id.toString());
+            setState(() {
+              myScanResult.add(scan);
+              blueList.add(UserModel(deviceid: scan.device.id.toString()));
+              updateTime.add(DateTime.now().toString().substring(0, 10));
+            });
+          }
         }
       });
-      // 上传周边设备到服务器
-
-      //  循环对每个设备检测安全性
-
-      //更新结果
+      // 扫描连接设备
+      List<BluetoothDevice> connectedDevices =
+          await flutterBlue.connectedDevices;
+      for (BluetoothDevice device in connectedDevices) {
+        if (!devices.contains(device)) {
+          devices.add(device);
+          AppUtil.buildToast("正在追踪设备\"" + device.id.toString() + "\"健康状态...");
+          // 云端检测用户状态
+          UserModel user =
+              await LoginDao.getUserByDeviceId(device.id.toString());
+          blueList.add(user);
+        }
+      }
 
+      //  String myDeviceId = await flutterBlue.localAdapter.deviceId;
     }
 
     // try {
@@ -200,10 +237,22 @@ class _TrackPageState extends State<TrackPage> {
     // } catch (e) {
     //   print(e);
     // }
-
-    discovery();
-    AppUtil.buildToast("追踪用户状态中...");
   }
 
-  void discovery() async {}
+  // upload my device BluetoothCharacteristic to server
+  void uploadMyId() async {
+    // String myDeviceId = await flutterBlue.localAdapter.deviceId;
+    // print("-----------------id------:" + myDeviceId);
+    // Map<String, dynamic> params = {
+    //   "userId": loggedInUser.email,
+    //   "deviceId": myDeviceId,
+    // };
+    // HttpUtil.post(
+    //   '/user/updateDeviceId',
+    //   (data) {
+    //     print(data);
+    //   },
+    //   params: params,
+    // );
+  }
 }

+ 2 - 1
lib/views/bottom_sheet_text.dart

@@ -1,5 +1,6 @@
 import 'package:flutter/material.dart';
-/// Description: 
+
+/// Description: 底部文字
 /// Time       : 2021年12月03日 Friday
 /// Author     : liuyuqi.gov@msncn
 class BottomSheetText extends StatelessWidget {

+ 20 - 22
lib/views/contact_card.dart

@@ -1,24 +1,23 @@
 import 'package:flutter/material.dart';
 
 import 'bottom_sheet_text.dart';
-/// Description: 
+
+/// Description: 联系人卡片
 /// Time       : 2021年12月03日 Friday
 /// Author     : liuyuqi.gov@msncn
 class ContactCard extends StatelessWidget {
   ContactCard(
       {this.imagePath,
-      this.email,
       this.infection,
-      this.contactUsername,
-      this.contactTime,
-      this.contactLocation});
+      this.username = "",
+      this.updateTime,
+      this.deviceid = ""});
 
   final String imagePath;
-  final String email;
   final String infection;
-  final String contactUsername;
-  final DateTime contactTime;
-  final String contactLocation;
+  final String username;
+  final String updateTime;
+  final String deviceid;
 
   @override
   Widget build(BuildContext context) {
@@ -31,7 +30,7 @@ class ContactCard extends StatelessWidget {
         ),
         trailing: Icon(Icons.more_horiz),
         title: Text(
-          email,
+          username,
           style: TextStyle(
             color: Colors.deepPurple[700],
             fontWeight: FontWeight.bold,
@@ -42,24 +41,23 @@ class ContactCard extends StatelessWidget {
             context: context,
             builder: (builder) {
               return Padding(
-                padding: const EdgeInsets.symmetric(vertical: 50.0, horizontal: 10.0),
+                padding: const EdgeInsets.symmetric(
+                    vertical: 50.0, horizontal: 10.0),
                 child: Column(
                   children: <Widget>[
-                    BottomSheetText(
-                        question: 'Username', result: contactUsername),
-                    SizedBox(height: 5.0),
-                    BottomSheetText(
-                        question: 'Contact Time',
-                        result: contactTime.toString()),
-                    SizedBox(height: 5.0),
-                    BottomSheetText(
-                        question: 'Contact Location', result: contactLocation),
-                    SizedBox(height: 5.0),
-                    BottomSheetText(question: 'Times Contacted', result: '3'),
+                    BottomSheetText(question: '姓名:', result: username),
+                    const SizedBox(height: 5.0),
+                    BottomSheetText(question: '设备ID:', result: deviceid),
+                    const SizedBox(height: 5.0),
+                    BottomSheetText(question: '更新时间:', result: updateTime),
+                    const SizedBox(height: 5.0),
+                    BottomSheetText(question: '健康状态:', result: infection),
                   ],
                 ),
               );
             }),
+        //  38:FC:E6:22:23:C2
+        //
       ),
     );
   }