动我项目仓库 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.
 
 
 
 
 
 

64 lines
1.8 KiB

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class MyMessage extends StatefulWidget {
final String avatar;
final String message;
const MyMessage({super.key, required this.avatar, required this.message});
@override
State<MyMessage> createState() => _MyMessageState();
}
class _MyMessageState extends State<MyMessage> {
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(bottom: 30.w),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.end,
children: [
SizedBox(
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(
topLeft: Radius.circular(18.w),
bottomRight: Radius.circular(18.w),
bottomLeft: Radius.circular(18.w),
),
color: const Color.fromRGBO(117, 98, 249, 1)
),
child: Text(
widget.message,
style: TextStyle(
fontSize: 31.w,
color: Colors.white,
),
),
)
),
SizedBox(width: 15.w,),
Image.asset(
widget.avatar,
width: 62.w,
height: 62.w,
),
],
),
);
}
}