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_view.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'; import 'add_urgent_contact_controller.dart'; class AddUrgentContactView extends BaseView { const AddUrgentContactView({super.key}); static Future show() { return Get.bottomSheet(AddUrgentContactView(), isScrollControlled: true, barrierColor: ColorName.black55, backgroundColor: ColorName.transparent); } @override Color backgroundColor() { return ColorName.transparent; } @override Widget buildBody(BuildContext context) { return Container( decoration: BoxDecoration( color: '#FCFCFC'.color, borderRadius: BorderRadius.only( topLeft: Radius.circular(20.w), topRight: Radius.circular(20.w), ), ), child: IntrinsicHeight( child: Column( children: [ SizedBox(height: 20.w), Row( children: [ SizedBox(width: 12.w), Text(StringName.urgentContactTitle, style: TextStyle( fontSize: 14.sp, color: ColorName.black90, fontWeight: FontWeight.bold)), Spacer(), GestureDetector( onTap: controller.back, child: Assets.images.iconDialogClose .image(width: 20.w, height: 20.w)), SizedBox(width: 12.w), ], ), SizedBox(height: 20.w), buildContactPhone(), SizedBox(height: 22.w), GestureDetector( onTap: controller.onAddClick, child: Obx(() { return Container( decoration: BoxDecoration( color: ColorName.colorPrimary.withOpacity( controller.contactPhone.length < 11 ? 0.3 : 1), borderRadius: BorderRadius.circular(100.w), ), width: 244.w, height: 36.w, child: Center( child: Text(StringName.dialogSure, style: TextStyle( fontSize: 15.sp, color: ColorName.white)))); }), ), SizedBox(height: 36.w) ], ), ), ); } Widget buildContactPhone() { return Container( decoration: BoxDecoration( color: ColorName.white, borderRadius: BorderRadius.circular(12.w), boxShadow: [ BoxShadow( color: ColorName.black.withOpacity(0.04), offset: Offset(0, 2), blurRadius: 4, ) ]), margin: EdgeInsets.symmetric(horizontal: 12.w), padding: EdgeInsets.all(12.w), child: Column( children: [ Row( children: [ Assets.images.iconLoginPhone.image(width: 18.w, height: 18.w), SizedBox(width: 7.w), Text(StringName.urgentContactTitle, style: TextStyle(fontSize: 14.sp, color: ColorName.black90)), ], ), SizedBox(height: 18.w), Row( children: [ Expanded( child: Container( decoration: BoxDecoration( color: '#F9F9F9'.color, borderRadius: BorderRadius.circular(10.w), ), child: TextField( controller: controller.etController, style: TextStyle( fontSize: 14.sp, color: ColorName.primaryTextColor), maxLines: 1, maxLength: 11, keyboardType: TextInputType.phone, textAlignVertical: TextAlignVertical.center, textInputAction: TextInputAction.next, decoration: InputDecoration( hintText: StringName.friendAddPhoneEtHint, counterText: '', hintStyle: TextStyle(fontSize: 16, color: "#AFAFAF".toColor()), labelStyle: const TextStyle( fontSize: 16, color: ColorName.primaryTextColor, ), contentPadding: EdgeInsets.symmetric(horizontal: 10.w), border: const OutlineInputBorder(borderSide: BorderSide.none), enabled: true, ), ), )), SizedBox(width: 14.w), GestureDetector( onTap: controller.onSelectContactClick, child: Row( children: [ Assets.images.iconLoginAddressBook .image(width: 15.w, height: 15.w), SizedBox(width: 3.w), Text(StringName.friendAddAddressBook, style: TextStyle(fontSize: 14.sp, color: '#202020'.color)) ], ), ) ], ) ], ), ); } }