|
|
@@ -8,6 +8,7 @@ import 'package:get/get_core/src/get_main.dart';
|
|
|
import 'package:location/base/base_page.dart';
|
|
|
import 'package:location/data/bean/user_info.dart';
|
|
|
import 'package:location/module/track/track_controller.dart';
|
|
|
+import 'package:location/module/track/track_day_detail/track_day_detail_view.dart';
|
|
|
import 'package:location/resource/assets.gen.dart';
|
|
|
import 'package:location/resource/colors.gen.dart';
|
|
|
import 'package:location/resource/string.gen.dart';
|
|
|
@@ -15,8 +16,8 @@ import 'package:location/utils/common_expand.dart';
|
|
|
import 'package:location/utils/common_style.dart';
|
|
|
import 'package:location/utils/date_util.dart';
|
|
|
import 'package:sliding_sheet2/sliding_sheet2.dart';
|
|
|
-
|
|
|
import '../../router/app_pages.dart';
|
|
|
+import '../../utils/fixed_size_tab_indicator.dart';
|
|
|
import '../../widget/common_view.dart';
|
|
|
import '../../widget/relative_time_text.dart';
|
|
|
|
|
|
@@ -43,13 +44,7 @@ class TrackPage extends BasePage<TrackController> {
|
|
|
controller: controller.mapController,
|
|
|
),
|
|
|
),
|
|
|
- SafeArea(
|
|
|
- child: Container(
|
|
|
- margin: EdgeInsets.only(top: 14.w, left: 12.w),
|
|
|
- child: GestureDetector(
|
|
|
- onTap: controller.back, child: CommonView.getBackBtnView()),
|
|
|
- ),
|
|
|
- ),
|
|
|
+ buildBackBtnView(),
|
|
|
SlidingSheet(
|
|
|
color: ColorName.white,
|
|
|
controller: controller.sheetController,
|
|
|
@@ -57,136 +52,120 @@ class TrackPage extends BasePage<TrackController> {
|
|
|
shadowColor: Colors.black.withOpacity(0.1),
|
|
|
cornerRadius: 18.w,
|
|
|
snapSpec: SnapSpec(
|
|
|
- initialSnap: 1,
|
|
|
+ initialSnap: 0.45,
|
|
|
// Enable snapping. This is true by default.
|
|
|
snap: true,
|
|
|
// Set custom snapping points.
|
|
|
- snappings: [SnapSpec.headerFooterSnap, 1.0],
|
|
|
+ snappings: [SnapSpec.headerSnap, 0.45, 1.0],
|
|
|
// Define to what the snappings relate to. In this case,
|
|
|
// the total available space that the sheet can expand to.
|
|
|
positioning: SnapPositioning.relativeToAvailableSpace,
|
|
|
),
|
|
|
- footerBuilder: (context, state) {
|
|
|
- return buildOperationBtn();
|
|
|
- },
|
|
|
headerBuilder: (context, state) {
|
|
|
- return IntrinsicHeight(
|
|
|
- child: Column(
|
|
|
- children: [
|
|
|
- SizedBox(height: 5.w),
|
|
|
- Align(
|
|
|
- alignment: Alignment.center,
|
|
|
- child: Container(
|
|
|
- width: 32.w,
|
|
|
- height: 3.w,
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: '#D9D9D9'.color,
|
|
|
- borderRadius: BorderRadius.circular(49.w),
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- SizedBox(height: 25.w),
|
|
|
- buildTrackHeaderView(),
|
|
|
- ],
|
|
|
- ));
|
|
|
+ return buildSheetHeadView();
|
|
|
},
|
|
|
builder: (context, state) {
|
|
|
- return Column(
|
|
|
- children: [
|
|
|
- SizedBox(
|
|
|
- width: double.infinity,
|
|
|
- height: 220.w,
|
|
|
- child: TabBarView(
|
|
|
- controller: controller.tabController,
|
|
|
- children: [
|
|
|
- buildTrackHistoryContentView(),
|
|
|
- buildTrackNowContentView()
|
|
|
- ]),
|
|
|
- )
|
|
|
- ],
|
|
|
- );
|
|
|
+ return buildSheetContentView();
|
|
|
},
|
|
|
)
|
|
|
],
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- Widget buildOperationBtn() {
|
|
|
- return Container(
|
|
|
- margin: EdgeInsets.only(bottom: 18.w, top: 9.w),
|
|
|
- child: Row(
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
- children: [
|
|
|
- Obx(() {
|
|
|
- return GestureDetector(
|
|
|
- onTap: controller.onTraceDetailClick,
|
|
|
- child: AnimatedOpacity(
|
|
|
- opacity: controller.currentIndex == 0 ? 1 : 0,
|
|
|
- duration: Duration(milliseconds: 250),
|
|
|
- child: AnimatedContainer(
|
|
|
- width: controller.currentIndex == 0 &&
|
|
|
- controller.isShowTraceDetailBtn
|
|
|
- ? 152.w
|
|
|
- : 0.w,
|
|
|
- height: 46.w,
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: '#147B7DFF'.color,
|
|
|
- border:
|
|
|
- Border.all(color: ColorName.colorPrimary, width: 1.w),
|
|
|
- borderRadius: BorderRadius.circular(46.w),
|
|
|
- ),
|
|
|
- duration: Duration(milliseconds: 250),
|
|
|
- child: Center(
|
|
|
- child: Text(
|
|
|
- maxLines: 1,
|
|
|
- StringName.traceDetail,
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 14.sp, color: ColorName.colorPrimary),
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- );
|
|
|
- }),
|
|
|
- Obx(() {
|
|
|
- double width = 152.w;
|
|
|
- if (controller.currentIndex == 1) {
|
|
|
- width = 322.w;
|
|
|
- } else if (controller.isShowTraceDetailBtn) {
|
|
|
- width = 152.w;
|
|
|
- } else {
|
|
|
- width = 322.w;
|
|
|
- }
|
|
|
- return GestureDetector(
|
|
|
- onTap: controller.onTrackQueryClick,
|
|
|
- child: AnimatedContainer(
|
|
|
- margin: EdgeInsets.only(
|
|
|
- left: controller.currentIndex == 0 &&
|
|
|
- controller.isShowTraceDetailBtn
|
|
|
- ? 18.w
|
|
|
- : 0),
|
|
|
- duration: Duration(milliseconds: 250),
|
|
|
- width: width,
|
|
|
- height: 46.w,
|
|
|
- decoration: getPrimaryBtnDecoration(46.w),
|
|
|
- child: Center(
|
|
|
- child: Obx(() {
|
|
|
- return Text(
|
|
|
- controller.currentIndex == 0
|
|
|
- ? StringName.trackQueryPath
|
|
|
- : StringName.trackNowLocation,
|
|
|
- style: TextStyle(fontSize: 14.sp, color: Colors.white),
|
|
|
+ Widget buildBackBtnView() {
|
|
|
+ return SafeArea(
|
|
|
+ child: GestureDetector(
|
|
|
+ onTap: controller.back,
|
|
|
+ child: Container(
|
|
|
+ margin: EdgeInsets.only(top: 14.w, left: 12.w),
|
|
|
+ decoration: BoxDecoration(boxShadow: [
|
|
|
+ BoxShadow(
|
|
|
+ color: Colors.black.withOpacity(0.05),
|
|
|
+ blurRadius: 10.w,
|
|
|
+ offset: Offset(0, 2.w),
|
|
|
+ ),
|
|
|
+ ]),
|
|
|
+ child: CommonView.getBackBtnView(),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ Widget buildSheetContentView() {
|
|
|
+ return SizedBox(
|
|
|
+ height: 0.77.sh,
|
|
|
+ width: double.infinity,
|
|
|
+ child: Obx(() {
|
|
|
+ return DefaultTabController(
|
|
|
+ length: controller.daysList.length,
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ SizedBox(
|
|
|
+ width: double.infinity,
|
|
|
+ child: TabBar(
|
|
|
+ tabAlignment: TabAlignment.start,
|
|
|
+ isScrollable: true,
|
|
|
+ dividerHeight: 0,
|
|
|
+ indicator: FixedSizeTabIndicator(
|
|
|
+ width: 26.w,
|
|
|
+ height: 3.w,
|
|
|
+ radius: 0,
|
|
|
+ color: ColorName.colorPrimary),
|
|
|
+ unselectedLabelStyle:
|
|
|
+ TextStyle(fontSize: 13.sp, color: '#666666'.color),
|
|
|
+ labelStyle: TextStyle(
|
|
|
+ fontSize: 13.sp,
|
|
|
+ color: '#333333'.color,
|
|
|
+ fontWeight: FontWeight.bold),
|
|
|
+ tabs: controller.daysList.map((e) {
|
|
|
+ return Tab(
|
|
|
+ text: e.day,
|
|
|
);
|
|
|
- }),
|
|
|
+ }).toList(),
|
|
|
),
|
|
|
),
|
|
|
- );
|
|
|
- })
|
|
|
- ],
|
|
|
- ),
|
|
|
+ Container(
|
|
|
+ color: '#EEEEEE'.color,
|
|
|
+ height: 1.w,
|
|
|
+ width: double.infinity,
|
|
|
+ ),
|
|
|
+ Expanded(
|
|
|
+ child: TabBarView(
|
|
|
+ children: List.generate(
|
|
|
+ controller.daysList.length,
|
|
|
+ (index) => TrackDayDetailView(controller.daysList[index],
|
|
|
+ isExpand: index == 0)),
|
|
|
+ )),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }),
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ Widget buildSheetHeadView() {
|
|
|
+ return IntrinsicHeight(
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ SizedBox(height: 5.w),
|
|
|
+ Align(
|
|
|
+ alignment: Alignment.center,
|
|
|
+ child: Container(
|
|
|
+ width: 32.w,
|
|
|
+ height: 3.w,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: '#D9D9D9'.color,
|
|
|
+ borderRadius: BorderRadius.circular(49.w),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ SizedBox(height: 25.w),
|
|
|
+ buildTrackHeaderView(),
|
|
|
+ SizedBox(height: 20.w),
|
|
|
+ ],
|
|
|
+ ));
|
|
|
+ }
|
|
|
+
|
|
|
Widget buildTrackHeaderView() {
|
|
|
return Row(
|
|
|
children: [
|
|
|
@@ -208,41 +187,11 @@ class TrackPage extends BasePage<TrackController> {
|
|
|
fontWeight: FontWeight.bold),
|
|
|
),
|
|
|
),
|
|
|
- buildOperationTabBar(),
|
|
|
SizedBox(width: 12.w),
|
|
|
],
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- Widget buildOperationTabBar() {
|
|
|
- return IntrinsicWidth(
|
|
|
- child: Container(
|
|
|
- padding: EdgeInsets.all(2.w),
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: '#F3F3F3'.color,
|
|
|
- borderRadius: BorderRadius.circular(48.w),
|
|
|
- ),
|
|
|
- height: 32.w,
|
|
|
- child: TabBar(
|
|
|
- controller: controller.tabController,
|
|
|
- indicator: BoxDecoration(
|
|
|
- color: ColorName.colorPrimary,
|
|
|
- borderRadius: BorderRadius.circular(48.w),
|
|
|
- ),
|
|
|
- dividerHeight: 0,
|
|
|
- indicatorSize: TabBarIndicatorSize.tab,
|
|
|
- unselectedLabelStyle:
|
|
|
- TextStyle(fontSize: 14.sp, color: '#666666'.color),
|
|
|
- labelStyle: TextStyle(fontSize: 14.sp, color: ColorName.white),
|
|
|
- tabs: [
|
|
|
- Tab(text: StringName.trackHistory),
|
|
|
- Tab(text: StringName.trackNowLocation)
|
|
|
- ],
|
|
|
- ),
|
|
|
- ),
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
Widget buildTrackHistoryContentView() {
|
|
|
return Column(
|
|
|
children: [
|