admin
2021-11-25 70a344485bd0c9b68ac91f72ed23ec5bfa998b09
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
import 'dart:async';
import 'dart:io';
import 'dart:ui';
 
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart';
import 'package:locations/api/http.dart';
import 'package:locations/model/map/location_model.dart';
import 'package:locations/model/map/location_user_model.dart';
import 'package:locations/model/user/user_info.dart';
import 'package:locations/ui/map/location_search.dart';
import 'package:locations/ui/mine/add_location_person.dart';
import 'package:locations/ui/mine/login.dart';
import 'package:locations/ui/widget/button.dart';
import 'package:locations/ui/widget/capture.dart';
import 'package:locations/ui/widget/dialog.dart';
import 'package:locations/ui/widget/map_marker.dart';
import 'package:locations/utils/event_bus_util.dart';
import 'package:locations/utils/global.dart';
import 'package:locations/utils/location_util.dart';
import 'package:locations/utils/map_util.dart';
import 'package:locations/utils/pageutils.dart';
import 'package:locations/utils/string_util.dart';
import 'package:locations/utils/ui_constant.dart';
import 'package:locations/utils/ui_utils.dart';
import 'package:locations/utils/user_util.dart';
import 'package:path_provider/path_provider.dart';
 
typedef OnPositionHiidenChange = void Function(bool hidden);
 
BMFMapController? _mapController;
 
class LocationPage extends StatefulWidget {
  LocationPage({Key? key, required this.title}) : super(key: key);
 
  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.
 
  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".
 
  final String title;
 
  @override
  _LocationPageState createState() => _LocationPageState();
}
 
class _LocationPageState extends State<LocationPage>
    with AutomaticKeepAliveClientMixin {
  GlobalKey rootWidgetKey = GlobalKey();
  CaptureController _captureController = CaptureController();
 
  //用户marker
  BMFMarker? userMarker;
  String? portrait;
  BaiduLocation? location;
 
  BMFMapOptions mapOptions = BMFMapOptions(
      showMapScaleBar: false,
      mapType: BMFMapType.Standard,
      center: Global.currentPosition != null
          ? Global.currentPosition
          : BMFCoordinate(39.917215, 116.380341),
      mapScaleBarPosition: BMFPoint(0, 200),
      zoomLevel: 12,
      mapPadding: BMFEdgeInsets(left: 30, top: 0, right: 30, bottom: 200));
 
  var eventBusLocation;
 
  @override
  void initState() {
    super.initState();
    eventBusLocation = eventBus.on<UserLocationInfoEventBus>().listen((event) {
      //设置用户头像
      setState(() {
        portrait = (event.user == null ||
                StringUtil.isNullOrEmpty(event.user!.portrait)
            ? null
            : event.user!.portrait);
      });
      location = event.location;
      drawMarker(
          BMFCoordinate(event.location!.latitude!, event.location!.longitude!));
    });
    _getLocationInvite();
  }
 
  void _getLocationInvite() async {
    var uid = await UserUtil.getUid();
    if (uid == null) {
      return;
    }
    Map<String, dynamic>? result =
    await LocationApiUtil.getInviteLocation(uid!);
    if (result!["code"] == 0) {
      LocationUserModel model = LocationUserModel.fromJson(result["data"]);
      showGeneralDialog(
          context: context,
          pageBuilder: (BuildContext buildContext, Animation<double> animation,
              Animation<double> secondaryAnimation) {
            return RequireLocationDialog(model.targetPhone!, () {
              LocationApiUtil.rejectInviteLocation(uid, model.id!)
                  .then((value) {
                if (value!["code"] == 0) {
                  Navigator.of(context).pop();
                } else {
                  ToastUtil.toast(value!["msg"]);
                }
              });
            }, () {
              LocationApiUtil.agreeInviteLocation(uid, model.id!).then((value) {
                if (value!["code"] == 0) {
                  Navigator.of(context).pop();
                } else {
                  ToastUtil.toast(value!["msg"]);
                }
              });
            });
          });
    }
  }
 
 
 
  @override
  void dispose() {
    super.dispose();
    (eventBusLocation as StreamSubscription).cancel();
  }
 
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        resizeToAvoidBottomInset: false,
        backgroundColor: Colors.white,
        body: Stack(
          children: [
            getMapView(),
            PositionInfoPage(),
            Positioned(
                top: -100,
                child: RepaintBoundary(
                    key: rootWidgetKey,
                    child: Image.asset(
                      "assets/images/mine/icon_mine_default_portrait.png",
                      height: 33,
                      width: 33,
                    ))),
            Align(
                alignment: Alignment.bottomCenter,
                child: getAddLocationObjectView()),
 
            //地图marker截图组件
            Positioned(
                top: -100,
                child: CaptureWidget(
                  widget: PersonLocationMarker(portrait == null
                      ? Image.asset(
                          "assets/images/mine/icon_mine_default_portrait.png",
                        )
                      : Image.network(portrait!)),
                  captureController: _captureController,
                ))
          ],
        ));
  }
 
  //控件阴影
  List<BoxShadow> getViewShadow() {
    return [
      BoxShadow(
        blurRadius: 6.5,
        spreadRadius: 1,
        color: Color(0x4D0E96FF),
      )
    ];
  }
 
  //获取地图视图
  Widget getMapView() {
    return Container(
      child: BMFMapWidget(
        onBMFMapCreated: (controller) {
          _mapController = controller;
          if (location != null) {
            drawMarker(
                BMFCoordinate(location!.latitude!, location!.longitude!));
          }
        },
        mapOptions: mapOptions,
      ),
    );
  }
 
  //画marker
  void drawMarker(BMFCoordinate location) async {
    if (_mapController == null) {
      return;
    }
    Directory? tempDir = await getExternalStorageDirectory();
    String tempPath = tempDir!.path;
    File? file =
        await _captureController.capturePng("$tempPath/location_person.png");
    if (userMarker == null) {
      userMarker =
          await MapUtil.addMarker(_mapController, location, file!.path);
    } else {
      userMarker!.updateIcon(file!.path);
      userMarker!.updatePosition(location);
    }
    _mapController!.setCenterCoordinate(location, true);
  }
 
  //添加想定位的人
  Widget getAddLocationObjectView() {
    return InkWell(
        onTap: () {
          UserUtil.isLogin().then((value) {
            if (!value) {
              NavigatorUtil.navigateToNextPage(
                  context, LoginPage(title: ""), (data) {});
              return;
            }
            NavigatorUtil.navigateToNextPage(
                context, AddLocationPersonPage(title: ""), (data) {});
          });
        },
        child: Container(
          alignment: Alignment.topCenter,
          height: 72,
          margin: const EdgeInsets.fromLTRB(10, 0, 10, 0),
          padding: const EdgeInsets.fromLTRB(0, 18, 0, 0),
          decoration: BoxDecoration(
              color: Colors.white,
              borderRadius: BorderRadius.only(
                  topLeft: Radius.circular(10), topRight: Radius.circular(10)),
              boxShadow: getViewShadow()),
          child: Flex(
            direction: Axis.horizontal,
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              Image.asset(
                "assets/images/common/icon_person.png",
                height: 17,
              ),
              Container(
                width: 11,
                height: 1,
              ),
              const Text(
                "添加想定位的对象",
                style: TextStyle(color: ColorConstant.theme, fontSize: 15),
              )
            ],
          ),
        ));
  }
 
  @override
  bool get wantKeepAlive => true;
}
 
//控件阴影
List<BoxShadow> getViewShadow() {
  return [
    BoxShadow(
      blurRadius: 6.5,
      spreadRadius: 1,
      color: Color(0x4D0E96FF),
    )
  ];
}
 
/*****************定位信息****************/
 
class PositionInfoPage extends StatefulWidget {
  PositionInfoPage({Key? key}) : super(key: key);
 
  @override
  _PositionInfoPageState createState() => _PositionInfoPageState();
}
 
class _PositionInfoPageState extends State<PositionInfoPage>
    with SingleTickerProviderStateMixin {
  //位置信息是否隐藏
  bool locationInfoHidden = true;
 
  UserInfo? user;
 
  BaiduLocation? _location;
 
  GlobalKey rootWidgetKey = GlobalKey();
 
  var eventBusLogin;
 
  List<LocationUserModel>? userList;
 
  @override
  void initState() {
    super.initState();
    UserUtil.getUserInfo().then((value) {
      setState(() {
        user = value;
      });
      //开始定位
      LocationUtil.startLocation(0, (state, map) {
        if (state == LocationState.success) {
          BaiduLocation location = BaiduLocation.fromJson(map);
          setState(() {
            _location = location;
          });
          eventBus.fire(UserLocationInfoEventBus(_location, user));
        }
      });
    });
    //注册eventbus
    eventBusLogin = eventBus.on<LoginEventBus>().listen((event) {
      if (event.isLogin) {
        UserUtil.getUserInfo().then((value) {
          setState(() {
            user = value;
          });
        });
      } else {
        setState(() {
          user = null;
        });
      }
    });
  }
 
  @override
  void dispose() {
    super.dispose();
    //取消订阅
    eventBusLogin.cancel();
  }
 
 
 
  void _selectLocationUser() async {
    await _getLocationUsers();
 
    if (userList == null || userList!.isEmpty) {
      ToastUtil.toast("请先添加定位对象");
      return;
    }
 
    var selectUserType = await showGeneralDialog(
        context: context,
        pageBuilder: (BuildContext buildContext, Animation<double> animation,
                Animation<double> secondaryAnimation) =>
            ListViewDialog(
              ListView.builder(
                padding: EdgeInsets.zero,
                  itemCount: userList!.length,
                  itemBuilder: (BuildContext context, int index) {
                    return _getUserItem(userList![index], index);
                  }),
              () {
                Navigator.of(context).pop();
              },
            ));
  }
 
  Future _getLocationUsers() async {
    var uid = await UserUtil.getUid();
    if (uid == null) return;
    Map<String, dynamic>? result =
        await LocationApiUtil.getLocationUsers(uid, 1);
 
    if (result!["code"] == 0) {
      List<dynamic> list = result!["data"]["list"];
      List<LocationUserModel> users = [];
      list.forEach((element) {
        users.add(LocationUserModel.fromJson(element));
      });
      userList = users;
    } else {
      ToastUtil.toast(result!["msg"]);
    }
  }
 
  @override
  Widget build(BuildContext context) {
    return Container(
        padding: const EdgeInsets.fromLTRB(10, 35, 10, 0),
        child: Flex(direction: Axis.vertical, children: [
          //----------搜索框--------
          Flex(
            direction: Axis.horizontal,
            children: [
              Expanded(
                  child: InkWell(
                      onTap: () {
                        NavigatorUtil.navigateToNextPage(
                            context, LocationSearchPage(), (data) {});
                      },
                      child: Container(
                        alignment: Alignment.center,
                        padding: EdgeInsets.fromLTRB(13, 0, 13, 0),
                        height: 45,
                        decoration: BoxDecoration(
                            color: Colors.white,
                            borderRadius: BorderRadius.circular(10),
                            boxShadow: getViewShadow()),
                        child: Flex(
                          direction: Axis.horizontal,
                          children: [
                            Image.asset(
                              "assets/images/main/icon_location_search.png",
                              height: 19,
                            ),
                            Container(
                              width: 10,
                            ),
                            const Expanded(
                                child: Text("地图上找位置",
                                    style: TextStyle(
                                        fontSize: 14,
                                        color: Color(0xFFC4CDD1))))
                          ],
                        ),
                      ))),
              InkWell(
                  onTap: () {
                    print("sos");
                  },
                  child: Container(
                    width: 45,
                    height: 45,
                    margin: const EdgeInsets.only(left: 8.5),
                    decoration: BoxDecoration(
                        color: Colors.white,
                        boxShadow: getViewShadow(),
                        borderRadius: BorderRadius.circular(23)),
                    alignment: Alignment.center,
                    child: Image.asset(
                      "assets/images/main/icon_location_sos.png",
                      height: 35,
                    ),
                  ))
            ],
          ),
          //---------个人信息与定位信息---
          Container(
              height: 400,
              child: Stack(
                children: [
                  //位置信息
                  _location == null
                      ? Container()
                      : getPositionInfoView(context),
                  //个人信息
                  Container(
                    height: 100,
                    margin: EdgeInsets.only(top: 10),
                    padding: EdgeInsets.only(left: 15, top: 8, right: 15),
                    decoration: BoxDecoration(
                        borderRadius: BorderRadius.only(
                            bottomLeft:
                                Radius.circular(locationInfoHidden ? 10 : 0),
                            bottomRight:
                                Radius.circular(locationInfoHidden ? 10 : 0),
                            topLeft: Radius.circular(10),
                            topRight: Radius.circular(10)),
                        color: Colors.white,
                        boxShadow: getViewShadow()),
                    child: Stack(
                      alignment: Alignment.topCenter,
                      children: [
                        user == null
                            ? Container()
                            : InkWell(
                                onTap: () {
                                  _selectLocationUser();
                                },
                                child: Flex(
                                  mainAxisAlignment: MainAxisAlignment.center,
                                  direction: Axis.horizontal,
                                  children: [
                                    Image.asset(
                                      "assets/images/main/icon_location_change_person.png",
                                      width: 13,
                                    ),
                                    Text(
                                      " 切换实时定位人",
                                      style: TextStyle(
                                          color: ColorConstant.theme,
                                          fontSize: 15),
                                    )
                                  ],
                                )),
                        //个人信息
                        Flex(
                          direction: Axis.horizontal,
                          crossAxisAlignment: CrossAxisAlignment.center,
                          children: [
                            user == null
                                ? Image(
                                    image: AssetImage(
                                        "assets/images/mine/icon_mine_default_portrait.png"),
                                    height: 33,
                                    width: 33,
                                  )
                                : Image.network(
                                    user!.portrait!,
                                    width: 33,
                                    height: 33,
                                  ),
                            Container(
                              width: 5,
                            ),
                            Expanded(
                                child: Flex(
                              direction: Axis.vertical,
                              mainAxisAlignment: MainAxisAlignment.center,
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: user == null
                                  ? [
                                      Container(
                                          width: 60,
                                          child: MyOutlineButton(
                                            "去登录",
                                            5,
                                            onClick: () {
                                              NavigatorUtil.navigateToNextPage(
                                                  context, LoginPage(title: ""),
                                                  (data) {
                                                UserUtil.getUserInfo()
                                                    .then((value) {
                                                  setState(() {
                                                    user = value;
                                                  });
                                                });
                                              });
                                            },
                                          ))
                                    ]
                                  : [
                                      Text(
                                        user!.nickName!,
                                        softWrap: false,
                                        overflow: TextOverflow.ellipsis,
                                        style: TextStyle(
                                            color: Color(0xFFA0A0A0),
                                            fontSize: 18),
                                      ),
                                      Container(
                                        height: 2,
                                      ),
                                      Text(
                                        "ID:${user!.id!}",
                                        style: TextStyle(
                                            color: Color(0xFFA0A0A0),
                                            fontSize: 12),
                                      )
                                    ],
                            )),
                            Container(
                              width: 5,
                            ),
                            Flex(
                                direction: Axis.vertical,
                                mainAxisAlignment: MainAxisAlignment.center,
                                children: user == null
                                    ? []
                                    : [
                                        MyOutlineButton(
                                          "生成轨迹",
                                          13,
                                          height: 26,
                                          width: 82,
                                          fontSize: 12,
                                          onClick: () {
                                            print("生成轨迹");
                                          },
                                        ),
                                        Container(
                                          height: 6,
                                        ),
                                        MyOutlineButton(
                                          "实时共享",
                                          13,
                                          height: 26,
                                          width: 82,
                                          fontSize: 12,
                                          onClick: () {
                                            print("实时共享");
                                          },
                                        ),
                                      ])
                          ],
                        )
                      ],
                    ),
                  ),
 
                  //更多
                  _location == null
                      ? Container()
                      : Positioned(
                          left: MediaQuery.of(context).size.width / 2 -
                              10 -
                              70 / 2,
                          top: 80,
                          child: InkWell(
                              onTap: () {
                                setState(() {
                                  locationInfoHidden = !locationInfoHidden;
                                });
                              },
                              child: Container(
                                  width: 70,
                                  height: 40,
                                  child: Stack(
                                      alignment: Alignment.bottomCenter,
                                      children: [
                                        Container(
                                          height: 30,
                                          width: 60,
                                          margin: EdgeInsets.only(top: 0),
                                          alignment: Alignment.center,
                                          decoration: BoxDecoration(
                                              color: Colors.white,
                                              borderRadius:
                                                  BorderRadius.circular(15),
                                              boxShadow: getViewShadow()),
                                        ),
                                        Positioned(
                                            top: 0,
                                            child: Container(
                                              height: 25,
                                              width: 70,
                                              alignment: Alignment.bottomCenter,
 
                                              decoration: BoxDecoration(
                                                color: Colors.white,
                                              ),
                                              // child: Text(
                                              //   "收起",
                                              //   style: TextStyle(
                                              //       color: ColorConstant.theme,
                                              //       fontSize: 11),
                                              // )
                                            )),
                                        Positioned(
                                            bottom: 5,
                                            child: Text(
                                              locationInfoHidden ? "展开" : "收起",
                                              style: TextStyle(
                                                  color: ColorConstant.theme,
                                                  fontSize: 11),
                                            )),
                                      ]))))
                ],
              )),
        ]));
  }
 
  Widget _getStatus(LocationInviteStatus? status, LocationUserModel user) {
    switch (status) {
      case LocationInviteStatus.sentInvite:
        return const Text(
          "等待同意",
          style: TextStyle(color: ColorConstant.theme, fontSize: 15),
        );
 
      case LocationInviteStatus.agree:
        return InkWell(
            onTap: () {
              Navigator.pop(context, user);
            },
            child: Container(
              padding: const EdgeInsets.only(left: 10, right: 10),
              height: 25,
              decoration: BoxDecoration(
                  color: Colors.white,
                  border: Border.all(color: ColorConstant.theme),
                  borderRadius: BorderRadius.circular(10)),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  Image.asset(
                    "assets/images/user/icon_user_location.png",
                    height: 15,
                  ),
                  Container(
                    width: 5,
                  ),
                  const Text(
                    "去定位",
                    style: TextStyle(color: ColorConstant.theme, fontSize: 15),
                  )
                ],
              ),
            ));
      case LocationInviteStatus.reject:
        return const Text(
          "对方拒接",
          style: TextStyle(color: Color(0xFF9DAAB3), fontSize: 15),
        );
    }
 
    return Container();
  }
 
  Image _getPortrait(LocationUserType? type) {
    String img = "assets/images/user/";
    switch (type) {
      case LocationUserType.father:
        img += "icon_user_type_father.png";
        break;
      case LocationUserType.mother:
        img += "icon_user_type_mother.png";
        break;
      case LocationUserType.husband:
        img += "icon_user_type_husband.png";
        break;
      case LocationUserType.wife:
        img += "icon_user_type_wife.png";
        break;
      case LocationUserType.daughter:
        img += "icon_user_type_daughter.png";
        break;
      case LocationUserType.son:
        img += "icon_user_type_son.png";
        break;
      case LocationUserType.other:
        img += "icon_user_type_other.png";
    }
 
    return Image.asset(
      img,
      height: 31,
    );
  }
 
  Widget _getUserItem(LocationUserModel user, int index) {
    return Column(children: [
      Container(
          padding: const EdgeInsets.fromLTRB(27, 0, 27, 0),
          height: 80,
          decoration: BoxDecoration(
              color: Colors.white,
              borderRadius: index == 0
                  ? const BorderRadius.only(
                      topLeft: Radius.circular(10),
                      topRight: Radius.circular(10))
                  : BorderRadius.zero),
          child: Row(
            children: [
              Container(
                width: 40,
                alignment: Alignment.center,
                child: _getPortrait(user.userType),
              ),
              Container(
                width: 8,
              ),
              Expanded(
                  child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text(
                    user.targetName!,
                    style: const TextStyle(
                        fontSize: 18, color: ColorConstant.theme),
                  ),
                  Container(
                    height: 5,
                  ),
                  Text(
                    user.targetPhone!,
                    style:
                        const TextStyle(fontSize: 15, color: Color(0xFF9DAAB3)),
                  ),
                ],
              )),
              _getStatus(user.status, user)
            ],
          )),
      Container(
        height: 1,
        color: Colors.white,
        padding: const EdgeInsets.only(left: 27, right: 27),
        child: Container(
          color: const Color(0xFF9DAAB3),
        ),
      )
    ]);
  }
 
  Widget getPositionInfoView(BuildContext context) {
    if (!locationInfoHidden) {
      return Positioned(
          top: 110,
          child: ClipRRect(
              borderRadius: const BorderRadius.only(
                  bottomLeft: Radius.circular(10),
                  bottomRight: Radius.circular(10)),
              child: BackdropFilter(
                  filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
                  child: Container(
                    padding: const EdgeInsets.all(18),
                    height: 120,
                    width: MediaQuery.of(context).size.width - 10 * 2,
                    color: Colors.white.withAlpha(180),
                    child: Flex(
                      mainAxisAlignment: MainAxisAlignment.start,
                      crossAxisAlignment: CrossAxisAlignment.center,
                      direction: Axis.vertical,
                      children: [
                        Container(
                          padding: const EdgeInsets.fromLTRB(12, 5, 12, 5),
                          decoration: BoxDecoration(
                              color: const Color(0xFFCACDD3),
                              borderRadius: BorderRadius.circular(20)),
                          child: Text(
                            _location!.locTime!,
                            style: const TextStyle(
                                color: Colors.white, fontSize: 10),
                          ),
                        ),
                        Container(
                          height: 2,
                        ),
                        Flex(
                          direction: Axis.horizontal,
                          children: [
                            Image.asset(
                              "assets/images/main/icon_location_position_name.png",
                              height: 16,
                            ),
                            const Text(
                              " 当前位置:",
                              style: TextStyle(
                                  color: Color(0xFF999999), fontSize: 12),
                            ),
                            Expanded(
                                child: Text(
                              _location!.address!,
                              softWrap: false,
                              overflow: TextOverflow.ellipsis,
                              style: TextStyle(
                                  color: Color(0xFFBABABA), fontSize: 12),
                            ))
                          ],
                        ),
                        Container(
                          height: 4,
                        ),
                        Container(
                            child: Flex(
                          direction: Axis.horizontal,
                          children: [
                            Image.asset(
                              "assets/images/main/icon_location_position_location.png",
                              height: 15,
                            ),
                            const Text(
                              " 经  纬  度:",
                              style: TextStyle(
                                  color: Color(0xFF999999), fontSize: 12),
                            ),
                            Expanded(
                                child: Text(
                              "N ${_location!.latitude!},W ${_location!.longitude!}",
                              softWrap: false,
                              overflow: TextOverflow.ellipsis,
                              style: const TextStyle(
                                  color: Color(0xFFBABABA), fontSize: 12),
                            ))
                          ],
                        )),
                        Container(
                          height: 5,
                        ),
                        Flex(
                          direction: Axis.horizontal,
                          mainAxisAlignment: MainAxisAlignment.center,
                          crossAxisAlignment: CrossAxisAlignment.center,
                          children: [
                            Text(
                              "查看全部共100次定位 ",
                              style: TextStyle(
                                  color: Color(0xFF9DAAB3), fontSize: 10),
                            ),
                            Image.asset(
                              "assets/images/main/icon_location_position_more.png",
                              height: 10,
                            ),
                          ],
                        ),
                      ],
                    ),
                  ))));
    } else {
      return Container();
    }
  }
}