add_friend_view.dart 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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(
  58. child: Text(StringName.friendAddRule,
  59. style: TextStyle(
  60. fontSize: 12.sp, color: '#A7A7A7'.color))),
  61. SizedBox(height: 30.h),
  62. ],
  63. )
  64. ],
  65. ),
  66. ),
  67. );
  68. }
  69. Container _buildShareWx() {
  70. return Container(
  71. height: 54.w,
  72. decoration: BoxDecoration(boxShadow: [
  73. BoxShadow(
  74. color: ColorName.black5.withOpacity(0.05), // 阴影颜色
  75. blurRadius: 23, // 阴影模糊半径
  76. spreadRadius: 2, // 阴影扩展半径
  77. offset: const Offset(0, 0), // 阴影位置,向上偏移
  78. ),
  79. ], color: ColorName.white, borderRadius: BorderRadius.circular(12.w)),
  80. margin: EdgeInsets.symmetric(horizontal: 12.w),
  81. child: Row(
  82. children: [
  83. SizedBox(width: 15.w),
  84. Assets.images.iconLoginWx.image(width: 25.w),
  85. SizedBox(width: 15.w),
  86. Text(StringName.friendAddFromWx,
  87. style: TextStyle(
  88. fontWeight: FontWeight.bold,
  89. color: ColorName.primaryTextColor,
  90. fontSize: 14.sp)),
  91. Spacer(),
  92. Assets.images.iconLoginGoWxArrow.image(width: 18.w, height: 18.w),
  93. SizedBox(width: 12.w),
  94. ],
  95. ),
  96. );
  97. }
  98. Container _buildPhone() {
  99. return Container(
  100. padding: EdgeInsets.symmetric(horizontal: 12.w),
  101. margin: EdgeInsets.symmetric(horizontal: 12.w),
  102. decoration: BoxDecoration(boxShadow: [
  103. BoxShadow(
  104. color: ColorName.black5.withOpacity(0.05), // 阴影颜色
  105. blurRadius: 23, // 阴影模糊半径
  106. spreadRadius: 2, // 阴影扩展半径
  107. offset: const Offset(0, 0), // 阴影位置,向上偏移
  108. ),
  109. ], color: ColorName.white, borderRadius: BorderRadius.circular(12.w)),
  110. child: Column(
  111. children: [
  112. SizedBox(height: 13.h),
  113. Row(
  114. crossAxisAlignment: CrossAxisAlignment.center,
  115. children: [
  116. Assets.images.iconLoginPhone.image(width: 18.w, height: 18.w),
  117. SizedBox(width: 7.w),
  118. Text(
  119. StringName.friendAddPhoneEtHint,
  120. style: TextStyle(
  121. fontWeight: FontWeight.bold,
  122. fontSize: 14.sp,
  123. color: ColorName.primaryTextColor,
  124. ),
  125. )
  126. ],
  127. ),
  128. SizedBox(height: 18.h),
  129. _buildPhoneView(),
  130. SizedBox(height: 18.h),
  131. ],
  132. ),
  133. );
  134. }
  135. Widget _buildPhoneView() {
  136. return Row(
  137. children: [
  138. Expanded(
  139. child: Container(
  140. height: 50.w,
  141. decoration: BoxDecoration(
  142. color: '#F9F9F9'.color,
  143. borderRadius: BorderRadius.circular(10.w),
  144. ),
  145. padding: EdgeInsets.symmetric(horizontal: 10.w),
  146. child: Center(
  147. child: TextField(
  148. style: TextStyle(
  149. fontSize: 14.sp, color: ColorName.primaryTextColor),
  150. maxLines: 1,
  151. maxLength: 11,
  152. keyboardType: TextInputType.phone,
  153. textAlignVertical: TextAlignVertical.center,
  154. textInputAction: TextInputAction.next,
  155. decoration: InputDecoration(
  156. hintText: StringName.friendAddPhoneEtHint,
  157. counterText: '',
  158. hintStyle:
  159. TextStyle(fontSize: 16, color: "#AFAFAF".toColor()),
  160. labelStyle: const TextStyle(
  161. fontSize: 16,
  162. color: ColorName.primaryTextColor,
  163. ),
  164. contentPadding: const EdgeInsets.all(0),
  165. border: const OutlineInputBorder(borderSide: BorderSide.none),
  166. enabled: true,
  167. ),
  168. ),
  169. ),
  170. ),
  171. ),
  172. SizedBox(width: 14.w),
  173. Assets.images.iconLoginAddressBook.image(width: 15.w, height: 15.w),
  174. SizedBox(width: 3.w),
  175. Text(StringName.friendAddAddressBook,
  176. style: TextStyle(fontSize: 14.sp, color: '#202020'.color)),
  177. ],
  178. );
  179. }
  180. Widget _buildAddHeader() {
  181. return Padding(
  182. padding: EdgeInsets.only(left: 18.w),
  183. child: Column(
  184. crossAxisAlignment: CrossAxisAlignment.start,
  185. children: [
  186. Text(StringName.friendAddTitle,
  187. style: TextStyle(
  188. fontSize: 20.sp,
  189. color: ColorName.primaryTextColor,
  190. fontWeight: FontWeight.bold)),
  191. SizedBox(height: 10.h),
  192. Text(StringName.friendAddDesc,
  193. style: TextStyle(fontSize: 14.sp, color: '#545454'.color)),
  194. ],
  195. ),
  196. );
  197. }
  198. Widget _buildClose() {
  199. return Padding(
  200. padding: EdgeInsets.all(12.w),
  201. child: GestureDetector(
  202. onTap: () {
  203. Get.back();
  204. },
  205. child: Align(
  206. alignment: Alignment.topRight,
  207. child:
  208. Assets.images.iconLoginClose.image(width: 24.w, height: 24.w)),
  209. ),
  210. );
  211. }
  212. }