loggedInUserBoilerPlate function
Implementation
Widget loggedInUserBoilerPlate({
required BuildContext ctx,
required ChatTheme theme,
required String time,
required int stage,
required Widget child,
required bool showAvatar,
required bool showMessageStatus,
required bool showName,
required User user,
}) {
return Padding(
padding: theme.messageMargin,
child: Row(
children: [
const Spacer(),
ConstrainedBox(
constraints: BoxConstraints(
maxWidth: MediaQuery.of(ctx).size.width * (theme.messageWidth),
),
child: IntrinsicWidth(
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Container(
decoration: BoxDecoration(
color: theme.outwardMessageBackgroundColor,
borderRadius: theme.outwardMessageBorderRadius,
),
child: IntrinsicWidth(child: child),
),
const SizedBox(
height: 5,
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
showMessageStatus
? Row(
children: [
buildMessageStatus(stage, theme),
const SizedBox(
width: 20,
),
],
)
: SizedBox(),
Text(
time,
style: theme.timeTextStyle,
textAlign: TextAlign.end,
),
showName
? Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(
width: 20,
),
Text(
"You",
style: theme.usernameTextStyle
.copyWith(color: user.color),
),
const SizedBox(
width: 5,
),
user.isVerified
? theme.verificationBadge
: Container(),
],
)
: Container(),
!showName && showAvatar
? Container()
: const SizedBox(
width: 20,
),
showAvatar
? UserAvatar(user: user, theme: theme)
: Container(),
],
),
],
),
),
),
],
),
);
}