add_friend_view.dart 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_screenutil/flutter_screenutil.dart';
  4. import 'package:get/get.dart';
  5. import 'package:get/get_core/src/get_main.dart';
  6. import 'package:location/utils/expand.dart';
  7. import '../../../base/base_view.dart';
  8. import '../../../resource/assets.gen.dart';
  9. import '../../../resource/colors.gen.dart';
  10. import '../../../resource/string.gen.dart';
  11. import 'add_friend_dialog_controller.dart';
  12. class AddFriendView extends BaseView<AddFriendDialogController> {
  13. const AddFriendView({super.key});
  14. static void show() {
  15. Get.bottomSheet(AddFriendView(),
  16. isScrollControlled: true,
  17. barrierColor: ColorName.black55,
  18. backgroundColor: ColorName.transparent);
  19. }
  20. static void dismiss() {
  21. Get.back();
  22. }
  23. @override
  24. Widget buildBody(BuildContext context) {
  25. return _addFriendView();
  26. }
  27. @override
  28. backgroundColor() {
  29. return ColorName.transparent;
  30. }
  31. Widget _addFriendView() {
  32. return IntrinsicHeight(
  33. child: Container(
  34. decoration: BoxDecoration(
  35. color: '#FDFCFE'.color,
  36. borderRadius: BorderRadius.only(
  37. topLeft: Radius.circular(16.w),
  38. topRight: Radius.circular(16.w),
  39. ),
  40. ),
  41. child: Stack(
  42. children: [
  43. // Positioned.fill(
  44. // child: Assets.images.bgAddFriendDialog.image(width: 1.sw),
  45. // ),
  46. _buildClose(),
  47. Column(
  48. crossAxisAlignment: CrossAxisAlignment.start,
  49. children: [
  50. SizedBox(height: 19.h),
  51. _buildAddHeader(),
  52. SizedBox(height: 18.h),
  53. _buildPhone(),
  54. SizedBox(height: 16.h),
  55. _buildShareWx(),
  56. SizedBox(height: 20.h),
  57. Center(child: Obx(() {
  58. return Text(controller.title.value,
  59. style:
  60. TextStyle(fontSize: 12.sp, color: '#A7A7A7'.color));
  61. })),
  62. SizedBox(height: 30.h),
  63. ],
  64. )
  65. ],
  66. ),
  67. ),
  68. );
  69. }
  70. Container _buildShareWx() {
  71. return Container(
  72. height: 54.w,
  73. decoration: BoxDecoration(boxShadow: [
  74. BoxShadow(
  75. color: ColorName.black5.withOpacity(0.05), // 阴影颜色
  76. blurRadius: 23, // 阴影模糊半径
  77. spreadRadius: 2, // 阴影扩展半径
  78. offset: const Offset(0, 0), // 阴影位置,向上偏移
  79. ),
  80. ], color: ColorName.white, borderRadius: BorderRadius.circular(12.w)),
  81. margin: EdgeInsets.symmetric(horizontal: 12.w),
  82. child: Row(
  83. children: [
  84. SizedBox(width: 15.w),
  85. Assets.images.iconLoginWx.image(width: 25.w),
  86. SizedBox(width: 15.w),
  87. Text(StringName.friendAddFromWx,
  88. style: TextStyle(
  89. fontWeight: FontWeight.bold,
  90. color: ColorName.primaryTextColor,
  91. fontSize: 14.sp)),
  92. Spacer(),
  93. Assets.images.iconLoginGoWxArrow.image(width: 18.w, height: 18.w),
  94. SizedBox(width: 12.w),
  95. ],
  96. ),
  97. );
  98. }
  99. Container _buildPhone() {
  100. return Container(
  101. padding: EdgeInsets.symmetric(horizontal: 12.w),
  102. margin: EdgeInsets.symmetric(horizontal: 12.w),
  103. decoration: BoxDecoration(boxShadow: [
  104. BoxShadow(
  105. color: ColorName.black5.withOpacity(0.05), // 阴影颜色
  106. blurRadius: 23, // 阴影模糊半径
  107. spreadRadius: 2, // 阴影扩展半径
  108. offset: const Offset(0, 0), // 阴影位置,向上偏移
  109. ),
  110. ], color: ColorName.white, borderRadius: BorderRadius.circular(12.w)),
  111. child: Column(
  112. children: [
  113. SizedBox(height: 13.h),
  114. Row(
  115. crossAxisAlignment: CrossAxisAlignment.center,
  116. children: [
  117. Assets.images.iconLoginPhone.image(width: 18.w, height: 18.w),
  118. SizedBox(width: 7.w),
  119. Text(
  120. StringName.friendAddPhoneEtHint,
  121. style: TextStyle(
  122. fontWeight: FontWeight.bold,
  123. fontSize: 14.sp,
  124. color: ColorName.primaryTextColor,
  125. ),
  126. )
  127. ],
  128. ),
  129. SizedBox(height: 18.h),
  130. _buildPhoneView(),
  131. SizedBox(height: 18.h),
  132. ],
  133. ),
  134. );
  135. }
  136. Widget _buildPhoneView() {
  137. return Row(
  138. children: [
  139. Expanded(
  140. child: Container(
  141. height: 50.w,
  142. decoration: BoxDecoration(
  143. color: '#F9F9F9'.color,
  144. borderRadius: BorderRadius.circular(10.w),
  145. ),
  146. padding: EdgeInsets.symmetric(horizontal: 10.w),
  147. child: Center(
  148. child: TextField(
  149. style: TextStyle(
  150. fontSize: 14.sp, color: ColorName.primaryTextColor),
  151. maxLines: 1,
  152. maxLength: 11,
  153. keyboardType: TextInputType.phone,
  154. textAlignVertical: TextAlignVertical.center,
  155. textInputAction: TextInputAction.next,
  156. decoration: InputDecoration(
  157. hintText: StringName.friendAddPhoneEtHint,
  158. counterText: '',
  159. hintStyle:
  160. TextStyle(fontSize: 16, color: "#AFAFAF".toColor()),
  161. labelStyle: const TextStyle(
  162. fontSize: 16,
  163. color: ColorName.primaryTextColor,
  164. ),
  165. contentPadding: const EdgeInsets.all(0),
  166. border: const OutlineInputBorder(borderSide: BorderSide.none),
  167. enabled: true,
  168. ),
  169. ),
  170. ),
  171. ),
  172. ),
  173. SizedBox(width: 14.w),
  174. Assets.images.iconLoginAddressBook.image(width: 15.w, height: 15.w),
  175. SizedBox(width: 3.w),
  176. Text(StringName.friendAddAddressBook,
  177. style: TextStyle(fontSize: 14.sp, color: '#202020'.color)),
  178. ],
  179. );
  180. }
  181. Widget _buildAddHeader() {
  182. return Padding(
  183. padding: EdgeInsets.only(left: 18.w),
  184. child: Column(
  185. crossAxisAlignment: CrossAxisAlignment.start,
  186. children: [
  187. Text(StringName.friendAddTitle,
  188. style: TextStyle(
  189. fontSize: 20.sp,
  190. color: ColorName.primaryTextColor,
  191. fontWeight: FontWeight.bold)),
  192. SizedBox(height: 10.h),
  193. Text(StringName.friendAddDesc,
  194. style: TextStyle(fontSize: 14.sp, color: '#545454'.color)),
  195. ],
  196. ),
  197. );
  198. }
  199. Widget _buildClose() {
  200. return Padding(
  201. padding: EdgeInsets.all(12.w),
  202. child: GestureDetector(
  203. onTap: () {
  204. Get.back();
  205. },
  206. child: Align(
  207. alignment: Alignment.topRight,
  208. child:
  209. Assets.images.iconLoginClose.image(width: 24.w, height: 24.w)),
  210. ),
  211. );
  212. }
  213. }