|
|
@@ -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),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+}
|