build method
chat 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
? Expanded(
child: SizedBox(
width: 5,
),
)
: Container(),
Container(
color: Colors.transparent,
constraints: constraints ??
BoxConstraints(
maxWidth: MediaQuery.of(context).size.width * .8,
maxHeight: 70),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 2),
child: 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_AUDIO),
bottomRight: Radius.circular(tail
? isSender
? 0
: bubbleRadius
: BUBBLE_RADIUS_AUDIO),
),
),
child: Stack(
children: [
Row(
children: [
RawMaterialButton(
onPressed: onPlayPauseButtonClick,
elevation: 1.0,
fillColor: Colors.white,
child: !isPlaying
? Icon(
Icons.play_arrow,
size: 30.0,
)
: isLoading
? CircularProgressIndicator()
: isPause
? Icon(
Icons.play_arrow,
size: 30.0,
)
: Icon(
Icons.pause,
size: 30.0,
),
padding: EdgeInsets.all(0.0),
shape: CircleBorder(),
),
Expanded(
child: Slider(
min: 0.0,
max: duration ?? 0.0,
value: position ?? 0.0,
onChanged: onSeekChanged,
),
),
],
),
Positioned(
bottom: 8,
right: 25,
child: Text(
'${audioTimer(duration ?? 0.0, position ?? 0.0)}',
style: textStyle,
),
),
stateIcon != null && stateTick
? Positioned(
bottom: 4,
right: 6,
child: stateIcon,
)
: SizedBox(
width: 1,
),
],
),
),
),
),
],
);
}