|
|
@@ -0,0 +1,266 @@
|
|
|
+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/data/bean/contact_info.dart';
|
|
|
+import 'package:location/module/urgent_contact/urgent_contact_controller.dart';
|
|
|
+import 'package:location/resource/assets.gen.dart';
|
|
|
+import 'package:location/utils/common_expand.dart';
|
|
|
+import 'package:location/widget/common_view.dart';
|
|
|
+import '../../resource/colors.gen.dart';
|
|
|
+import '../../resource/string.gen.dart';
|
|
|
+import '../../router/app_pages.dart';
|
|
|
+
|
|
|
+class UrgentContactPage extends BasePage<UrgentContactController> {
|
|
|
+ const UrgentContactPage({super.key});
|
|
|
+
|
|
|
+ static void start() {
|
|
|
+ Get.toNamed(RoutePath.urgentContact);
|
|
|
+ }
|
|
|
+
|
|
|
+ @override
|
|
|
+ bool immersive() {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ @override
|
|
|
+ Widget buildBody(BuildContext context) {
|
|
|
+ return Obx(() {
|
|
|
+ if (controller.isLoaded) {
|
|
|
+ return urgentPageView();
|
|
|
+ }
|
|
|
+ return SizedBox.shrink();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ Widget urgentPageView() {
|
|
|
+ if (controller.contactList.isEmpty) {
|
|
|
+ return urgentEmptyView();
|
|
|
+ } else {
|
|
|
+ return urgentListView();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Widget urgentListView() {
|
|
|
+ return Container(
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ gradient: LinearGradient(
|
|
|
+ colors: [ColorName.white, '#F7F7F7'.color, '#F7F7F7'.color],
|
|
|
+ begin: Alignment.topCenter,
|
|
|
+ end: Alignment.bottomCenter),
|
|
|
+ ),
|
|
|
+ child: Stack(
|
|
|
+ children: [
|
|
|
+ Assets.images.bgPageBackground.image(width: 1.sw),
|
|
|
+ Positioned(
|
|
|
+ top: 0,
|
|
|
+ right: 35.w,
|
|
|
+ child: SafeArea(
|
|
|
+ child: Assets.images.bgUrgentContactLogo
|
|
|
+ .image(width: 145.w, height: 145.w)),
|
|
|
+ ),
|
|
|
+ SafeArea(
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ CommonView.buildAppBar("", backOnTap: controller.back),
|
|
|
+ Expanded(
|
|
|
+ child: ListView(
|
|
|
+ children: [
|
|
|
+ SizedBox(height: 25.h),
|
|
|
+ buildAddContact(),
|
|
|
+ SizedBox(height: 20.w),
|
|
|
+ Padding(
|
|
|
+ padding: EdgeInsets.only(left: 17.w),
|
|
|
+ child: Text(
|
|
|
+ StringName.urgentContactSubtitle,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 16.sp,
|
|
|
+ color: ColorName.black90,
|
|
|
+ fontWeight: FontWeight.bold),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ SizedBox(height: 14.w),
|
|
|
+ ...controller.contactList.map((e) => buildContactItem(e))
|
|
|
+ ],
|
|
|
+ )),
|
|
|
+ Container(
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: ColorName.white,
|
|
|
+ boxShadow: [
|
|
|
+ BoxShadow(
|
|
|
+ color: ColorName.black.withOpacity(0.1),
|
|
|
+ offset: Offset(20, 20),
|
|
|
+ blurRadius: 10)
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ child: Container(
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: '#FF5555'.color,
|
|
|
+ borderRadius: BorderRadius.circular(10.w),
|
|
|
+ ),
|
|
|
+ height: 46.w,
|
|
|
+ width: 330.w,
|
|
|
+ margin: EdgeInsets.only(top: 10.w, bottom: 15.w),
|
|
|
+ child: Center(
|
|
|
+ child: Text(StringName.urgentContactSendHelp,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 14.sp, color: ColorName.white)),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ Widget buildContactItem(ContactInfo e) {
|
|
|
+ return Container(
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: ColorName.white,
|
|
|
+ borderRadius: BorderRadius.circular(11.w),
|
|
|
+ boxShadow: [
|
|
|
+ BoxShadow(
|
|
|
+ color: ColorName.black.withOpacity(0.03),
|
|
|
+ offset: Offset(2, 2),
|
|
|
+ blurRadius: 2)
|
|
|
+ ]),
|
|
|
+ margin: EdgeInsets.only(left: 12.w, right: 12.w, bottom: 10.w),
|
|
|
+ padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 16.w),
|
|
|
+ child: Row(
|
|
|
+ children: [
|
|
|
+ Assets.images.iconDefaultFriendAvatar
|
|
|
+ .image(width: 48.w, height: 48.w),
|
|
|
+ SizedBox(width: 8.w),
|
|
|
+ Text(e.remark ?? e.phone,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 14.sp,
|
|
|
+ color: ColorName.black90,
|
|
|
+ fontWeight: FontWeight.bold)),
|
|
|
+ SizedBox(width: 8.w),
|
|
|
+ Visibility(
|
|
|
+ visible: e.favor == true,
|
|
|
+ child: Container(
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: '#1F969696'.color,
|
|
|
+ borderRadius: BorderRadius.circular(4.w)),
|
|
|
+ padding: EdgeInsets.symmetric(horizontal: 9.w, vertical: 3.w),
|
|
|
+ child: Text(StringName.urgentContactDefaultSelected,
|
|
|
+ style: TextStyle(fontSize: 12.sp, color: '#858585'.color))),
|
|
|
+ ),
|
|
|
+ Spacer(),
|
|
|
+ Assets.images.iconUrgentContactDialPhone
|
|
|
+ .image(width: 40.w, height: 40.w),
|
|
|
+ SizedBox(width: 16.w),
|
|
|
+ Assets.images.iconUrgentContactMore.image(width: 24.w, height: 24.w)
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ Widget urgentEmptyView() {
|
|
|
+ return SafeArea(
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ CommonView.buildAppBar(StringName.urgentContactTitle,
|
|
|
+ backOnTap: controller.back),
|
|
|
+ SizedBox(height: 40.h),
|
|
|
+ Assets.images.bgUrgentContactLogo.image(width: 268.w, height: 234.w),
|
|
|
+ SizedBox(height: 37.h),
|
|
|
+ Text(StringName.urgentContactOnceClickHelp,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 18.sp,
|
|
|
+ color: '#FF4B34'.color,
|
|
|
+ fontWeight: FontWeight.bold)),
|
|
|
+ SizedBox(height: 21.h),
|
|
|
+ SizedBox(
|
|
|
+ width: 261.w,
|
|
|
+ child: Text(StringName.urgentContactOnceClickHelpDesc,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 13.sp,
|
|
|
+ color: ColorName.black90,
|
|
|
+ )),
|
|
|
+ ),
|
|
|
+ SizedBox(height: 60.h),
|
|
|
+ GestureDetector(
|
|
|
+ onTap: controller.addContactClick,
|
|
|
+ child: Container(
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: ColorName.colorPrimary,
|
|
|
+ borderRadius: BorderRadius.circular(10.w)),
|
|
|
+ width: 320.w,
|
|
|
+ height: 42.w,
|
|
|
+ child: Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ Assets.images.iconUrgentAdd.image(width: 12.w, height: 12.w),
|
|
|
+ SizedBox(width: 5.w),
|
|
|
+ Text(StringName.urgentContactBtnTxt,
|
|
|
+ style:
|
|
|
+ TextStyle(fontSize: 14.sp, color: ColorName.white)),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ Widget buildAddContact() {
|
|
|
+ return GestureDetector(
|
|
|
+ onTap: controller.addContactClick,
|
|
|
+ child: Container(
|
|
|
+ height: 66.w,
|
|
|
+ decoration: BoxDecoration(boxShadow: [
|
|
|
+ BoxShadow(
|
|
|
+ color: ColorName.black.withOpacity(0.06),
|
|
|
+ offset: Offset(0, 2),
|
|
|
+ blurRadius: 10)
|
|
|
+ ], color: ColorName.white, borderRadius: BorderRadius.circular(10.w)),
|
|
|
+ margin: EdgeInsets.symmetric(horizontal: 12.w),
|
|
|
+ child: Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ SizedBox(
|
|
|
+ width: 52.w,
|
|
|
+ height: 52.w,
|
|
|
+ child: Stack(
|
|
|
+ children: [
|
|
|
+ Assets.images.bgUrgentContactAdd
|
|
|
+ .image(width: double.infinity, height: double.infinity),
|
|
|
+ Center(
|
|
|
+ child: Assets.images.iconUrgentContactAdd
|
|
|
+ .image(width: 28.w, height: 28.w),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ SizedBox(width: 18.w),
|
|
|
+ Column(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ Text(
|
|
|
+ StringName.urgentContactTitle,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 14.sp,
|
|
|
+ color: ColorName.black90,
|
|
|
+ fontWeight: FontWeight.bold),
|
|
|
+ ),
|
|
|
+ SizedBox(height: 3.w),
|
|
|
+ Text(StringName.urgentContactAddDesc,
|
|
|
+ style:
|
|
|
+ TextStyle(fontSize: 12.sp, color: ColorName.black70)),
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+}
|