fix masalan

This commit is contained in:
Amir Hossein Mousavi 2024-09-25 15:40:45 +03:30
parent 1f72573909
commit d423053603
4 changed files with 26 additions and 16 deletions

View File

@ -69,5 +69,11 @@
<array>
<string>dev.flutter.background.refresh</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
</dict>
</plist>

View File

@ -52,7 +52,16 @@ class _AudioWaveState extends State<AudioWave> {
totalDuration = widget.totalDuration;
}
});
// listeners();
listeners();
}
void listeners() async {
VoiceService.audioPlayer.playerStateStream.listen((event) async {
if (event.processingState == ProcessingState.completed) {
await VoiceService.audioPlayer.pause();
await VoiceService.audioPlayer.seek(Duration.zero);
}
});
}
@override
@ -71,18 +80,12 @@ class _AudioWaveState extends State<AudioWave> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
StreamBuilder<PlaybackEvent>(
stream: VoiceService.audioPlayer.playbackEventStream,
StreamBuilder<PlayerState>(
stream: VoiceService.audioPlayer.playerStateStream,
builder: (context, snapshot) {
if (!snapshot.hasData) {
return const SizedBox();
}
if (snapshot.data!.processingState ==
ProcessingState.completed) {
VoiceService.audioPlayer.pause();
VoiceService.audioPlayer.seek(Duration.zero);
}
if ((snapshot.data!.processingState ==
ProcessingState.loading ||
snapshot.data!.processingState ==

View File

@ -67,7 +67,7 @@ class DirectState extends CoreProvier {
isRecording = true;
Directory? tempDir;
if (!kIsWeb) {
tempDir = await getDownloadsDirectory();
tempDir = await getApplicationDocumentsDirectory();
}
_recorder.start(const RecordConfig(),
path: kIsWeb

View File

@ -1,6 +1,7 @@
// ignore_for_file: library_private_types_in_public_api, deprecated_member_use
import 'package:didvan/constants/assets.dart';
import 'package:didvan/views/widgets/didvan/text.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
@ -74,12 +75,12 @@ class _WebViewState extends State<WebView> {
}
},
child: Scaffold(
// appBar: AppBar(
// title: const DidvanText(
// 'بازگشت به دیدوان',
// ),
// leading: const BackButton(),
// ),
appBar: AppBar(
title: const DidvanText(
'بازگشت به دیدوان',
),
leading: const BackButton(),
),
body: loading
? Center(
child: Image.asset(