|
@@ -8,11 +8,11 @@ import 'package:get/get.dart';
|
|
|
import 'package:location/base/base_page.dart';
|
|
import 'package:location/base/base_page.dart';
|
|
|
import 'package:location/data/bean/user_info.dart';
|
|
import 'package:location/data/bean/user_info.dart';
|
|
|
import 'package:location/module/main/main_controller.dart';
|
|
import 'package:location/module/main/main_controller.dart';
|
|
|
|
|
+import 'package:location/module/main/today_track_helper.dart';
|
|
|
import 'package:location/module/main/view.dart';
|
|
import 'package:location/module/main/view.dart';
|
|
|
import 'package:location/resource/assets.gen.dart';
|
|
import 'package:location/resource/assets.gen.dart';
|
|
|
import 'package:location/resource/colors.gen.dart';
|
|
import 'package:location/resource/colors.gen.dart';
|
|
|
import 'package:location/resource/string.gen.dart';
|
|
import 'package:location/resource/string.gen.dart';
|
|
|
-import 'package:location/utils/atmob_log.dart';
|
|
|
|
|
import 'package:location/utils/common_expand.dart';
|
|
import 'package:location/utils/common_expand.dart';
|
|
|
import 'package:sliding_sheet2/sliding_sheet2.dart';
|
|
import 'package:sliding_sheet2/sliding_sheet2.dart';
|
|
|
import 'package:visibility_detector/visibility_detector.dart';
|
|
import 'package:visibility_detector/visibility_detector.dart';
|
|
@@ -112,80 +112,154 @@ class MainPage extends BasePage<MainController> {
|
|
|
color: Colors.white, borderRadius: BorderRadius.circular(20.r)),
|
|
color: Colors.white, borderRadius: BorderRadius.circular(20.r)),
|
|
|
child: AspectRatio(
|
|
child: AspectRatio(
|
|
|
aspectRatio: 336 / 134,
|
|
aspectRatio: 336 / 134,
|
|
|
- child: Column(
|
|
|
|
|
|
|
+ child: Obx(() {
|
|
|
|
|
+ final todayTrack = controller.selectedFriend?.id == null
|
|
|
|
|
+ ? null
|
|
|
|
|
+ : controller.todayTrackReportMap[controller.selectedFriend?.id];
|
|
|
|
|
+ if (todayTrack == null ||
|
|
|
|
|
+ todayTrack.isRequestSuccess.value == false) {
|
|
|
|
|
+ return buildTodayTrackLoadingView();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return buildTodayTrackDetailView(todayTrack);
|
|
|
|
|
+ }
|
|
|
|
|
+ }),
|
|
|
|
|
+ ),
|
|
|
|
|
+ ),
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ Widget buildTodayTrackLoadingView() {
|
|
|
|
|
+ return Column(
|
|
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
+ children: [
|
|
|
|
|
+ CupertinoActivityIndicator(
|
|
|
|
|
+ color: '#A3A3A5'.color,
|
|
|
|
|
+ radius: 16.w,
|
|
|
|
|
+ ),
|
|
|
|
|
+ SizedBox(height: 15.w),
|
|
|
|
|
+ Text(StringName.mainTodayTrackLoading,
|
|
|
|
|
+ style: TextStyle(
|
|
|
|
|
+ fontSize: 14.sp, color: '#666666'.color.withOpacity(0.87)))
|
|
|
|
|
+ ],
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ Widget buildTodayTrackDetailView(TodayTrackReportBean todayTrackReportBean) {
|
|
|
|
|
+ return GestureDetector(
|
|
|
|
|
+ behavior: HitTestBehavior.opaque,
|
|
|
|
|
+ onTap: controller.onTodayTraceClick,
|
|
|
|
|
+ child: Column(
|
|
|
|
|
+ children: [
|
|
|
|
|
+ Row(
|
|
|
children: [
|
|
children: [
|
|
|
- Row(
|
|
|
|
|
- children: [
|
|
|
|
|
- Text(StringName.todaySimpleTrack,
|
|
|
|
|
- style: TextStyle(
|
|
|
|
|
- fontSize: 13.sp,
|
|
|
|
|
- color: '#333333'.color,
|
|
|
|
|
- fontWeight: FontWeight.bold)),
|
|
|
|
|
- Spacer(),
|
|
|
|
|
- Assets.images.iconMainTrackArrow
|
|
|
|
|
- .image(width: 10.w, height: 10.w),
|
|
|
|
|
- ],
|
|
|
|
|
- ),
|
|
|
|
|
- SizedBox(height: 7.w),
|
|
|
|
|
- buildSelectedFriendTodayTrackDetailView(),
|
|
|
|
|
|
|
+ Text(StringName.todaySimpleTrack,
|
|
|
|
|
+ style: TextStyle(
|
|
|
|
|
+ fontSize: 13.sp,
|
|
|
|
|
+ color: '#333333'.color,
|
|
|
|
|
+ fontWeight: FontWeight.bold)),
|
|
|
|
|
+ Spacer(),
|
|
|
|
|
+ Assets.images.iconMainTrackArrow.image(width: 10.w, height: 10.w),
|
|
|
],
|
|
],
|
|
|
),
|
|
),
|
|
|
- ),
|
|
|
|
|
|
|
+ SizedBox(height: 7.w),
|
|
|
|
|
+ buildSelectedFriendTodayTrackDetailView(todayTrackReportBean),
|
|
|
|
|
+ ],
|
|
|
),
|
|
),
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- Widget buildSelectedFriendTodayTrackDetailView() {
|
|
|
|
|
- return Expanded(child: Obx(() {
|
|
|
|
|
- if (controller.todayTrackRequesting) {
|
|
|
|
|
- return Center(child: Text('加载中...'));
|
|
|
|
|
- } else {
|
|
|
|
|
- return Row(
|
|
|
|
|
|
|
+ Widget buildSelectedFriendTodayTrackDetailView(
|
|
|
|
|
+ TodayTrackReportBean todayTrackReportBean) {
|
|
|
|
|
+ final startAddr = todayTrackReportBean.startPoint?.addr;
|
|
|
|
|
+
|
|
|
|
|
+ final errorAddr = todayTrackReportBean.exceptionPoint?.addr;
|
|
|
|
|
+
|
|
|
|
|
+ MainTrackType startPointType = startAddr?.isNotEmpty == true
|
|
|
|
|
+ ? MainTrackType.startPoint
|
|
|
|
|
+ : MainTrackType.normalPoint;
|
|
|
|
|
+
|
|
|
|
|
+ MainTrackType errorPointType = errorAddr?.isNotEmpty == true
|
|
|
|
|
+ ? MainTrackType.errorPoint
|
|
|
|
|
+ : MainTrackType.normalPoint;
|
|
|
|
|
+
|
|
|
|
|
+ Color startPointColor;
|
|
|
|
|
+ if (startPointType == MainTrackType.startPoint) {
|
|
|
|
|
+ startPointColor = '#15CBA1'.color;
|
|
|
|
|
+ } else if (startPointType == MainTrackType.errorPoint) {
|
|
|
|
|
+ startPointColor = '#E94949'.color;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ startPointColor = '#D6D6D6'.color;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ Color errorPointColor;
|
|
|
|
|
+ if (errorPointType == MainTrackType.errorPoint) {
|
|
|
|
|
+ errorPointColor = '#E94949'.color;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ errorPointColor = '#D6D6D6'.color;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return Expanded(
|
|
|
|
|
+ child: Row(
|
|
|
|
|
+ children: [
|
|
|
|
|
+ Container(
|
|
|
|
|
+ margin: EdgeInsets.only(bottom: 3.w, top: 3.w),
|
|
|
|
|
+ child: AspectRatio(
|
|
|
|
|
+ aspectRatio: 1,
|
|
|
|
|
+ child: buildTodayMapView(todayTrackReportBean),
|
|
|
|
|
+ ),
|
|
|
|
|
+ ),
|
|
|
|
|
+ SizedBox(width: 10.w),
|
|
|
|
|
+ Column(
|
|
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
children: [
|
|
children: [
|
|
|
- Container(
|
|
|
|
|
- margin: EdgeInsets.only(bottom: 3.w, top: 3.w),
|
|
|
|
|
- child: AspectRatio(
|
|
|
|
|
- aspectRatio: 1,
|
|
|
|
|
- child: Assets.images.imgTrackExample.image(),
|
|
|
|
|
- ),
|
|
|
|
|
- ),
|
|
|
|
|
- SizedBox(width: 10.w),
|
|
|
|
|
- Column(
|
|
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
- children: [
|
|
|
|
|
- SizedBox(height: 6.w),
|
|
|
|
|
- getMainTrackDot('#15CBA1'.color),
|
|
|
|
|
- Expanded(
|
|
|
|
|
- child: Container(
|
|
|
|
|
- margin: EdgeInsets.symmetric(vertical: 4.w),
|
|
|
|
|
- width: 1.w,
|
|
|
|
|
- height: double.infinity,
|
|
|
|
|
- decoration: BoxDecoration(
|
|
|
|
|
- color: '#F0F0F0'.color,
|
|
|
|
|
- borderRadius: BorderRadius.circular(100.r),
|
|
|
|
|
- ),
|
|
|
|
|
- ),
|
|
|
|
|
- ),
|
|
|
|
|
- getMainTrackDot('#E94949'.color),
|
|
|
|
|
- SizedBox(height: 6.w),
|
|
|
|
|
- ],
|
|
|
|
|
- ),
|
|
|
|
|
- SizedBox(width: 8.w),
|
|
|
|
|
|
|
+ SizedBox(height: 6.w),
|
|
|
|
|
+ getMainTrackDot(startPointColor),
|
|
|
Expanded(
|
|
Expanded(
|
|
|
- child: Column(
|
|
|
|
|
- children: [
|
|
|
|
|
- buildTrackPoint(MainTrackType.startPoint,
|
|
|
|
|
- '广东省广州市天河区高唐路235号靠近C栋2楼时代E-PARK'),
|
|
|
|
|
- Spacer(),
|
|
|
|
|
- buildTrackPoint(
|
|
|
|
|
- MainTrackType.errorPoint, '广东省广州市海珠区滨江东路驾驶花园C栋601'),
|
|
|
|
|
- ],
|
|
|
|
|
|
|
+ child: Container(
|
|
|
|
|
+ margin: EdgeInsets.symmetric(vertical: 4.w),
|
|
|
|
|
+ width: 1.w,
|
|
|
|
|
+ height: double.infinity,
|
|
|
|
|
+ decoration: BoxDecoration(
|
|
|
|
|
+ color: '#F0F0F0'.color,
|
|
|
|
|
+ borderRadius: BorderRadius.circular(100.r),
|
|
|
|
|
+ ),
|
|
|
),
|
|
),
|
|
|
- )
|
|
|
|
|
|
|
+ ),
|
|
|
|
|
+ getMainTrackDot(errorPointColor),
|
|
|
|
|
+ SizedBox(height: 6.w),
|
|
|
],
|
|
],
|
|
|
- );
|
|
|
|
|
- }
|
|
|
|
|
- }));
|
|
|
|
|
|
|
+ ),
|
|
|
|
|
+ SizedBox(width: 8.w),
|
|
|
|
|
+ Expanded(
|
|
|
|
|
+ child: Column(
|
|
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
+ children: [
|
|
|
|
|
+ Visibility(
|
|
|
|
|
+ visible: startPointType == MainTrackType.normalPoint,
|
|
|
|
|
+ child: SizedBox(height: 2.w)),
|
|
|
|
|
+ buildTrackPoint(startPointType, startAddr ?? ''),
|
|
|
|
|
+ Spacer(),
|
|
|
|
|
+ buildTrackPoint(errorPointType, errorAddr ?? ''),
|
|
|
|
|
+ Visibility(
|
|
|
|
|
+ visible: errorPointType == MainTrackType.normalPoint,
|
|
|
|
|
+ child: SizedBox(height: 5.w))
|
|
|
|
|
+ ],
|
|
|
|
|
+ ),
|
|
|
|
|
+ )
|
|
|
|
|
+ ],
|
|
|
|
|
+ ));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ Widget buildTodayMapView(TodayTrackReportBean todayTrackReportBean) {
|
|
|
|
|
+ return ClipRRect(
|
|
|
|
|
+ borderRadius: BorderRadius.circular(8.r),
|
|
|
|
|
+ child: MapWidget(
|
|
|
|
|
+ isShowLogo: false,
|
|
|
|
|
+ interactionIsEnabled: false,
|
|
|
|
|
+ mapPadding: todayTrackReportBean.mapPadding,
|
|
|
|
|
+ markers: todayTrackReportBean.markers,
|
|
|
|
|
+ polyline: todayTrackReportBean.polylines,
|
|
|
|
|
+ ));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Widget buildFriendListView() {
|
|
Widget buildFriendListView() {
|