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

70 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 ReceiveMessageWidget extends StatelessWidget {
const ReceiveMessageWidget(this.userName, this.avatar,
{this.child, super.key});
final String userName;
final AssetImage avatar;
final Widget? child;
@override
Widget build(BuildContext context) {
return Container(
margin: REdgeInsets.only(bottom: 12.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: 60.h,
width: 60.h,
decoration: BoxDecoration(
color: Colors.transparent,
borderRadius: BorderRadius.circular(9).r,
image: DecorationImage(
image: avatar,
fit: BoxFit.fill,
),
),
),
Gaps.hGap12,
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: REdgeInsets.only(left: 10.0),
child: Text(
userName,
style: TextStyles.mediumGray9912,
),
),
Gaps.vGap9,
BubbleBox(
shape: BubbleShapeBorder(
direction: BubbleDirection.left,
position: const BubblePosition.start(12.0),
arrowQuadraticBezierLength: 2.0,
arrowAngle: 8.0,
arrowHeight: 8.0,
),
backgroundColor: Colors.white,
padding: REdgeInsets.only(
left: 21.0, top: 12.0, bottom: 12.0, right: 21.0),
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 710.0).w,
child: child,
),
),
],
),
),
],
),
);
}
}