dreampad/lib/app/modules/home/widgets/user_widget.dart
2023-12-02 16:23:17 +08:00

77 lines
2.2 KiB
Dart

import 'package:dreampad/app/shared/shared.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
class UserWidget extends GetView {
const UserWidget({
super.key,
required this.account,
required this.gender,
required this.occupationName,
required this.occupationId,
});
final String account;
final int gender;
final String occupationName;
final int occupationId;
@override
Widget build(BuildContext context) {
return Container(
height: 67.h,
width: 215.w,
decoration: const BoxDecoration(
image: DecorationImage(
image: Images.homeUserName,
fit: BoxFit.fill,
),
),
padding: REdgeInsets.only(left: 2.0, top: 1.0, bottom: 1.0),
child: Row(
children: [
switch(gender) {
2 => switch(occupationId) {
5 => Images.homeAvatarPainterMale,
_ => Images.homeAvatarAcademicianMale,
},
_ => switch(occupationId) {
5 => Images.homeAvatarPainterFemale,
_ => Images.homeAvatarAcademicianFemale,
},
},
Container(
padding: REdgeInsets.all(5.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
account,
style: TextStyles.mediumWhite23_111_2,
),
const RSizedBox(width: 7.0),
gender == 2 ? Images.male : Images.female,
],
),
const RSizedBox(height: 4.0),
Container(
color: const Color(0xFF000000).withOpacity(0.2),
padding: const EdgeInsets.symmetric(horizontal: 8.0),
alignment: Alignment.center,
child: Text(
occupationName,
style: TextStyles.mediumWhite12,
),
),
],
),
),
],
),
);
}
}