Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #29

Merged
merged 19 commits into from
May 13, 2024
Merged

Dev #29

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions amplify/.config/project-config.json

This file was deleted.

8 changes: 0 additions & 8 deletions amplify/README.md

This file was deleted.

28 changes: 0 additions & 28 deletions amplify/backend/auth/franz/parameters.json

This file was deleted.

85 changes: 0 additions & 85 deletions amplify/backend/backend-config.json

This file was deleted.

4 changes: 0 additions & 4 deletions amplify/backend/storage/franz0ccd55f7/parameters.json

This file was deleted.

10 changes: 0 additions & 10 deletions amplify/backend/tags.json

This file was deleted.

1 change: 0 additions & 1 deletion amplify/backend/types/amplify-dependent-resources-ref.d.ts

This file was deleted.

63 changes: 0 additions & 63 deletions amplify/cli.json

This file was deleted.

7 changes: 0 additions & 7 deletions amplify/hooks/README.md

This file was deleted.

35 changes: 0 additions & 35 deletions amplify/team-provider-info.json

This file was deleted.

20 changes: 17 additions & 3 deletions lib/components/audio_player.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:audioplayers/audioplayers.dart';
import 'package:flutter/material.dart';
import 'package:franz/services/api_service.dart';

class AudioPlayerButton extends StatefulWidget {
final String audioUrl;
Expand Down Expand Up @@ -99,6 +100,8 @@ class _NewAudioPlayerButtonState extends State<NewAudioPlayerButton>
late AnimationController _animationController;
late bool _isPlaying;
final UniqueKey _key = UniqueKey();
String path = '';
bool _fetchingFile = false;

@override
void initState() {
Expand All @@ -124,16 +127,27 @@ class _NewAudioPlayerButtonState extends State<NewAudioPlayerButton>
}
return TextButton(
key: _key,
onPressed: () {
onPressed: () async {
if (_isPlaying) {
_animationController.reverse();
} else {
_animationController.forward();
}
_isPlaying = !_isPlaying;
widget.changePlayerState(_key, widget.audioLink);
if(_isPlaying){
setState(() {
_fetchingFile = true;
});
path = await ApiService().loadAudio(widget.audioLink);
setState(() {
_fetchingFile = false;
widget.changePlayerState(_key, path);
});
}
widget.changePlayerState(_key, path);
},
child: AnimatedIcon(
child: _fetchingFile ? const CircularProgressIndicator():
AnimatedIcon(
icon: AnimatedIcons.play_pause,
progress: _animationController,
),
Expand Down
Loading