|
|
@@ -8,10 +8,12 @@ import 'package:flutter/material.dart';
|
|
|
import 'package:get/get.dart';
|
|
|
import 'package:keyboard/utils/age_zodiac_sign_util.dart';
|
|
|
|
|
|
+import '../../../data/bean/character_info.dart';
|
|
|
import '../../../data/bean/keyboard_info.dart';
|
|
|
import '../../../resource/assets.gen.dart';
|
|
|
import '../../../resource/string.gen.dart';
|
|
|
import '../../../router/app_pages.dart';
|
|
|
+import '../../../utils/intimacy_util.dart';
|
|
|
import '../../../utils/styles.dart';
|
|
|
import '../../../widget/avatar/avatar_image_widget.dart';
|
|
|
import '../../../widget/gradient_rect_slider_track_shape.dart';
|
|
|
@@ -19,8 +21,8 @@ import '../../../widget/gradient_rect_slider_track_shape.dart';
|
|
|
class ProfileEditPage extends BasePage<ProfileEditController> {
|
|
|
const ProfileEditPage({super.key});
|
|
|
|
|
|
- static start({KeyboardInfo? keyboardInfo}) {
|
|
|
- Get.toNamed(
|
|
|
+ static Future start({KeyboardInfo? keyboardInfo}) async {
|
|
|
+ return Get.toNamed(
|
|
|
RoutePath.profileEdit,
|
|
|
arguments: {"keyboardInfo": keyboardInfo},
|
|
|
);
|
|
|
@@ -67,24 +69,37 @@ class ProfileEditPage extends BasePage<ProfileEditController> {
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
- child: SingleChildScrollView(
|
|
|
- child: Column(
|
|
|
- children: [
|
|
|
- _buildNameCard(),
|
|
|
- SizedBox(height: 20.h),
|
|
|
- _buildIntimacySlider(),
|
|
|
- SizedBox(height: 10.h),
|
|
|
- _buildGenderCard(),
|
|
|
- SizedBox(height: 10.h),
|
|
|
- _buildBirthdayCard(),
|
|
|
- SizedBox(height: 10.h),
|
|
|
- // _buildRelationshipCard(),
|
|
|
- // SizedBox(height: 10.h),
|
|
|
- ],
|
|
|
- ),
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ _buildNameCard(),
|
|
|
+ SizedBox(height: 20.h),
|
|
|
+ Expanded(
|
|
|
+ child: SingleChildScrollView(
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ _buildIntimacySlider(),
|
|
|
+ SizedBox(height: 10.h),
|
|
|
+ _buildGenderCard(),
|
|
|
+ SizedBox(height: 10.h),
|
|
|
+ _buildBirthdayCard(),
|
|
|
+ SizedBox(height: 10.h),
|
|
|
+ controller.isEditMode
|
|
|
+ ? _buildRelationshipCard()
|
|
|
+ : SizedBox(),
|
|
|
+ SizedBox(height: 10.h),
|
|
|
+ controller.isEditMode
|
|
|
+ ? _buildCharacterList()
|
|
|
+ : SizedBox(),
|
|
|
+ SizedBox(height: 20.h),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
+
|
|
|
Container(
|
|
|
color: Color(0xFFF6F5FA),
|
|
|
child: _buildSaveButton(),
|
|
|
@@ -124,7 +139,7 @@ class ProfileEditPage extends BasePage<ProfileEditController> {
|
|
|
children: [
|
|
|
Obx(() {
|
|
|
return Text(
|
|
|
- controller.currentNickname??"请输入昵称",
|
|
|
+ controller.currentNickname ?? "请输入昵称",
|
|
|
textAlign: TextAlign.center,
|
|
|
style: TextStyle(
|
|
|
color: Colors.black.withAlpha(204),
|
|
|
@@ -153,18 +168,18 @@ class ProfileEditPage extends BasePage<ProfileEditController> {
|
|
|
width: 72.r,
|
|
|
height: 72.r,
|
|
|
child:
|
|
|
- controller.avatarUrl.isNotEmpty
|
|
|
- ? CircleAvatarWidget(
|
|
|
- image: Assets.images.iconKeyboardDefaultAvatar.provider(),
|
|
|
- imageUrl: controller.avatarUrl,
|
|
|
- size: 72.w,
|
|
|
- borderColor: Colors.white,
|
|
|
- borderWidth: 2.r,
|
|
|
- placeholder: (_, __) {
|
|
|
- return const CupertinoActivityIndicator();
|
|
|
- },
|
|
|
- )
|
|
|
- : SizedBox(),
|
|
|
+ controller.avatarUrl.isNotEmpty
|
|
|
+ ? CircleAvatarWidget(
|
|
|
+ image: Assets.images.iconKeyboardDefaultAvatar.provider(),
|
|
|
+ imageUrl: controller.avatarUrl,
|
|
|
+ size: 72.w,
|
|
|
+ borderColor: Colors.white,
|
|
|
+ borderWidth: 2.r,
|
|
|
+ placeholder: (_, __) {
|
|
|
+ return const CupertinoActivityIndicator();
|
|
|
+ },
|
|
|
+ )
|
|
|
+ : SizedBox(),
|
|
|
);
|
|
|
}),
|
|
|
);
|
|
|
@@ -187,17 +202,16 @@ class ProfileEditPage extends BasePage<ProfileEditController> {
|
|
|
// 性别
|
|
|
Widget _buildGenderCard() {
|
|
|
return _buildListItem(
|
|
|
- onTap: () {
|
|
|
+ onBottomTap: () {
|
|
|
controller.clickGender();
|
|
|
},
|
|
|
firstWidget: Text('性别', style: Styles.getTextStyleBlack204W400(14.sp)),
|
|
|
bottomWidget: Obx(() {
|
|
|
return Row(
|
|
|
children: [
|
|
|
- Assets.images.iconCharacterCustomDetailMale.image(
|
|
|
- width: 24.w,
|
|
|
- height: 24.w,
|
|
|
- ),
|
|
|
+ controller.genderImage != null
|
|
|
+ ? controller.genderImage!.image(width: 24.w, height: 24.w)
|
|
|
+ : const SizedBox(),
|
|
|
SizedBox(width: 6.w),
|
|
|
Text(
|
|
|
controller.genderText,
|
|
|
@@ -213,11 +227,10 @@ class ProfileEditPage extends BasePage<ProfileEditController> {
|
|
|
|
|
|
Widget _buildBirthdayCard() {
|
|
|
return _buildListItem(
|
|
|
- onTap: () {
|
|
|
+ onBottomTap: () {
|
|
|
controller.clickBirthday();
|
|
|
},
|
|
|
- firstWidget: Text(
|
|
|
- '出生日期', style: Styles.getTextStyleBlack204W400(14.sp)),
|
|
|
+ firstWidget: Text('出生日期', style: Styles.getTextStyleBlack204W400(14.sp)),
|
|
|
bottomWidget: Obx(() {
|
|
|
return Row(
|
|
|
children: [
|
|
|
@@ -240,16 +253,88 @@ class ProfileEditPage extends BasePage<ProfileEditController> {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ Widget _buildCharacterList() {
|
|
|
+ return _buildListItem(
|
|
|
+ onFirstTap: () {
|
|
|
+ controller.clickGoKeyboardManage();
|
|
|
+ },
|
|
|
+ firstWidget: Row(
|
|
|
+ children: [
|
|
|
+ Text('键盘人设', style: Styles.getTextStyleBlack204W400(14.sp)),
|
|
|
+ Spacer(),
|
|
|
+ Assets.images.iconArrowRight.image(width: 24.w, height: 24.w),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ bottomWidget: Column(
|
|
|
+ children: [
|
|
|
+ SizedBox(height: 7.h),
|
|
|
+ Obx(() {
|
|
|
+ final list = controller.currentCustomKeyboardCharacterList;
|
|
|
+ if (list.isEmpty) {
|
|
|
+ return const Center(child: CircularProgressIndicator());
|
|
|
+ }
|
|
|
+ final showList = list.take(9).toList();
|
|
|
+
|
|
|
+ return SizedBox(
|
|
|
+ height: 32.h * 3 + 8.h * 2,
|
|
|
+ child: GridView.builder(
|
|
|
+ padding: EdgeInsets.zero,
|
|
|
+ physics: const NeverScrollableScrollPhysics(),
|
|
|
+
|
|
|
+ itemCount: showList.length,
|
|
|
+ gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
+ crossAxisCount: 3, // 每行3个
|
|
|
+ mainAxisSpacing: 8.h,
|
|
|
+ crossAxisSpacing: 8.w,
|
|
|
+ childAspectRatio: 96.w / 32.h, // 控制宽高比
|
|
|
+ ),
|
|
|
+ itemBuilder: (context, index) {
|
|
|
+ return _buildCharacterItem(showList[index]);
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }),
|
|
|
+ // Spacer(),
|
|
|
+ // Assets.images.iconArrowRight.image(width: 24.w, height: 24.w),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ Widget _buildCharacterItem(CharacterInfo character) {
|
|
|
+ return Container(
|
|
|
+ alignment: Alignment.center,
|
|
|
+ decoration: ShapeDecoration(
|
|
|
+ color: const Color(0xFFF5F4F9),
|
|
|
+ shape: RoundedRectangleBorder(
|
|
|
+ borderRadius: BorderRadius.circular(31.r),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ child: Text(
|
|
|
+ '${character.emoji}${character.name}',
|
|
|
+ style: Styles.getTextStyleBlack204W400(12.sp),
|
|
|
+ maxLines: 1,
|
|
|
+ overflow: TextOverflow.fade,
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
Widget _buildRelationshipCard() {
|
|
|
return _buildListItem(
|
|
|
- onTap: () {
|
|
|
- debugPrint('点击了关系');
|
|
|
+ onBottomTap: () {
|
|
|
+ controller.clickRelationship();
|
|
|
},
|
|
|
firstWidget: Text('关系', style: Styles.getTextStyleBlack204W400(14.sp)),
|
|
|
bottomWidget: Row(
|
|
|
children: [
|
|
|
- Spacer(),
|
|
|
- Assets.images.iconArrowRight.image(width: 24.w, height: 24.w),
|
|
|
+ Obx(() {
|
|
|
+ return Text(
|
|
|
+ IntimacyUtil.getIntimacyName(controller.currentCustomIntimacy),
|
|
|
+ style: Styles.getTextStyleBlack204W400(14.sp),
|
|
|
+ );
|
|
|
+ }),
|
|
|
+ // Spacer(),
|
|
|
+ // Assets.images.iconArrowRight.image(width: 24.w, height: 24.w),
|
|
|
],
|
|
|
),
|
|
|
);
|
|
|
@@ -265,12 +350,7 @@ class ProfileEditPage extends BasePage<ProfileEditController> {
|
|
|
margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 16.h),
|
|
|
height: 48.h,
|
|
|
alignment: Alignment.center,
|
|
|
- decoration: ShapeDecoration(
|
|
|
- color: const Color(0xFF7D46FC),
|
|
|
- shape: RoundedRectangleBorder(
|
|
|
- borderRadius: BorderRadius.circular(50.r),
|
|
|
- ),
|
|
|
- ),
|
|
|
+ decoration: Styles.getActivateButtonDecoration(50.r),
|
|
|
child: Text(
|
|
|
StringName.profileEditSave,
|
|
|
textAlign: TextAlign.center,
|
|
|
@@ -284,7 +364,8 @@ class ProfileEditPage extends BasePage<ProfileEditController> {
|
|
|
Widget _buildListItem({
|
|
|
required Widget firstWidget,
|
|
|
required Widget bottomWidget,
|
|
|
- VoidCallback? onTap,
|
|
|
+ VoidCallback? onBottomTap,
|
|
|
+ VoidCallback? onFirstTap,
|
|
|
}) {
|
|
|
return Container(
|
|
|
padding: EdgeInsets.only(
|
|
|
@@ -305,11 +386,15 @@ class ProfileEditPage extends BasePage<ProfileEditController> {
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
children: [
|
|
|
- firstWidget,
|
|
|
+ GestureDetector(
|
|
|
+ behavior: HitTestBehavior.opaque,
|
|
|
+ onTap: onFirstTap,
|
|
|
+ child: firstWidget,
|
|
|
+ ),
|
|
|
_buildDivider(),
|
|
|
GestureDetector(
|
|
|
behavior: HitTestBehavior.opaque,
|
|
|
- onTap: onTap,
|
|
|
+ onTap: onBottomTap,
|
|
|
child: bottomWidget,
|
|
|
),
|
|
|
],
|
|
|
@@ -325,7 +410,7 @@ class ProfileEditPage extends BasePage<ProfileEditController> {
|
|
|
decoration: ShapeDecoration(
|
|
|
shape: RoundedRectangleBorder(
|
|
|
side: BorderSide(
|
|
|
- width: 1.r,
|
|
|
+ width: 0.5.r,
|
|
|
strokeAlign: BorderSide.strokeAlignCenter,
|
|
|
color: const Color(0xFFF5F4F9),
|
|
|
),
|
|
|
@@ -336,91 +421,90 @@ class ProfileEditPage extends BasePage<ProfileEditController> {
|
|
|
|
|
|
Widget _buildIntimacySlider() {
|
|
|
return // 亲密度模块
|
|
|
- Container(
|
|
|
- margin: EdgeInsets.only(left: 16.w, top: 24.h, right: 16.w),
|
|
|
- padding: EdgeInsets.only(
|
|
|
- left: 16.w,
|
|
|
- top: 23.h,
|
|
|
- right: 16.w,
|
|
|
- bottom: 26.h,
|
|
|
- ),
|
|
|
- decoration: BoxDecoration(
|
|
|
- image: DecorationImage(
|
|
|
- image: Assets.images.bgProfileEditIntimacy.provider(),
|
|
|
- fit: BoxFit.fill,
|
|
|
- ),
|
|
|
- borderRadius: BorderRadius.circular(10.r),
|
|
|
+ Container(
|
|
|
+ margin: EdgeInsets.only(left: 16.w, top: 24.h, right: 16.w),
|
|
|
+ padding: EdgeInsets.only(
|
|
|
+ left: 16.w,
|
|
|
+ top: 23.h,
|
|
|
+ right: 16.w,
|
|
|
+ bottom: 26.h,
|
|
|
+ ),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ image: DecorationImage(
|
|
|
+ image: Assets.images.bgProfileEditIntimacy.provider(),
|
|
|
+ fit: BoxFit.fill,
|
|
|
),
|
|
|
- child: Column(
|
|
|
- children: [
|
|
|
- // 亲密度
|
|
|
- Row(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
- children: [
|
|
|
- Assets.images.iconKeyboardManageFavorite.image(
|
|
|
- width: 20.w,
|
|
|
- height: 20.w,
|
|
|
- ),
|
|
|
- Assets.images.iconKeyboardManageIntimacyText.image(
|
|
|
- width: 48.w,
|
|
|
- height: 19.h,
|
|
|
- ),
|
|
|
- const Spacer(),
|
|
|
- Container(
|
|
|
- alignment: Alignment.center,
|
|
|
- width: 81.w,
|
|
|
- height: 28.h,
|
|
|
- decoration: ShapeDecoration(
|
|
|
- color: const Color(0xFFE1E0E7),
|
|
|
- shape: RoundedRectangleBorder(
|
|
|
- borderRadius: BorderRadius.circular(16.r),
|
|
|
- ),
|
|
|
+ borderRadius: BorderRadius.circular(10.r),
|
|
|
+ ),
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ // 亲密度
|
|
|
+ Row(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ Assets.images.iconKeyboardManageFavorite.image(
|
|
|
+ width: 20.w,
|
|
|
+ height: 20.w,
|
|
|
+ ),
|
|
|
+ Assets.images.iconKeyboardManageIntimacyText.image(
|
|
|
+ width: 48.w,
|
|
|
+ height: 19.h,
|
|
|
+ ),
|
|
|
+ const Spacer(),
|
|
|
+ Container(
|
|
|
+ alignment: Alignment.center,
|
|
|
+ width: 81.w,
|
|
|
+ height: 28.h,
|
|
|
+ decoration: ShapeDecoration(
|
|
|
+ color: const Color(0xFFE1E0E7),
|
|
|
+ shape: RoundedRectangleBorder(
|
|
|
+ borderRadius: BorderRadius.circular(16.r),
|
|
|
),
|
|
|
- child: Obx(() {
|
|
|
- return Text(
|
|
|
- '${StringName.intimacy}${controller
|
|
|
- .currentCustomIntimacy}%',
|
|
|
- textAlign: TextAlign.right,
|
|
|
- style: TextStyle(
|
|
|
- color: Colors.black.withAlpha(204),
|
|
|
- fontSize: 12.sp,
|
|
|
- fontWeight: FontWeight.w400,
|
|
|
- ),
|
|
|
- );
|
|
|
- }),
|
|
|
),
|
|
|
- ],
|
|
|
- ),
|
|
|
- SizedBox(height: 19.h),
|
|
|
- Builder(
|
|
|
- builder: (context) {
|
|
|
- return SliderTheme(
|
|
|
- data: SliderTheme.of(context).copyWith(
|
|
|
- trackShape: const GradientRectSliderTrackShape(),
|
|
|
- trackHeight: 8.h,
|
|
|
- thumbColor: Colors.white,
|
|
|
- thumbShape: RoundSliderThumbShape(enabledThumbRadius: 7.r),
|
|
|
- overlayShape: const RoundSliderOverlayShape(
|
|
|
- overlayRadius: 16,
|
|
|
+ child: Obx(() {
|
|
|
+ return Text(
|
|
|
+ '${StringName.intimacy}${controller.currentCustomIntimacy}%',
|
|
|
+ textAlign: TextAlign.right,
|
|
|
+ style: TextStyle(
|
|
|
+ color: Colors.black.withAlpha(204),
|
|
|
+ fontSize: 12.sp,
|
|
|
+ fontWeight: FontWeight.w400,
|
|
|
),
|
|
|
+ );
|
|
|
+ }),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ SizedBox(height: 19.h),
|
|
|
+ Builder(
|
|
|
+ builder: (context) {
|
|
|
+ return SliderTheme(
|
|
|
+ data: SliderTheme.of(context).copyWith(
|
|
|
+ trackShape: const GradientRectSliderTrackShape(),
|
|
|
+ trackHeight: 8.h,
|
|
|
+ thumbColor: Colors.white,
|
|
|
+ thumbShape: RoundSliderThumbShape(enabledThumbRadius: 7.r),
|
|
|
+ overlayShape: const RoundSliderOverlayShape(
|
|
|
+ overlayRadius: 16,
|
|
|
),
|
|
|
- child: Obx(() {
|
|
|
- return Slider(
|
|
|
- value: controller.currentCustomIntimacy.toDouble(),
|
|
|
+ ),
|
|
|
+ child: Obx(() {
|
|
|
+ return Slider(
|
|
|
+ value: controller.currentCustomIntimacy.toDouble(),
|
|
|
|
|
|
- divisions: 100,
|
|
|
- min: 0,
|
|
|
- max: 100,
|
|
|
- onChanged: (value) {
|
|
|
- controller.updateIntimacy(value.toInt());
|
|
|
- },
|
|
|
- );
|
|
|
- }),
|
|
|
- );
|
|
|
- },
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
- );
|
|
|
+ divisions: 100,
|
|
|
+ min: 0,
|
|
|
+ max: 100,
|
|
|
+ onChanged: (value) {
|
|
|
+ controller.updateIntimacy(value.toInt());
|
|
|
+ },
|
|
|
+ );
|
|
|
+ }),
|
|
|
+ );
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
}
|
|
|
}
|