- 上游: github.com/OpenIMSDK/openim-flutter-demo tag 3.8.3-patch.3 commit b3dfdb1e8aaeaaf6f0793e10cadd20d5c184a31f - 并行目录 mobile-next/ 原样导入(含 LICENSE),不覆盖现网 mobile/ - 锁定 Flutter 3.24.5 / Dart 3.5.4 / JDK 17 / Gradle 7.6.3 / AGP 7.3.1 - 实测 Android debug 与 release 构建均成功(见 docs/mobile-next-baseline-import.md) - 本提交可单独回退:git revert 1db1229(重写前) Co-authored-by: multica-agent <github@multica.ai>
134 lines
4.3 KiB
Dart
134 lines
4.3 KiB
Dart
import 'package:common_utils/common_utils.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:openim_common/openim_common.dart';
|
|
|
|
import '../../../core/controller/im_controller.dart';
|
|
import 'my_info_logic.dart';
|
|
|
|
class MyInfoPage extends StatelessWidget {
|
|
final logic = Get.find<MyInfoLogic>();
|
|
final imLogic = Get.find<IMController>();
|
|
|
|
MyInfoPage({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: TitleBar.back(
|
|
title: StrRes.myInfo,
|
|
),
|
|
backgroundColor: Styles.c_F8F9FA,
|
|
body: Obx(() => SingleChildScrollView(
|
|
child: Column(
|
|
children: [
|
|
10.verticalSpace,
|
|
_buildCornerBgView(
|
|
children: [
|
|
_buildItemView(
|
|
label: StrRes.avatar,
|
|
isAvatar: true,
|
|
value: imLogic.userInfo.value.nickname,
|
|
url: imLogic.userInfo.value.faceURL,
|
|
onTap: logic.openPhotoSheet,
|
|
),
|
|
_buildItemView(
|
|
label: StrRes.name,
|
|
value: imLogic.userInfo.value.nickname,
|
|
onTap: logic.editMyName,
|
|
),
|
|
_buildItemView(
|
|
label: StrRes.gender,
|
|
value: imLogic.userInfo.value.isMale ? StrRes.man : StrRes.woman,
|
|
onTap: logic.selectGender,
|
|
),
|
|
_buildItemView(
|
|
label: StrRes.birthDay,
|
|
value: DateUtil.formatDateMs(
|
|
imLogic.userInfo.value.birth ?? 0,
|
|
format: IMUtils.getTimeFormat1(),
|
|
),
|
|
onTap: logic.openDatePicker,
|
|
),
|
|
],
|
|
),
|
|
10.verticalSpace,
|
|
_buildCornerBgView(
|
|
children: [
|
|
_buildItemView(
|
|
label: StrRes.mobile,
|
|
value: imLogic.userInfo.value.phoneNumber,
|
|
showRightArrow: false,
|
|
),
|
|
_buildItemView(
|
|
label: StrRes.email,
|
|
value: imLogic.userInfo.value.email,
|
|
onTap: logic.editEmail,
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
)),
|
|
);
|
|
}
|
|
|
|
Widget _buildCornerBgView({required List<Widget> children}) => Container(
|
|
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
|
margin: EdgeInsets.symmetric(horizontal: 10.w),
|
|
decoration: BoxDecoration(
|
|
color: Styles.c_FFFFFF,
|
|
borderRadius: BorderRadius.only(
|
|
topLeft: Radius.circular(6.r),
|
|
topRight: Radius.circular(6.r),
|
|
bottomLeft: Radius.circular(6.r),
|
|
bottomRight: Radius.circular(6.r),
|
|
),
|
|
),
|
|
child: Column(children: children),
|
|
);
|
|
|
|
Widget _buildItemView({
|
|
required String label,
|
|
String? value,
|
|
String? url,
|
|
bool isAvatar = false,
|
|
bool showRightArrow = true,
|
|
Function()? onTap,
|
|
}) =>
|
|
GestureDetector(
|
|
behavior: HitTestBehavior.translucent,
|
|
onTap: showRightArrow ? onTap : null,
|
|
child: SizedBox(
|
|
height: 46.h,
|
|
child: Row(
|
|
children: [
|
|
label.toText..style = Styles.ts_0C1C33_17sp,
|
|
const Spacer(),
|
|
if (isAvatar)
|
|
AvatarView(
|
|
width: 32.w,
|
|
height: 32.h,
|
|
url: url,
|
|
text: value,
|
|
textStyle: Styles.ts_FFFFFF_10sp,
|
|
)
|
|
else
|
|
Expanded(
|
|
flex: 3,
|
|
child: (IMUtils.emptyStrToNull(value) ?? '').toText
|
|
..style = Styles.ts_0C1C33_17sp
|
|
..maxLines = 1
|
|
..overflow = TextOverflow.ellipsis
|
|
..textAlign = TextAlign.right),
|
|
if (showRightArrow)
|
|
ImageRes.rightArrow.toImage
|
|
..width = 24.w
|
|
..height = 24.h,
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|