@@ -112,7 +112,8 @@ class StreamVoiceRecordingAttachment extends StatelessWidget {
112
112
113
113
@override
114
114
Widget build (BuildContext context) {
115
- final theme = StreamVoiceRecordingTheme .of (context).playerTheme;
115
+ final theme = StreamVoiceRecordingAttachmentTheme .of (context);
116
+ final waveformSliderTheme = theme.audioWaveformSliderTheme;
116
117
117
118
final shape = this .shape ??
118
119
RoundedRectangleBorder (
@@ -157,6 +158,7 @@ class StreamVoiceRecordingAttachment extends StatelessWidget {
157
158
AudioDurationText (
158
159
duration: track.duration,
159
160
position: track.position,
161
+ style: theme.durationTextStyle,
160
162
),
161
163
const SizedBox (width: 8 ),
162
164
Expanded (
@@ -172,6 +174,14 @@ class StreamVoiceRecordingAttachment extends StatelessWidget {
172
174
onChangeStart: onTrackSeekStart,
173
175
onChanged: onTrackSeekChanged,
174
176
onChangeEnd: onTrackSeekEnd,
177
+ color: waveformSliderTheme? .color,
178
+ progressColor: waveformSliderTheme? .progressColor,
179
+ minBarHeight: waveformSliderTheme? .minBarHeight,
180
+ spacingRatio: waveformSliderTheme? .spacingRatio,
181
+ heightScale: waveformSliderTheme? .heightScale,
182
+ thumbColor: waveformSliderTheme? .thumbColor,
183
+ thumbBorderColor:
184
+ waveformSliderTheme? .thumbBorderColor,
175
185
),
176
186
),
177
187
),
@@ -229,6 +239,7 @@ class AudioDurationText extends StatelessWidget {
229
239
super .key,
230
240
required this .duration,
231
241
required this .position,
242
+ this .style,
232
243
});
233
244
234
245
/// The total duration of the audio track.
@@ -237,14 +248,15 @@ class AudioDurationText extends StatelessWidget {
237
248
/// The current position of the audio track.
238
249
final Duration position;
239
250
251
+ /// The style to apply to the duration text.
252
+ final TextStyle ? style;
253
+
240
254
@override
241
255
Widget build (BuildContext context) {
242
- final theme = StreamVoiceRecordingTheme .of (context).playerTheme;
243
-
244
256
if (position.inMilliseconds > 0 ) {
245
257
return Text (
246
258
position.toMinutesAndSeconds (),
247
- style: theme.timerTextStyle ? .copyWith (
259
+ style: style ? .copyWith (
248
260
// Use mono space for each num character.
249
261
fontFeatures: [const FontFeature .tabularFigures ()],
250
262
),
@@ -253,7 +265,7 @@ class AudioDurationText extends StatelessWidget {
253
265
254
266
return Text (
255
267
duration.toMinutesAndSeconds (),
256
- style: theme.timerTextStyle ? .copyWith (
268
+ style: style ? .copyWith (
257
269
// Use mono space for each num character.
258
270
fontFeatures: [const FontFeature .tabularFigures ()],
259
271
),
@@ -294,39 +306,21 @@ class AudioControlButton extends StatelessWidget {
294
306
295
307
@override
296
308
Widget build (BuildContext context) {
297
- final streamTheme = StreamChatTheme .of (context);
298
- final theme = StreamVoiceRecordingTheme .of (context).playerTheme;
309
+ final theme = StreamVoiceRecordingAttachmentTheme .of (context);
299
310
300
311
return ElevatedButton (
301
- style: ElevatedButton .styleFrom (
302
- elevation: theme.buttonElevation,
303
- padding: theme.buttonPadding,
304
- backgroundColor: theme.buttonBackgroundColor,
305
- disabledBackgroundColor: theme.buttonBackgroundColor,
306
- shape: theme.buttonShape,
307
- tapTargetSize: MaterialTapTargetSize .shrinkWrap,
308
- minimumSize: theme.buttonSize,
309
- ),
312
+ style: theme.audioControlButtonStyle,
310
313
onPressed: switch (state) {
311
314
TrackState .loading => null ,
312
315
TrackState .idle => onPlay,
313
316
TrackState .playing => onPause,
314
317
TrackState .paused => onPlay,
315
318
},
316
319
child: switch (state) {
317
- TrackState .loading => SizedBox .fromSize (
318
- size: const Size .square (24 - /* Padding */ 2 ),
319
- child: Center (
320
- child: CircularProgressIndicator .adaptive (
321
- valueColor: AlwaysStoppedAnimation (
322
- streamTheme.colorTheme.accentPrimary,
323
- ),
324
- ),
325
- ),
326
- ),
327
- TrackState .idle => Icon (theme.playIcon, color: theme.iconColor),
328
- TrackState .playing => Icon (theme.pauseIcon, color: theme.iconColor),
329
- TrackState .paused => Icon (theme.playIcon, color: theme.iconColor),
320
+ TrackState .loading => theme.loadingIndicator,
321
+ TrackState .idle => theme.playIcon,
322
+ TrackState .playing => theme.pauseIcon,
323
+ TrackState .paused => theme.playIcon,
330
324
},
331
325
);
332
326
}
@@ -353,24 +347,17 @@ class SpeedControlButton extends StatelessWidget {
353
347
354
348
@override
355
349
Widget build (BuildContext context) {
356
- final theme = StreamVoiceRecordingTheme .of (context).playerTheme ;
350
+ final theme = StreamVoiceRecordingAttachmentTheme .of (context);
357
351
358
352
return ElevatedButton (
359
- style: ElevatedButton .styleFrom (
360
- elevation: theme.speedButtonElevation,
361
- backgroundColor: theme.speedButtonBackgroundColor,
362
- padding: theme.speedButtonPadding,
363
- shape: theme.speedButtonShape,
364
- tapTargetSize: MaterialTapTargetSize .shrinkWrap,
365
- minimumSize: theme.speedButtonSize,
366
- ),
367
- onPressed: () {
368
- final nextSpeed = speed.next;
369
- onChangeSpeed? .call (nextSpeed);
353
+ style: theme.speedControlButtonStyle,
354
+ onPressed: switch (onChangeSpeed) {
355
+ final it? => () => it (speed.next),
356
+ _ => null ,
370
357
},
371
358
child: Text (
372
359
'x${speed .speed }' ,
373
- style: theme.speedButtonTextStyle ,
360
+ style: theme.playbackSpeedTextStyle ,
374
361
),
375
362
);
376
363
}
0 commit comments