Browse Source

[new]增加提醒日日期选择

zk 3 months ago
parent
commit
97a7c33c23

BIN
assets/images/icon_common_point_add_arrow.webp


BIN
assets/images/icon_date_selected.webp


BIN
assets/images/icon_date_un_select.webp


+ 25 - 0
assets/string/base/string.xml

@@ -417,4 +417,29 @@
     <string name="common_point_setting_all_friends">收到【所有好友】进入常用点的消息</string>
     <string name="common_point_setting_some_good_friends">收到【部分好友】进入常用点的消息</string>
     <string name="common_point_setting_some_good_friends_desc">*您当前还没有添加好友哦</string>
+    <string name="common_point_setting_btn_add_txt">保存</string>
+    <string name="common_point_add_title">常用地点设置</string>
+    <string name="common_point_add_name">常用地名称</string>
+    <string name="common_point_add_name_hint">请输入常用地名称</string>
+    <string name="common_point_add_select_a_address">选取地址</string>
+    <string name="common_point_add_select_a_address_hint">+设置常用点地址</string>
+    <string name="common_point_add_repeat">*当前名称重复</string>
+    <string name="common_point_add_remind">提醒设置</string>
+    <string name="common_point_add_guard_time_period">守护时间段</string>
+    <string name="common_point_add_guard_time_period_hint">请选择守护时间段</string>
+    <string name="common_point_add_message_reminder">消息提醒</string>
+    <string name="common_point_add_message_reminder_hint">请选择提醒日</string>
+    <string name="common_point_select_time_start">开始时间</string>
+    <string name="common_point_select_time_end">结束时间</string>
+    <string name="dialog_confirm">确认</string>
+    <string name="dialog_must_than_start_date">结束时间必须大于开始时间</string>
+    <string name="select_message_reminder_date_title">消息提醒日期</string>
+    <string name="sunday">周日</string>
+    <string name="monday">周一</string>
+    <string name="tuesday">周二</string>
+    <string name="wednesday">周三</string>
+    <string name="thursday">周四</string>
+    <string name="friday">周五</string>
+    <string name="saturday">周六</string>
+    <string name="dialog_save">保存</string>
 </resources>

+ 3 - 0
lib/di/get_it.config.dart

@@ -30,6 +30,7 @@ import '../module/about/about_controller.dart' as _i256;
 import '../module/add_friend/add_friend_dialog_controller.dart' as _i897;
 import '../module/analyse/location_analyse_controller.dart' as _i783;
 import '../module/browser/browser_controller.dart' as _i923;
+import '../module/commonpoint/add/common_point_add_controller.dart' as _i696;
 import '../module/commonpoint/common_point_controller.dart' as _i625;
 import '../module/commonpoint/setting/common_point_setting_controller.dart'
     as _i644;
@@ -77,6 +78,8 @@ extension GetItInjectableX on _i174.GetIt {
     gh.factory<_i973.SplashController>(() => _i973.SplashController());
     gh.factory<_i756.TrackDetailController>(
         () => _i756.TrackDetailController());
+    gh.factory<_i696.CommonPointAddController>(
+        () => _i696.CommonPointAddController());
     gh.singleton<_i361.Dio>(() => networkModule.createDefaultDio());
     gh.lazySingleton<_i772.InternetConnectionHelper>(
         () => _i772.InternetConnectionHelper());

+ 220 - 0
lib/dialog/select_guard_time_dialog.dart

@@ -0,0 +1,220 @@
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_screenutil/flutter_screenutil.dart';
+import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
+import 'package:location/utils/common_expand.dart';
+import 'package:flutter_cupertino_datetime_picker/flutter_cupertino_datetime_picker.dart';
+import 'package:location/utils/toast_util.dart';
+import '../resource/colors.gen.dart';
+import '../resource/string.gen.dart';
+
+typedef DateSureCallback = void Function(DateTime startDate, DateTime endDate);
+
+class SelectGuardTimeDialog {
+  static const String _tag = 'SelectGuardTimeDialog';
+
+  static void show({
+    DateTime? startDate,
+    DateTime? endDate,
+    required DateSureCallback sureCallback,
+  }) {
+    SmartDialog.show(
+        tag: _tag,
+        animationType: SmartAnimationType.centerFade_otherSlide,
+        alignment: Alignment.bottomCenter,
+        keepSingle: true,
+        builder: (_) {
+          return _SelectGuardTimeView(startDate ?? DateTime.now(),
+              endDate ?? DateTime.now(), sureCallback);
+        });
+  }
+
+  static void hide() {
+    SmartDialog.dismiss(tag: _tag);
+  }
+}
+
+class _SelectGuardTimeView extends StatelessWidget {
+  DateTime startDate;
+  DateTime endDate;
+  final DateSureCallback sureCallback;
+
+  _SelectGuardTimeView(this.startDate, this.endDate, this.sureCallback);
+
+  @override
+  Widget build(BuildContext context) {
+    return IntrinsicHeight(
+      child: Container(
+        width: double.infinity,
+        decoration: BoxDecoration(
+            borderRadius: BorderRadius.only(
+                topLeft: Radius.circular(16.w),
+                topRight: Radius.circular(16.w)),
+            gradient: LinearGradient(
+                begin: Alignment.topCenter,
+                end: Alignment.bottomCenter,
+                colors: ['#E4E4FF'.color, ColorName.white],
+                stops: [0.0, 0.3])),
+        child: Column(
+          children: [
+            SizedBox(height: 24.w),
+            buildTimeHeaderView(),
+            SizedBox(height: 6.w),
+            buildSelectDateView(),
+            SizedBox(height: 6.w),
+            buildSelectBtnView(),
+            SizedBox(height: 12.w),
+          ],
+        ),
+      ),
+    );
+  }
+
+  Widget buildSelectBtnView() {
+    return Row(
+      children: [
+        SizedBox(width: 16.w),
+        Expanded(
+            child: GestureDetector(
+          onTap: () {
+            SelectGuardTimeDialog.hide();
+          },
+          child: Container(
+            height: 46.w,
+            decoration: BoxDecoration(
+                color: ColorName.colorPrimary.withOpacity(0.08),
+                borderRadius: BorderRadius.circular(100.w)),
+            child: Center(
+              child: Text(
+                StringName.dialogCancel,
+                style: TextStyle(
+                    fontSize: 14.sp,
+                    color: ColorName.colorPrimary,
+                    fontWeight: FontWeight.bold),
+              ),
+            ),
+          ),
+        )),
+        SizedBox(width: 12.w),
+        Expanded(
+            child: GestureDetector(
+          onTap: onSureClick,
+          child: Container(
+            height: 46.w,
+            decoration: BoxDecoration(
+                color: ColorName.colorPrimary,
+                borderRadius: BorderRadius.circular(100.w)),
+            child: Center(
+              child: Text(
+                StringName.dialogConfirm,
+                style: TextStyle(
+                    fontSize: 14.sp,
+                    color: ColorName.white,
+                    fontWeight: FontWeight.bold),
+              ),
+            ),
+          ),
+        )),
+        SizedBox(width: 16.w),
+      ],
+    );
+  }
+
+  onSureClick() {
+    //endDate 必须要大于 startDate
+    if (endDate.isBefore(startDate)) {
+      ToastUtil.show(StringName.dialogMustThanStartDate);
+      return;
+    }
+    SelectGuardTimeDialog.hide();
+    sureCallback.call(startDate, endDate);
+  }
+
+  Widget buildSelectDateView() {
+    return Stack(
+      alignment: Alignment.center,
+      children: [
+        Container(
+          width: 336.w,
+          height: 48.w,
+          decoration: BoxDecoration(
+              color: '#F6F6F8'.color,
+              borderRadius: BorderRadius.all(Radius.circular(14.w))),
+          child: Center(
+            child: Text('-',
+                style: TextStyle(fontSize: 14.sp, color: ColorName.black90)),
+          ),
+        ),
+        Row(
+          children: [
+            SizedBox(width: 18.w),
+            Expanded(
+                child: DateTimePickerWidget(
+              initDateTime: startDate,
+              onChange: (dateTime, _) {
+                startDate = dateTime;
+              },
+              dateFormat: 'HH时  mm分',
+              locale: DateTimePickerLocale.zh_cn,
+              pickerTheme: DateTimePickerTheme(
+                  itemHeight: 48.w,
+                  pickerHeight: 250.w,
+                  itemTextStyle: TextStyle(
+                      fontSize: 16.sp,
+                      color: ColorName.black90,
+                      fontWeight: FontWeight.normal),
+                  backgroundColor: ColorName.transparent,
+                  showTitle: false,
+                  selectionOverlay: SizedBox.shrink()),
+            )),
+            SizedBox(width: 18.w),
+            Expanded(
+                child: DateTimePickerWidget(
+              initDateTime: endDate,
+              onChange: (dateTime, _) {
+                endDate = dateTime;
+              },
+              dateFormat: 'HH时  mm分',
+              locale: DateTimePickerLocale.zh_cn,
+              pickerTheme: DateTimePickerTheme(
+                  itemHeight: 48.w,
+                  pickerHeight: 250.w,
+                  itemTextStyle: TextStyle(
+                      fontSize: 16.sp,
+                      color: ColorName.black90,
+                      fontWeight: FontWeight.normal),
+                  backgroundColor: ColorName.transparent,
+                  showTitle: false,
+                  selectionOverlay: SizedBox.shrink()),
+            )),
+            SizedBox(width: 18.w),
+          ],
+        ),
+      ],
+    );
+  }
+
+  Widget buildTimeHeaderView() {
+    return Row(
+      children: [
+        Expanded(
+          child: Center(
+            child: Text(
+              StringName.commonPointSelectTimeStart,
+              style: TextStyle(fontSize: 14.sp, color: ColorName.black60),
+            ),
+          ),
+        ),
+        Text('-', style: TextStyle(fontSize: 14.sp, color: ColorName.black30)),
+        Expanded(
+          child: Center(
+            child: Text(
+              StringName.commonPointSelectTimeEnd,
+              style: TextStyle(fontSize: 14.sp, color: ColorName.black60),
+            ),
+          ),
+        ),
+      ],
+    );
+  }
+}

+ 170 - 0
lib/dialog/select_message_reminder_date_dialog.dart

@@ -0,0 +1,170 @@
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_screenutil/flutter_screenutil.dart';
+import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
+import 'package:location/resource/assets.gen.dart';
+import 'package:location/resource/string.gen.dart';
+import 'package:location/utils/common_expand.dart';
+
+import '../resource/colors.gen.dart';
+
+class SelectMessageReminderDateDialog {
+  static const String _tag = 'SelectMessageReminderDateDialog';
+
+  static void show() {
+    SmartDialog.show(
+        tag: _tag,
+        animationType: SmartAnimationType.centerFade_otherSlide,
+        alignment: Alignment.bottomCenter,
+        keepSingle: true,
+        builder: (_) {
+          return SelectMessageReminderDateView();
+        });
+  }
+
+  static void hide() {
+    SmartDialog.dismiss(tag: _tag);
+  }
+}
+
+class SelectMessageReminderDateView extends StatelessWidget {
+  const SelectMessageReminderDateView({super.key});
+
+  @override
+  Widget build(BuildContext context) {
+    return IntrinsicHeight(
+      child: Container(
+        padding: EdgeInsets.all(16.w),
+        margin: EdgeInsets.all(12.w),
+        width: double.infinity,
+        decoration: BoxDecoration(
+            borderRadius: BorderRadius.circular(16.r),
+            gradient: LinearGradient(
+                begin: Alignment.topCenter,
+                end: Alignment.bottomCenter,
+                colors: ['#E4E4FF'.color, ColorName.white],
+                stops: [0.0, 0.3])),
+        child: Column(
+          crossAxisAlignment: CrossAxisAlignment.start,
+          children: [
+            Text(StringName.selectMessageReminderDateTitle,
+                style: TextStyle(
+                    fontSize: 16.sp,
+                    color: ColorName.black90,
+                    fontWeight: FontWeight.bold)),
+            SizedBox(height: 12.w),
+            buildDateView(),
+            SizedBox(height: 12.w),
+            buildSelectBtnView(),
+          ],
+        ),
+      ),
+    );
+  }
+
+  Widget buildDateView() {
+    return WeekdaySelector();
+  }
+
+  Widget buildSelectBtnView() {
+    return Row(
+      children: [
+        Expanded(
+            child: GestureDetector(
+          onTap: () {
+            SelectMessageReminderDateDialog.hide();
+          },
+          child: Container(
+            height: 46.w,
+            decoration: BoxDecoration(
+                color: ColorName.colorPrimary.withOpacity(0.08),
+                borderRadius: BorderRadius.circular(100.w)),
+            child: Center(
+              child: Text(
+                StringName.dialogCancel,
+                style: TextStyle(
+                    fontSize: 14.sp,
+                    color: ColorName.colorPrimary,
+                    fontWeight: FontWeight.bold),
+              ),
+            ),
+          ),
+        )),
+        SizedBox(width: 12.w),
+        Expanded(
+            child: GestureDetector(
+          onTap: onSureClick,
+          child: Container(
+            height: 46.w,
+            decoration: BoxDecoration(
+                color: ColorName.colorPrimary,
+                borderRadius: BorderRadius.circular(100.w)),
+            child: Center(
+              child: Text(
+                StringName.dialogSave,
+                style: TextStyle(
+                    fontSize: 14.sp,
+                    color: ColorName.white,
+                    fontWeight: FontWeight.bold),
+              ),
+            ),
+          ),
+        )),
+      ],
+    );
+  }
+
+  void onSureClick() {}
+}
+
+class WeekdaySelector extends StatefulWidget {
+  @override
+  _WeekdaySelectorState createState() => _WeekdaySelectorState();
+}
+
+class _WeekdaySelectorState extends State<WeekdaySelector> {
+  final List<String> days = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
+  List<bool> selected = List.filled(7, false); // 保存勾选状态
+
+  @override
+  Widget build(BuildContext context) {
+    return Column(
+      children: List.generate(days.length, (index) {
+        return Column(
+          children: [
+            GestureDetector(
+              behavior: HitTestBehavior.translucent,
+              onTap: () {
+                setState(() {
+                  selected[index] = !selected[index];
+                });
+              },
+              child: Container(
+                padding: EdgeInsets.symmetric(vertical: 12.w),
+                child: Row(
+                  children: [
+                    Text(days[index],
+                        style: TextStyle(
+                            fontSize: 14.sp, color: ColorName.black60)),
+                    Spacer(),
+                    if (selected[index])
+                      Assets.images.iconDateSelected
+                          .image(width: 18.w, height: 18.w)
+                    else
+                      Assets.images.iconDateUnSelect
+                          .image(width: 18.w, height: 18.w)
+                  ],
+                ),
+              ),
+            ),
+            if (index != days.length - 1)
+              Container(
+                  height: 0.5.w,
+                  width: double.infinity,
+                  color: '#14000000'.color)
+          ],
+        );
+      }),
+    );
+  }
+}

+ 44 - 0
lib/module/commonpoint/add/common_point_add_controller.dart

@@ -0,0 +1,44 @@
+import 'package:flutter/cupertino.dart';
+import 'package:get/get.dart';
+import 'package:get/get_core/src/get_main.dart';
+import 'package:injectable/injectable.dart';
+import 'package:location/base/base_controller.dart';
+import 'package:location/dialog/select_message_reminder_date_dialog.dart';
+import '../../../dialog/select_guard_time_dialog.dart';
+
+@injectable
+class CommonPointAddController extends BaseController {
+  final TextEditingController titleController = TextEditingController();
+  final RxBool _isShowDuplicateName = RxBool(true);
+
+  bool get isShowDuplicateName => _isShowDuplicateName.value;
+
+  final RxnString _guardTimePeriod = RxnString();
+
+  String? get guardTimePeriod => _guardTimePeriod.value;
+
+  DateTime? guardStartTime;
+  DateTime? guardEndTime;
+
+  void onBack() {
+    Get.back();
+  }
+
+  void onGuardTimePeriodClick() {
+    hideKeyboard(Get.context!);
+    SelectGuardTimeDialog.show(
+        startDate: guardStartTime,
+        endDate: guardEndTime,
+        sureCallback: (DateTime startDate, DateTime endDate) {
+          guardStartTime = startDate;
+          guardEndTime = endDate;
+          _guardTimePeriod.value =
+              '${startDate.hour.toString().padLeft(2, '0')}:${startDate.minute.toString().padLeft(2, '0')}-${endDate.hour.toString().padLeft(2, '0')}:${endDate.minute.toString().padLeft(2, '0')}';
+        });
+  }
+
+  void onSelectMessageReminderClick() {
+    hideKeyboard(Get.context!);
+    SelectMessageReminderDateDialog.show();
+  }
+}

+ 248 - 0
lib/module/commonpoint/add/common_point_add_page.dart

@@ -0,0 +1,248 @@
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter/src/widgets/framework.dart';
+import 'package:flutter_screenutil/flutter_screenutil.dart';
+import 'package:get/get.dart';
+import 'package:get/get_core/src/get_main.dart';
+import 'package:location/base/base_page.dart';
+import 'package:location/resource/colors.gen.dart';
+import 'package:location/utils/common_expand.dart';
+
+import '../../../resource/assets.gen.dart';
+import '../../../resource/string.gen.dart';
+import '../../../router/app_pages.dart';
+import '../../../utils/common_style.dart';
+import '../../../widget/common_view.dart';
+import 'common_point_add_controller.dart';
+
+class CommonPointAddPage extends BasePage<CommonPointAddController> {
+  const CommonPointAddPage({super.key});
+
+  static void start() {
+    Get.toNamed(RoutePath.commonPointAdd);
+  }
+
+  @override
+  bool immersive() {
+    return true;
+  }
+
+  @override
+  Color backgroundColor() {
+    return '#F6F6F6'.color;
+  }
+
+  @override
+  Widget buildBody(BuildContext context) {
+    return Stack(
+      children: [
+        Assets.images.bgPageBackground.image(width: double.infinity),
+        SafeArea(
+          child: Column(
+            children: [
+              buildHeaderView(),
+              Expanded(child: buildContentView()),
+              buildBottomView()
+            ],
+          ),
+        ),
+      ],
+    );
+  }
+
+  Widget buildHeaderView() {
+    return CommonView.buildAppBar(StringName.commonPointAdd,
+        backOnTap: controller.onBack);
+  }
+
+  Widget buildContentView() {
+    return Column(
+      children: [
+        buildCommonPointAddressSettingView(),
+        buildCommonPointRemindSettingView()
+      ],
+    );
+  }
+
+  Widget buildCommonPointRemindSettingView() {
+    return Container(
+      width: 336.w,
+      margin: EdgeInsets.only(bottom: 12.w),
+      padding: EdgeInsets.symmetric(horizontal: 12.w),
+      decoration: BoxDecoration(
+        color: ColorName.white,
+        borderRadius: BorderRadius.circular(12.r),
+      ),
+      child: Column(
+        crossAxisAlignment: CrossAxisAlignment.start,
+        children: [
+          SizedBox(height: 16.w),
+          Text(
+            StringName.commonPointAddRemind,
+            style: TextStyle(
+                fontSize: 14.sp,
+                color: ColorName.black90,
+                fontWeight: FontWeight.bold),
+          ),
+          SizedBox(height: 6.w),
+          buildAddItem(StringName.commonPointAddGuardTimePeriod,
+              contentWidget: Obx(() {
+            return Text(
+              controller.guardTimePeriod == null
+                  ? StringName.commonPointAddGuardTimePeriodHint
+                  : controller.guardTimePeriod!,
+              style: TextStyle(
+                  fontSize: 13.sp,
+                  color: controller.guardTimePeriod == null
+                      ? ColorName.black30
+                      : ColorName.black60),
+            );
+          }), onClick: controller.onGuardTimePeriodClick),
+          buildAddItem(StringName.commonPointAddMessageReminder,
+              contentWidget: Text(
+                StringName.commonPointAddMessageReminderHint,
+                style: TextStyle(fontSize: 13.sp, color: ColorName.black30),
+              ),
+              isShowBottomLine: false,
+              onClick: controller.onSelectMessageReminderClick),
+        ],
+      ),
+    );
+  }
+
+  Widget buildCommonPointAddressSettingView() {
+    return Container(
+      width: 336.w,
+      margin: EdgeInsets.only(bottom: 12.w),
+      padding: EdgeInsets.symmetric(horizontal: 12.w),
+      decoration: BoxDecoration(
+        color: ColorName.white,
+        borderRadius: BorderRadius.circular(12.r),
+      ),
+      child: Column(
+        crossAxisAlignment: CrossAxisAlignment.start,
+        children: [
+          SizedBox(height: 16.w),
+          Text(
+            StringName.commonPointAddTitle,
+            style: TextStyle(
+                fontSize: 14.sp,
+                color: ColorName.black90,
+                fontWeight: FontWeight.bold),
+          ),
+          SizedBox(height: 6.w),
+          buildAddItem(StringName.commonPointAddName,
+              contentWidget: TextField(
+                controller: controller.titleController,
+                style: TextStyle(fontSize: 14.sp, color: '#99000000'.color),
+                maxLines: 1,
+                maxLength: 30,
+                keyboardType: TextInputType.text,
+                textAlignVertical: TextAlignVertical.center,
+                textInputAction: TextInputAction.next,
+                decoration: InputDecoration(
+                  hintText: StringName.commonPointAddNameHint,
+                  counterText: '',
+                  hintStyle:
+                      TextStyle(fontSize: 13.sp, color: "#4D000000".toColor()),
+                  labelStyle: TextStyle(
+                    fontSize: 13.sp,
+                    color: ColorName.primaryTextColor,
+                  ),
+                  contentPadding: EdgeInsets.only(right: 10.w),
+                  border: const OutlineInputBorder(borderSide: BorderSide.none),
+                ),
+              ), titleDescWidget: Obx(() {
+            if (controller.isShowDuplicateName) {
+              return Text(
+                StringName.commonPointAddRepeat,
+                style: TextStyle(fontSize: 10.sp, color: '#FF7272'.color),
+              );
+            } else {
+              return SizedBox.shrink();
+            }
+          }), isShowArrow: false),
+          buildAddItem(StringName.commonPointAddSelectAAddress,
+              contentWidget: Text(
+                StringName.commonPointAddSelectAAddressHint,
+                style:
+                    TextStyle(fontSize: 13.sp, color: ColorName.colorPrimary),
+              ),
+              isShowBottomLine: false),
+        ],
+      ),
+    );
+  }
+
+  Widget buildAddItem(String title,
+      {required Widget contentWidget,
+      Widget? titleDescWidget,
+      bool isShowArrow = true,
+      bool isShowBottomLine = true,
+      VoidCallback? onClick}) {
+    return SizedBox(
+      height: 52.w,
+      child: Row(
+        children: [
+          SizedBox(
+              width: 85.w,
+              child: Column(
+                crossAxisAlignment: CrossAxisAlignment.start,
+                mainAxisAlignment: MainAxisAlignment.center,
+                children: [
+                  Text(title,
+                      style:
+                          TextStyle(fontSize: 14.sp, color: ColorName.black90)),
+                  if (titleDescWidget != null) titleDescWidget
+                ],
+              )),
+          Expanded(
+            child: GestureDetector(
+              behavior: HitTestBehavior.translucent,
+              onTap: onClick,
+              child: Row(
+                children: [
+                  Expanded(
+                      child: Column(
+                    children: [
+                      Expanded(
+                          child: Container(
+                              margin: EdgeInsets.only(right: 16.w),
+                              child: Align(
+                                alignment: Alignment.centerLeft,
+                                child: contentWidget,
+                              ))),
+                      if (isShowBottomLine)
+                        Container(
+                            width: double.infinity,
+                            height: 0.5.w,
+                            color: '#14000000'.color)
+                    ],
+                  )),
+                  if (isShowArrow)
+                    Assets.images.iconCommonPointAddArrow
+                        .image(width: 10.w, height: 10.w)
+                ],
+              ),
+            ),
+          )
+        ],
+      ),
+    );
+  }
+
+  Widget buildBottomView() {
+    return Container(
+      width: 330.w,
+      height: 46.w,
+      decoration: getPrimaryBtnDecoration(10.r),
+      margin: EdgeInsets.symmetric(vertical: 12.w),
+      child: Center(
+        child: Text(
+          StringName.commonPointSettingBtnAddTxt,
+          style: TextStyle(fontSize: 14.sp, color: ColorName.white),
+        ),
+      ),
+    );
+  }
+}

+ 5 - 0
lib/module/commonpoint/common_point_controller.dart

@@ -4,6 +4,7 @@ import 'package:injectable/injectable.dart';
 import 'package:location/base/base_controller.dart';
 import 'package:location/data/bean/common_point_bean.dart';
 import 'package:location/handler/error_handler.dart';
+import 'package:location/module/commonpoint/add/common_point_add_page.dart';
 import 'package:location/module/commonpoint/setting/common_point_setting_page.dart';
 
 import '../../data/repositories/range_point_repository.dart';
@@ -67,4 +68,8 @@ class CommonPointController extends BaseController {
   void onSettingClick() {
     CommonPointSettingPage.start();
   }
+
+  void onAddCommonPointClick() {
+    CommonPointAddPage.start();
+  }
 }

+ 35 - 27
lib/module/commonpoint/common_point_page.dart

@@ -87,20 +87,24 @@ class CommonPointPage extends BasePage<CommonPointController> {
                   buildCommonPointListItem(controller.commonPointList[index]),
               itemCount: controller.commonPointList.length),
         ),
-        Container(
-          margin:
-              EdgeInsets.only(top: 15.w, left: 15.w, right: 15.w, bottom: 12.w),
-          decoration: getPrimaryBtnDecoration(10.r),
-          width: double.infinity,
-          height: 46.w,
-          child: Row(
-            mainAxisAlignment: MainAxisAlignment.center,
-            children: [
-              Assets.images.iconCommonPointAdd.image(width: 14.w, height: 14.w),
-              SizedBox(width: 2.w),
-              Text(StringName.commonPointAdd,
-                  style: TextStyle(fontSize: 14.sp, color: ColorName.white))
-            ],
+        GestureDetector(
+          onTap: controller.onAddCommonPointClick,
+          child: Container(
+            margin: EdgeInsets.only(
+                top: 15.w, left: 15.w, right: 15.w, bottom: 12.w),
+            decoration: getPrimaryBtnDecoration(10.r),
+            width: double.infinity,
+            height: 46.w,
+            child: Row(
+              mainAxisAlignment: MainAxisAlignment.center,
+              children: [
+                Assets.images.iconCommonPointAdd
+                    .image(width: 14.w, height: 14.w),
+                SizedBox(width: 2.w),
+                Text(StringName.commonPointAdd,
+                    style: TextStyle(fontSize: 14.sp, color: ColorName.white))
+              ],
+            ),
           ),
         )
       ],
@@ -117,19 +121,23 @@ class CommonPointPage extends BasePage<CommonPointController> {
             Text(StringName.commonPointNoData,
                 style: TextStyle(fontSize: 13.sp, color: ColorName.black60)),
             SizedBox(height: 36.w),
-            Container(
-              decoration: getPrimaryBtnDecoration(10.r),
-              width: 136.w,
-              height: 46.w,
-              child: Row(
-                mainAxisAlignment: MainAxisAlignment.center,
-                children: [
-                  Assets.images.iconCommonPointAdd
-                      .image(width: 14.w, height: 14.w),
-                  SizedBox(width: 2.w),
-                  Text(StringName.commonPointAdd,
-                      style: TextStyle(fontSize: 14.sp, color: ColorName.white))
-                ],
+            GestureDetector(
+              onTap: controller.onAddCommonPointClick,
+              child: Container(
+                decoration: getPrimaryBtnDecoration(10.r),
+                width: 136.w,
+                height: 46.w,
+                child: Row(
+                  mainAxisAlignment: MainAxisAlignment.center,
+                  children: [
+                    Assets.images.iconCommonPointAdd
+                        .image(width: 14.w, height: 14.w),
+                    SizedBox(width: 2.w),
+                    Text(StringName.commonPointAdd,
+                        style:
+                            TextStyle(fontSize: 14.sp, color: ColorName.white))
+                  ],
+                ),
               ),
             )
           ],

+ 15 - 0
lib/resource/assets.gen.dart

@@ -187,6 +187,10 @@ class $AssetsImagesGen {
   AssetGenImage get iconCommonPointAdd =>
       const AssetGenImage('assets/images/icon_common_point_add.webp');
 
+  /// File path: assets/images/icon_common_point_add_arrow.webp
+  AssetGenImage get iconCommonPointAddArrow =>
+      const AssetGenImage('assets/images/icon_common_point_add_arrow.webp');
+
   /// File path: assets/images/icon_common_point_ai_summary.webp
   AssetGenImage get iconCommonPointAiSummary =>
       const AssetGenImage('assets/images/icon_common_point_ai_summary.webp');
@@ -195,6 +199,14 @@ class $AssetsImagesGen {
   AssetGenImage get iconCommonPointNoData =>
       const AssetGenImage('assets/images/icon_common_point_no_data.webp');
 
+  /// File path: assets/images/icon_date_selected.webp
+  AssetGenImage get iconDateSelected =>
+      const AssetGenImage('assets/images/icon_date_selected.webp');
+
+  /// File path: assets/images/icon_date_un_select.webp
+  AssetGenImage get iconDateUnSelect =>
+      const AssetGenImage('assets/images/icon_date_un_select.webp');
+
   /// File path: assets/images/icon_default_friend_avatar.webp
   AssetGenImage get iconDefaultFriendAvatar =>
       const AssetGenImage('assets/images/icon_default_friend_avatar.webp');
@@ -826,8 +838,11 @@ class $AssetsImagesGen {
         iconCheckboxSelected,
         iconCheckboxUnSelect,
         iconCommonPointAdd,
+        iconCommonPointAddArrow,
         iconCommonPointAiSummary,
         iconCommonPointNoData,
+        iconDateSelected,
+        iconDateUnSelect,
         iconDefaultFriendAvatar,
         iconDefaultMineAvatar,
         iconDialogAddFriend,

+ 65 - 0
lib/resource/string.gen.dart

@@ -343,6 +343,46 @@ class StringName {
   static String get commonPointSettingAllFriends => 'common_point_setting_all_friends'.tr; // 收到【所有好友】进入常用点的消息
   static String get commonPointSettingSomeGoodFriends => 'common_point_setting_some_good_friends'.tr; // 收到【部分好友】进入常用点的消息
   static String get commonPointSettingSomeGoodFriendsDesc => 'common_point_setting_some_good_friends_desc'.tr; // *您当前还没有添加好友哦
+  static String get commonPointSettingBtnAddTxt =>
+      'common_point_setting_btn_add_txt'.tr; // 保存
+  static String get commonPointAddTitle =>
+      'common_point_add_title'.tr; // 常用地点设置
+  static String get commonPointAddName => 'common_point_add_name'.tr; // 常用地名称
+  static String get commonPointAddNameHint =>
+      'common_point_add_name_hint'.tr; // 请输入常用地名称
+  static String get commonPointAddSelectAAddress =>
+      'common_point_add_select_a_address'.tr; // 选取地址
+  static String get commonPointAddSelectAAddressHint =>
+      'common_point_add_select_a_address_hint'.tr; // +设置常用点地址
+  static String get commonPointAddRepeat =>
+      'common_point_add_repeat'.tr; // *当前名称重复
+  static String get commonPointAddRemind =>
+      'common_point_add_remind'.tr; // 提醒设置
+  static String get commonPointAddGuardTimePeriod =>
+      'common_point_add_guard_time_period'.tr; // 守护时间段
+  static String get commonPointAddGuardTimePeriodHint =>
+      'common_point_add_guard_time_period_hint'.tr; // 请选择守护时间段
+  static String get commonPointAddMessageReminder =>
+      'common_point_add_message_reminder'.tr; // 消息提醒
+  static String get commonPointAddMessageReminderHint =>
+      'common_point_add_message_reminder_hint'.tr; // 请选择提醒日
+  static String get commonPointSelectTimeStart =>
+      'common_point_select_time_start'.tr; // 开始时间
+  static String get commonPointSelectTimeEnd =>
+      'common_point_select_time_end'.tr; // 结束时间
+  static String get dialogConfirm => 'dialog_confirm'.tr; // 确认
+  static String get dialogMustThanStartDate =>
+      'dialog_must_than_start_date'.tr; // 结束时间必须大于开始时间
+  static String get selectMessageReminderDateTitle =>
+      'select_message_reminder_date_title'.tr; // 消息提醒日期
+  static String get sunday => 'sunday'.tr; // 周日
+  static String get monday => 'monday'.tr; // 周一
+  static String get tuesday => 'tuesday'.tr; // 周二
+  static String get wednesday => 'wednesday'.tr; // 周三
+  static String get thursday => 'thursday'.tr; // 周四
+  static String get friday => 'friday'.tr; // 周五
+  static String get saturday => 'saturday'.tr; // 周六
+  static String get dialogSave => 'dialog_save'.tr; // 保存
 }
 class StringMultiSource {
   StringMultiSource._();
@@ -689,6 +729,31 @@ class StringMultiSource {
       'common_point_setting_all_friends': '收到【所有好友】进入常用点的消息',
       'common_point_setting_some_good_friends': '收到【部分好友】进入常用点的消息',
       'common_point_setting_some_good_friends_desc': '*您当前还没有添加好友哦',
+      'common_point_setting_btn_add_txt': '保存',
+      'common_point_add_title': '常用地点设置',
+      'common_point_add_name': '常用地名称',
+      'common_point_add_name_hint': '请输入常用地名称',
+      'common_point_add_select_a_address': '选取地址',
+      'common_point_add_select_a_address_hint': '+设置常用点地址',
+      'common_point_add_repeat': '*当前名称重复',
+      'common_point_add_remind': '提醒设置',
+      'common_point_add_guard_time_period': '守护时间段',
+      'common_point_add_guard_time_period_hint': '请选择守护时间段',
+      'common_point_add_message_reminder': '消息提醒',
+      'common_point_add_message_reminder_hint': '请选择提醒日',
+      'common_point_select_time_start': '开始时间',
+      'common_point_select_time_end': '结束时间',
+      'dialog_confirm': '确认',
+      'dialog_must_than_start_date': '结束时间必须大于开始时间',
+      'select_message_reminder_date_title': '消息提醒日期',
+      'sunday': '周日',
+      'monday': '周一',
+      'tuesday': '周二',
+      'wednesday': '周三',
+      'thursday': '周四',
+      'friday': '周五',
+      'saturday': '周六',
+      'dialog_save': '保存',
     },
   };
 }

+ 5 - 0
lib/router/app_pages.dart

@@ -5,6 +5,8 @@ import 'package:location/module/about/about_page.dart';
 import 'package:location/module/analyse/location_analyse_page.dart';
 import 'package:location/module/browser/browser_controller.dart';
 import 'package:location/module/browser/browser_view.dart';
+import 'package:location/module/commonpoint/add/common_point_add_controller.dart';
+import 'package:location/module/commonpoint/add/common_point_add_page.dart';
 import 'package:location/module/commonpoint/common_point_controller.dart';
 import 'package:location/module/commonpoint/common_point_page.dart';
 import 'package:location/module/commonpoint/setting/common_point_setting_controller.dart';
@@ -71,6 +73,7 @@ abstract class RoutePath {
   static const locationAnalyse = '/locationAnalyse';
   static const commonPoint = '/commonPoint';
   static const commonPointSetting = '/commonPointSetting';
+  static const commonPointAdd = '/commonPointAdd';
 }
 
 class AppBinding extends Bindings {
@@ -98,6 +101,7 @@ class AppBinding extends Bindings {
     lazyPut(() => getIt.get<MemberActivityController>());
     lazyPut(() => getIt.get<CommonPointController>());
     lazyPut(() => getIt.get<CommonPointSettingController>());
+    lazyPut(() => getIt.get<CommonPointAddController>());
   }
 
   void lazyPut<S>(InstanceBuilderCallback<S> builder) {
@@ -129,4 +133,5 @@ final generalPages = [
   GetPage(name: RoutePath.commonPoint, page: () => CommonPointPage()),
   GetPage(
       name: RoutePath.commonPointSetting, page: () => CommonPointSettingPage()),
+  GetPage(name: RoutePath.commonPointAdd, page: () => CommonPointAddPage()),
 ];