Skip to content

Commit f3cf776

Browse files
Logic fix and docs
1 parent f7bb902 commit f3cf776

File tree

8 files changed

+29
-19
lines changed

8 files changed

+29
-19
lines changed

packages/stream_chat_flutter/lib/src/attachment/audio/audio_player_attachment.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ class _AudioPlayerMessageState extends State<AudioPlayerMessage> {
129129
builder: (context, snapshot) {
130130
final state = snapshot.data ?? ProcessingState.idle;
131131
if (state == ProcessingState.ready ||
132-
state == ProcessingState.idle) {
132+
state == ProcessingState.idle ||
133+
!playingThis) {
133134
return ElevatedButton(
134135
style: ElevatedButton.styleFrom(
135136
elevation: 2,

packages/stream_chat_flutter/lib/src/attachment/audio/audio_player_compose_message.dart

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,23 @@ import 'package:just_audio/just_audio.dart';
66
import 'package:stream_chat_flutter/src/attachment/audio/audio_player_attachment.dart';
77
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
88

9-
/// Docs
9+
/// {@template audioListPlayer}
10+
/// AudioPlayer intended to be used inside message composer. This audio player
11+
/// plays only one music at a time.
12+
/// {@endtemplate}
1013
class AudioPlayerComposeMessage extends StatefulWidget {
11-
/// Docs
14+
/// {@macro audioListPlayer}
1215
const AudioPlayerComposeMessage({
1316
super.key,
1417
required this.attachment,
1518
this.actionButton,
1619
});
1720

18-
/// Docs
21+
/// Attachment of the audio
1922
final Attachment attachment;
2023

21-
/// Docs
24+
/// An action button to that can be used to perform actions. Example: Delete
25+
/// audio from compose.
2226
final Widget? actionButton;
2327

2428
@override

packages/stream_chat_flutter/lib/src/attachment/audio/record_controller.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import 'package:stream_chat_flutter/src/attachment/audio/wave_bars_normalizer.da
88
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
99

1010
/// {@template recordController}
11-
/// Controller of audio record
11+
/// Controller of audio record. This call can be used to controll the recording
12+
/// logic programmatically.
1213
/// {@endtemplate}
1314
class StreamRecordController {
1415
/// {@macro WaveBarsNormalizer}
@@ -34,7 +35,7 @@ class StreamRecordController {
3435
/// A Stream that provides the amplitude variation of the record.
3536
Stream<Amplitude> get amplitudeStream => _amplitudeController.stream;
3637

37-
/// Docs
38+
/// Initialization of the controller.
3839
void init() {
3940
_amplitudeSink = _amplitudeController.sink;
4041
_amplitudeSink?.addStream(

packages/stream_chat_flutter/lib/src/message_input/on_press_button.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class OnPressButton extends StatelessWidget {
8686
/// The action to perform when the button is pressed or clicked.
8787
final VoidCallback onPressed;
8888

89-
///Docs
89+
/// Padding of button.
9090
final EdgeInsetsGeometry? padding;
9191

9292
/// Returns a copy of this object with the given fields updated.

packages/stream_chat_flutter/lib/src/message_input/record/record_button.dart

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import 'package:flutter/material.dart';
22
import 'package:stream_chat_flutter/src/misc/stream_svg_icon.dart';
33

4-
///Docs
4+
/// {@template recordButton}
5+
/// Record button that start the recording process. This button doesn't have
6+
/// any logic related to recording, this should be provided in the callbacks.
7+
/// This button allows to set callback to onHold and onPressed.
8+
/// {@endtemplate}
59
class RecordButton extends StatelessWidget {
6-
///Docs
10+
/// {@macro recordButton}
711
const RecordButton({
812
super.key,
913
required this.icon,
@@ -34,7 +38,7 @@ class RecordButton extends StatelessWidget {
3438
/// Icon of the button.
3539
final Widget icon;
3640

37-
///Docs
41+
/// Padding of button
3842
final EdgeInsetsGeometry? padding;
3943

4044
/// Returns a copy of this object with the given fields updated.

packages/stream_chat_flutter/lib/src/message_input/record/record_field.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ import 'package:stream_chat_flutter/src/message_input/on_press_button.dart';
66
import 'package:stream_chat_flutter/src/message_input/record/record_timer_widget.dart';
77
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
88

9-
///Docs
9+
/// {@template recordField}
10+
/// Record field. The version of text input of StreamMessageInput, but for
11+
/// recording audio messages.
12+
/// {@endtemplate}
1013
class RecordField extends StatelessWidget {
11-
///Docs
14+
/// {@macro recordField}
1215
const RecordField({
1316
super.key,
1417
required this.recordController,
@@ -21,7 +24,7 @@ class RecordField extends StatelessWidget {
2124
this.onAudioRecorded,
2225
});
2326

24-
///Docs
27+
/// Controller of record.
2528
final StreamRecordController recordController;
2629

2730
/// Builder for customizing the resumeRecord button.

packages/stream_chat_flutter/lib/src/message_input/stream_message_input.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ class StreamMessageInputState extends State<StreamMessageInput>
361361
_controller = StreamRestorableMessageInputController(message: message);
362362
}
363363

364-
void _createLocalRecordController([Message? message]) {
364+
void _createLocalRecordController() {
365365
_recordControllerInstance = StreamRecordController(audioRecorder: Record());
366366
}
367367

packages/stream_chat_flutter/test/src/mocks.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ class MockRecorder extends Mock implements Record {
1313
}
1414

1515
class MockStreamRecordController extends Mock
16-
implements StreamRecordController {
17-
18-
19-
}
16+
implements StreamRecordController {}
2017

2118
class MockClient extends Mock implements StreamChatClient {
2219
MockClient() {

0 commit comments

Comments
 (0)