dreampad/lib/app/modules/home/widgets/user_widget.dart

77 lines
2.2 KiB
Dart
Raw Normal View History

2023-11-28 10:44:58 +08:00
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,
2023-11-30 15:21:27 +08:00
required this.occupationId,
2023-11-28 10:44:58 +08:00
});
final String account;
final int gender;
final String occupationName;
2023-11-30 15:21:27 +08:00
final int occupationId;
2023-11-28 10:44:58 +08:00
@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: [
2023-11-30 15:21:27 +08:00
switch(gender) {
2 => switch(occupationId) {
5 => Images.homeAvatarPainterMale,
_ => Images.homeAvatarAcademicianMale,
},
_ => switch(occupationId) {
5 => Images.homeAvatarPainterFemale,
_ => Images.homeAvatarAcademicianFemale,
},
},
2023-11-28 10:44:58 +08:00
Container(
2023-12-02 16:23:00 +08:00
padding: REdgeInsets.all(5.0),
2023-11-28 10:44:58 +08:00
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,
),
),
],
),
),
],
),
);
}
}