build method
image bubble builder method
Implementation
@override
Widget build(BuildContext context) {
bool stateTick = false;
Icon? stateIcon;
if (sent) {
stateTick = true;
stateIcon = Icon(
Icons.done,
size: 18,
color: Color(0xFF97AD8E),
);
}
if (delivered) {
stateTick = true;
stateIcon = Icon(
Icons.done_all,
size: 18,
color: Color(0xFF97AD8E),
);
}
if (seen) {
stateTick = true;
stateIcon = Icon(
Icons.done_all,
size: 18,
color: Color(0xFF92DEDA),
);
}
return Row(
children: <Widget>[
isSender
? const Expanded(
child: SizedBox(
width: 5,
),
)
: leading ?? Container(),
Container(
padding: padding,
margin: margin,
constraints: BoxConstraints(
maxWidth: MediaQuery.of(context).size.width * .5,
maxHeight: MediaQuery.of(context).size.width * .5,
),
child: GestureDetector(
child: Hero(
tag: id,
child: Stack(
children: [
Container(
decoration: BoxDecoration(
color: color,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(bubbleRadius),
topRight: Radius.circular(bubbleRadius),
bottomLeft: Radius.circular(tail
? isSender
? bubbleRadius
: 0
: BUBBLE_RADIUS_IMAGE),
bottomRight: Radius.circular(tail
? isSender
? 0
: bubbleRadius
: BUBBLE_RADIUS_IMAGE),
),
),
child: Padding(
padding: const EdgeInsets.all(4.0),
child: ClipRRect(
borderRadius: BorderRadius.circular(bubbleRadius),
child: image,
),
),
),
stateIcon != null && stateTick
? Positioned(
bottom: 4,
right: 6,
child: stateIcon,
)
: SizedBox(
width: 1,
),
],
),
),
onLongPress: onLongPress,
onTap: onTap ??
() {
Navigator.push(context, MaterialPageRoute(builder: (_) {
return _DetailScreen(
tag: id,
image: image,
);
}));
}),
),
if (isSender && trailing != null) SizedBox.shrink(),
],
);
}