chore: Adjust chat input row design
This commit is contained in:
parent
402801c458
commit
c5b683f842
2 changed files with 72 additions and 57 deletions
|
|
@ -364,6 +364,13 @@ class ChatInputRow extends StatelessWidget {
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
|
margin: EdgeInsets.only(
|
||||||
|
bottom: height + 16,
|
||||||
|
left: 16,
|
||||||
|
right: 16,
|
||||||
|
top: 16,
|
||||||
|
),
|
||||||
|
showCloseIcon: true,
|
||||||
content: Text(
|
content: Text(
|
||||||
L10n.of(
|
L10n.of(
|
||||||
context,
|
context,
|
||||||
|
|
|
||||||
|
|
@ -22,78 +22,86 @@ class RecordingInputRow extends StatelessWidget {
|
||||||
'${state.duration.inMinutes.toString().padLeft(2, '0')}:${(state.duration.inSeconds % 60).toString().padLeft(2, '0')}';
|
'${state.duration.inMinutes.toString().padLeft(2, '0')}:${(state.duration.inSeconds % 60).toString().padLeft(2, '0')}';
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: ChatInputRow.height,
|
height: ChatInputRow.height,
|
||||||
child: Padding(
|
child: Row(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
crossAxisAlignment: .center,
|
||||||
child: Row(
|
mainAxisAlignment: .spaceBetween,
|
||||||
crossAxisAlignment: .center,
|
children: [
|
||||||
mainAxisAlignment: .spaceBetween,
|
const SizedBox(width: 4),
|
||||||
spacing: 8,
|
Container(
|
||||||
children: [
|
alignment: .center,
|
||||||
IconButton(
|
width: 48,
|
||||||
|
child: IconButton(
|
||||||
tooltip: L10n.of(context).cancel,
|
tooltip: L10n.of(context).cancel,
|
||||||
icon: const Icon(Icons.delete_outlined),
|
icon: const Icon(Icons.delete_outlined),
|
||||||
color: theme.colorScheme.error,
|
color: theme.colorScheme.error,
|
||||||
onPressed: state.cancel,
|
onPressed: state.cancel,
|
||||||
),
|
),
|
||||||
if (state.isPaused)
|
),
|
||||||
IconButton(
|
if (state.isPaused)
|
||||||
|
Container(
|
||||||
|
alignment: .center,
|
||||||
|
width: 48,
|
||||||
|
child: IconButton(
|
||||||
tooltip: L10n.of(context).resume,
|
tooltip: L10n.of(context).resume,
|
||||||
icon: const Icon(Icons.play_circle_outline_outlined),
|
icon: const Icon(Icons.play_circle_outline_outlined),
|
||||||
onPressed: state.resume,
|
onPressed: state.resume,
|
||||||
)
|
),
|
||||||
else
|
)
|
||||||
IconButton(
|
else
|
||||||
|
Container(
|
||||||
|
alignment: .center,
|
||||||
|
width: 48,
|
||||||
|
child: IconButton(
|
||||||
tooltip: L10n.of(context).pause,
|
tooltip: L10n.of(context).pause,
|
||||||
icon: const Icon(Icons.pause_circle_outline_outlined),
|
icon: const Icon(Icons.pause_circle_outline_outlined),
|
||||||
onPressed: state.pause,
|
onPressed: state.pause,
|
||||||
),
|
),
|
||||||
Text(time),
|
),
|
||||||
Expanded(
|
Text(time),
|
||||||
child: LayoutBuilder(
|
Expanded(
|
||||||
builder: (context, constraints) {
|
child: LayoutBuilder(
|
||||||
const width = 4;
|
builder: (context, constraints) {
|
||||||
return Row(
|
const width = 4;
|
||||||
mainAxisSize: .min,
|
return Row(
|
||||||
mainAxisAlignment: .end,
|
mainAxisSize: .min,
|
||||||
children: state.amplitudeTimeline.reversed
|
mainAxisAlignment: .end,
|
||||||
.take((constraints.maxWidth / (width + 2)).floor())
|
children: state.amplitudeTimeline.reversed
|
||||||
.toList()
|
.take((constraints.maxWidth / (width + 2)).floor())
|
||||||
.reversed
|
.toList()
|
||||||
.map(
|
.reversed
|
||||||
(amplitude) => Container(
|
.map(
|
||||||
margin: const EdgeInsets.only(left: 2),
|
(amplitude) => Container(
|
||||||
width: width.toDouble(),
|
margin: const EdgeInsets.only(left: 2),
|
||||||
decoration: BoxDecoration(
|
width: width.toDouble(),
|
||||||
color: theme.colorScheme.primary,
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(2),
|
color: theme.colorScheme.primary,
|
||||||
),
|
borderRadius: BorderRadius.circular(2),
|
||||||
height: maxDecibalWidth * (amplitude / 100),
|
|
||||||
),
|
),
|
||||||
)
|
height: maxDecibalWidth * (amplitude / 100),
|
||||||
.toList(),
|
),
|
||||||
);
|
)
|
||||||
},
|
.toList(),
|
||||||
),
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
IconButton(
|
),
|
||||||
style: IconButton.styleFrom(
|
IconButton(
|
||||||
disabledBackgroundColor: theme.bubbleColor.withAlpha(128),
|
style: IconButton.styleFrom(
|
||||||
backgroundColor: theme.bubbleColor,
|
disabledBackgroundColor: theme.bubbleColor.withAlpha(128),
|
||||||
foregroundColor: theme.onBubbleColor,
|
backgroundColor: theme.bubbleColor,
|
||||||
),
|
foregroundColor: theme.onBubbleColor,
|
||||||
tooltip: L10n.of(context).sendAudio,
|
|
||||||
icon: state.isSending
|
|
||||||
? const SizedBox.square(
|
|
||||||
dimension: 24,
|
|
||||||
child: CircularProgressIndicator.adaptive(),
|
|
||||||
)
|
|
||||||
: const Icon(Icons.send_outlined),
|
|
||||||
onPressed: state.isSending
|
|
||||||
? null
|
|
||||||
: () => state.stopAndSend(onSend),
|
|
||||||
),
|
),
|
||||||
],
|
tooltip: L10n.of(context).sendAudio,
|
||||||
),
|
icon: state.isSending
|
||||||
|
? const SizedBox.square(
|
||||||
|
dimension: 24,
|
||||||
|
child: CircularProgressIndicator.adaptive(),
|
||||||
|
)
|
||||||
|
: const Icon(Icons.send_outlined),
|
||||||
|
onPressed: state.isSending ? null : () => state.stopAndSend(onSend),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue