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

69 lines
2.1 KiB
Dart
Raw Permalink Normal View History

2023-11-28 10:44:58 +08:00
import 'package:bubble_box/bubble_box.dart';
import 'package:dreampad/app/shared/shared.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class SendMessageWidget extends StatelessWidget {
const SendMessageWidget(this.text, this.userName, this.avatar, {super.key});
final String text;
final String userName;
final AssetImage avatar;
@override
Widget build(BuildContext context) {
return Container(
margin: REdgeInsets.only(bottom: 12),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
userName,
style: TextStyles.mediumGray9915,
),
Gaps.vGap9,
BubbleBox(
shape: BubbleShapeBorder(
direction: BubbleDirection.right,
position: const BubblePosition.start(12.0),
arrowQuadraticBezierLength: 2.0,
arrowAngle: 8.0,
arrowHeight: 8.0,
),
backgroundColor: const Color(0xFF823CE0),
padding: REdgeInsets.only(
left: 21.0, top: 12.0, bottom: 12.0, right: 21.0),
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 600.0).w,
child: Text(
text,
style: TextStyles.mediumWhite15,
),
),
),
],
),
),
Gaps.hGap12,
Container(
height: 60.h,
width: 60.h,
decoration: BoxDecoration(
color: Colors.transparent,
borderRadius: BorderRadius.circular(9.0).r,
image: DecorationImage(
image: avatar,
fit: BoxFit.fill,
),
),
),
],
),
);
}
}