You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

125 lines
4.0 KiB

import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'custom_image.dart';
class MessageItem extends StatefulWidget {
final int stStatus;
MessageItem(this.stStatus);
@override
_MessageItemState createState() => _MessageItemState();
}
class _MessageItemState extends State<MessageItem> {
@override
Widget build(BuildContext context) {
return Row(
children: [
if (widget.stStatus != 0) checkView(),
Container(
margin: EdgeInsets.only(left: widget.stStatus == 0 ? 16 : 0),
child: MImage(
"https://t7.baidu.com/it/u=1297102096,3476971300&fm=193&f=GIF",
width: 44.w,
fit: BoxFit.cover,
height: 44.h,
),
),
Expanded(
flex: 1,
child: Container(
margin: EdgeInsets.only(left: 16.w, right: 16.w),
height: 44.h,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
S.of(context).xitongtongzhi,
style: TextStyle(
fontWeight: FontWeight.w500,
fontSize: 14.sp,
color: Color(0xFF060606)),
),
Text(
"2021.03.08 13:22",
style: TextStyle(
fontSize: 10.sp,
fontWeight: FontWeight.w400,
color: Color(0xFFA29E9E),
),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
flex: 1,
child: Text(
"2021由她上,三八妇女节感恩回馈!三八妇女节,五一劳动节,六一儿童节",
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 10.sp,
fontWeight: FontWeight.w400,
color: Color(0xFF353535),
),
)),
if (widget.stStatus == 0)
Container(
width: 10.w,
height: 10.h,
alignment: Alignment.center,
margin: EdgeInsets.only(left: 17.w),
decoration: BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.circular(5)),
child: Text(
"1",
style: TextStyle(
fontSize: 7.sp,
fontWeight: FontWeight.w400,
color: Color(0xFFFFFFFF),
),
),
)
],
),
],
),
),
),
],
);
}
var _isCheck = false;
Widget checkView() {
return GestureDetector(
onTap: () {
setState(() {
_isCheck = !_isCheck;
});
},
child: Container(
padding: EdgeInsets.all(16),
alignment: Alignment.center,
child: Image.asset(
_isCheck
? "assets/image/icon_radio_unselected.webp"
: "assets/image/icon_radio_selected.webp",
width: 16.w,
height: 16.h,
)),
);
}
}