动我项目仓库 flutter:3.22 dart:3.4.4
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.
 
 
 
 
 
 

63 lines
1.7 KiB

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class ChatMessage extends StatefulWidget {
final String avatar;
final String message;
const ChatMessage({super.key, required this.avatar, required this.message});
@override
State<ChatMessage> createState() => _ChatMessageState();
}
class _ChatMessageState extends State<ChatMessage> {
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(bottom: 30.w),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset(
widget.avatar,
width: 62.w,
height: 62.w,
),
SizedBox(width: 15.w,),
Flexible(
fit: FlexFit.loose,
child:Container(
margin: EdgeInsets.only(top: 10.w),
padding: EdgeInsets.only(
top: 31.w,
left: 46.w,
bottom: 31.w,
right: 39.w
),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topRight: Radius.circular(18.w),
bottomRight: Radius.circular(18.w),
bottomLeft: Radius.circular(18.w),
),
color: Colors.white
),
child: Text(
widget.message,
style: TextStyle(
fontSize: 31.w,
color: const Color.fromRGBO(51, 51, 51, 1),
),
),
)
),
SizedBox(width: 15.w,),
SizedBox(
width: 62.w,
height: 62.w,
)
],
),
);
}
}