add_urgent_contact_view.dart 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter/src/widgets/framework.dart';
  4. import 'package:flutter_screenutil/flutter_screenutil.dart';
  5. import 'package:get/get.dart';
  6. import 'package:get/get_core/src/get_main.dart';
  7. import 'package:location/base/base_view.dart';
  8. import 'package:location/resource/assets.gen.dart';
  9. import 'package:location/resource/string.gen.dart';
  10. import 'package:location/utils/common_expand.dart';
  11. import '../../../resource/colors.gen.dart';
  12. import 'add_urgent_contact_controller.dart';
  13. class AddUrgentContactView extends BaseView<AddUrgentContactController> {
  14. const AddUrgentContactView({super.key});
  15. static Future<T?> show<T>() {
  16. return Get.bottomSheet(AddUrgentContactView(),
  17. isScrollControlled: true,
  18. barrierColor: ColorName.black55,
  19. backgroundColor: ColorName.transparent);
  20. }
  21. @override
  22. Color backgroundColor() {
  23. return ColorName.transparent;
  24. }
  25. @override
  26. Widget buildBody(BuildContext context) {
  27. return Container(
  28. decoration: BoxDecoration(
  29. color: '#FCFCFC'.color,
  30. borderRadius: BorderRadius.only(
  31. topLeft: Radius.circular(20.w),
  32. topRight: Radius.circular(20.w),
  33. ),
  34. ),
  35. child: IntrinsicHeight(
  36. child: Column(
  37. children: [
  38. SizedBox(height: 20.w),
  39. Row(
  40. children: [
  41. SizedBox(width: 12.w),
  42. Text(StringName.urgentContactTitle,
  43. style: TextStyle(
  44. fontSize: 14.sp,
  45. color: ColorName.black90,
  46. fontWeight: FontWeight.bold)),
  47. Spacer(),
  48. GestureDetector(
  49. onTap: controller.back,
  50. child: Assets.images.iconDialogClose
  51. .image(width: 20.w, height: 20.w)),
  52. SizedBox(width: 12.w),
  53. ],
  54. ),
  55. SizedBox(height: 20.w),
  56. buildContactPhone(),
  57. SizedBox(height: 22.w),
  58. GestureDetector(
  59. onTap: controller.onAddClick,
  60. child: Obx(() {
  61. return Container(
  62. decoration: BoxDecoration(
  63. color: ColorName.colorPrimary.withOpacity(
  64. controller.contactPhone.length < 11 ? 0.3 : 1),
  65. borderRadius: BorderRadius.circular(100.w),
  66. ),
  67. width: 244.w,
  68. height: 36.w,
  69. child: Center(
  70. child: Text(StringName.dialogSure,
  71. style: TextStyle(
  72. fontSize: 15.sp, color: ColorName.white))));
  73. }),
  74. ),
  75. SizedBox(height: 36.w)
  76. ],
  77. ),
  78. ),
  79. );
  80. }
  81. Widget buildContactPhone() {
  82. return Container(
  83. decoration: BoxDecoration(
  84. color: ColorName.white,
  85. borderRadius: BorderRadius.circular(12.w),
  86. boxShadow: [
  87. BoxShadow(
  88. color: ColorName.black.withOpacity(0.04),
  89. offset: Offset(0, 2),
  90. blurRadius: 4,
  91. )
  92. ]),
  93. margin: EdgeInsets.symmetric(horizontal: 12.w),
  94. padding: EdgeInsets.all(12.w),
  95. child: Column(
  96. children: [
  97. Row(
  98. children: [
  99. Assets.images.iconLoginPhone.image(width: 18.w, height: 18.w),
  100. SizedBox(width: 7.w),
  101. Text(StringName.urgentContactTitle,
  102. style: TextStyle(fontSize: 14.sp, color: ColorName.black90)),
  103. ],
  104. ),
  105. SizedBox(height: 18.w),
  106. Row(
  107. children: [
  108. Expanded(
  109. child: Container(
  110. decoration: BoxDecoration(
  111. color: '#F9F9F9'.color,
  112. borderRadius: BorderRadius.circular(10.w),
  113. ),
  114. child: TextField(
  115. controller: controller.etController,
  116. style: TextStyle(
  117. fontSize: 14.sp, color: ColorName.primaryTextColor),
  118. maxLines: 1,
  119. maxLength: 11,
  120. keyboardType: TextInputType.phone,
  121. textAlignVertical: TextAlignVertical.center,
  122. textInputAction: TextInputAction.next,
  123. decoration: InputDecoration(
  124. hintText: StringName.friendAddPhoneEtHint,
  125. counterText: '',
  126. hintStyle:
  127. TextStyle(fontSize: 16, color: "#AFAFAF".toColor()),
  128. labelStyle: const TextStyle(
  129. fontSize: 16,
  130. color: ColorName.primaryTextColor,
  131. ),
  132. contentPadding: EdgeInsets.symmetric(horizontal: 10.w),
  133. border:
  134. const OutlineInputBorder(borderSide: BorderSide.none),
  135. enabled: true,
  136. ),
  137. ),
  138. )),
  139. SizedBox(width: 14.w),
  140. GestureDetector(
  141. onTap: controller.onSelectContactClick,
  142. child: Row(
  143. children: [
  144. Assets.images.iconLoginAddressBook
  145. .image(width: 15.w, height: 15.w),
  146. SizedBox(width: 3.w),
  147. Text(StringName.friendAddAddressBook,
  148. style:
  149. TextStyle(fontSize: 14.sp, color: '#202020'.color))
  150. ],
  151. ),
  152. )
  153. ],
  154. )
  155. ],
  156. ),
  157. );
  158. }
  159. }