| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269 |
- import 'dart:io';
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.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/utils/common_expand.dart';
- import 'package:location/utils/common_style.dart';
- import '../../../base/base_view.dart';
- import '../../../resource/assets.gen.dart';
- import '../../../resource/colors.gen.dart';
- import '../../../resource/string.gen.dart';
- import 'add_friend_dialog_controller.dart';
- class AddFriendPage extends BaseView<AddFriendDialogController> {
- const AddFriendPage({super.key});
- static Future<T?> show<T>() {
- return Get.bottomSheet(AddFriendPage(),
- isScrollControlled: true,
- barrierColor: ColorName.black55,
- backgroundColor: ColorName.transparent);
- }
- static void dismiss() {
- Get.back();
- }
- @override
- Widget buildBody(BuildContext context) {
- return _addFriendView();
- }
- @override
- backgroundColor() {
- return ColorName.transparent;
- }
- Widget _addFriendView() {
- return GestureDetector(
- onTap: () => FocusScope.of(Get.context!).unfocus(),
- child: IntrinsicHeight(
- child: Container(
- decoration: BoxDecoration(
- color: '#FDFCFE'.color,
- borderRadius: BorderRadius.only(
- topLeft: Radius.circular(16.w),
- topRight: Radius.circular(16.w),
- ),
- ),
- child: Stack(
- children: [
- Positioned(
- top: 0,
- child: Assets.images.bgAddFriendDialog.image(width: 1.sw),
- ),
- _buildClose(),
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- SizedBox(height: 19.h),
- _buildAddHeader(),
- SizedBox(height: 18.h),
- _buildPhone(),
- SizedBox(height: 16.h),
- _buildShareWx(),
- SizedBox(height: 20.h),
- Visibility(
- visible: Platform.isAndroid,
- child: Center(
- child: Text(StringName.friendAddRule,
- style: TextStyle(
- fontSize: 12.sp, color: '#A7A7A7'.color))),
- ),
- SizedBox(height: 30.h),
- ],
- )
- ],
- ),
- ),
- ),
- );
- }
- Widget _buildShareWx() {
- return GestureDetector(
- onTap: controller.shareWxClick,
- child: Container(
- height: 54.w,
- decoration: BoxDecoration(boxShadow: [
- BoxShadow(
- color: ColorName.black5.withOpacity(0.05), // 阴影颜色
- blurRadius: 23, // 阴影模糊半径
- spreadRadius: 2, // 阴影扩展半径
- offset: const Offset(0, 0), // 阴影位置,向上偏移
- ),
- ], color: ColorName.white, borderRadius: BorderRadius.circular(12.w)),
- margin: EdgeInsets.symmetric(horizontal: 12.w),
- child: Row(
- children: [
- SizedBox(width: 15.w),
- Assets.images.iconLoginWx.image(width: 25.w),
- SizedBox(width: 15.w),
- Text(
- Platform.isIOS
- ? StringName.friendAddFromWxIos
- : StringName.friendAddFromWx,
- style: TextStyle(
- fontWeight: FontWeight.bold,
- color: ColorName.primaryTextColor,
- fontSize: 14.sp)),
- Spacer(),
- Assets.images.iconLoginGoWxArrow.image(width: 18.w, height: 18.w),
- SizedBox(width: 12.w),
- ],
- ),
- ),
- );
- }
- Container _buildPhone() {
- return Container(
- padding: EdgeInsets.symmetric(horizontal: 12.w),
- margin: EdgeInsets.symmetric(horizontal: 12.w),
- decoration: BoxDecoration(boxShadow: [
- BoxShadow(
- color: ColorName.black5.withOpacity(0.05), // 阴影颜色
- blurRadius: 23, // 阴影模糊半径
- spreadRadius: 2, // 阴影扩展半径
- offset: const Offset(0, 0), // 阴影位置,向上偏移
- ),
- ], color: ColorName.white, borderRadius: BorderRadius.circular(12.w)),
- child: Column(
- children: [
- SizedBox(height: 13.h),
- Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Assets.images.iconLoginPhone.image(width: 18.w, height: 18.w),
- SizedBox(width: 7.w),
- Text(
- Platform.isAndroid
- ? StringName.friendAddFromPhone
- : StringName.friendAddFromPhoneIos,
- style: TextStyle(
- fontWeight: FontWeight.bold,
- fontSize: 14.sp,
- color: ColorName.primaryTextColor,
- ),
- ),
- Spacer(),
- Obx(() {
- return Visibility(
- maintainSize: true,
- maintainAnimation: true,
- maintainState: true,
- visible: controller.phone.length == 11,
- child: GestureDetector(
- onTap: controller.onAddFriendClick,
- child: Container(
- decoration: getPrimaryBtnDecoration(30.w),
- padding: EdgeInsets.symmetric(
- horizontal: 15.w, vertical: 8.w),
- child: Text(StringName.friendAddNow,
- style: TextStyle(
- fontSize: 14.sp,
- color: Colors.white,
- height: 1))),
- ),
- );
- })
- ],
- ),
- SizedBox(height: 18.h),
- _buildPhoneView(),
- SizedBox(height: 18.h),
- ],
- ),
- );
- }
- Widget _buildPhoneView() {
- return Row(
- children: [
- Expanded(
- child: Container(
- height: 50.w,
- decoration: BoxDecoration(
- color: '#F9F9F9'.color,
- borderRadius: BorderRadius.circular(10.w),
- ),
- padding: EdgeInsets.symmetric(horizontal: 10.w),
- child: Center(
- 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: const EdgeInsets.all(0),
- border: const OutlineInputBorder(borderSide: BorderSide.none),
- enabled: true,
- ),
- ),
- ),
- ),
- ),
- SizedBox(width: 14.w),
- Assets.images.iconLoginAddressBook.image(width: 15.w, height: 15.w),
- SizedBox(width: 3.w),
- GestureDetector(
- onTap: controller.onSelectContactClick,
- child: Text(StringName.friendAddAddressBook,
- style: TextStyle(fontSize: 14.sp, color: '#202020'.color)),
- ),
- ],
- );
- }
- Widget _buildAddHeader() {
- return Padding(
- padding: EdgeInsets.only(left: 18.w),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- Platform.isAndroid
- ? StringName.friendAddTitle
- : StringName.friendAddIosTitle,
- style: TextStyle(
- fontSize: 20.sp,
- color: ColorName.primaryTextColor,
- fontWeight: FontWeight.bold)),
- SizedBox(height: 10.h),
- Text(StringName.friendAddDesc,
- style: TextStyle(fontSize: 14.sp, color: '#545454'.color)),
- ],
- ),
- );
- }
- Widget _buildClose() {
- return Padding(
- padding: EdgeInsets.all(12.w),
- child: GestureDetector(
- onTap: () {
- Get.back();
- },
- child: Align(
- alignment: Alignment.topRight,
- child:
- Assets.images.iconLoginClose.image(width: 24.w, height: 24.w)),
- ),
- );
- }
- }
|