14 changed files with 231 additions and 26 deletions
-
4assets/images/unmusic.svg
-
1lib/common_ui/resources/my_assets.dart
-
6lib/core/routers/my_routes.dart
-
81lib/core/services/audio_service.dart
-
11lib/features/home/presentation/bloc/home_bloc.dart
-
34lib/features/home/presentation/ui/home_page.dart
-
11lib/features/level/presentation/bloc/level_bloc.dart
-
13lib/features/level/presentation/ui/level_page.dart
-
18lib/features/question/presentation/bloc/question_bloc.dart
-
9lib/features/question/presentation/ui/question_page.dart
-
2lib/features/question/presentation/ui/widgets/glassy_button.dart
-
2lib/init_bindings.dart
-
64pubspec.lock
-
1pubspec.yaml
@ -0,0 +1,4 @@ |
|||
<svg width="25" height="26" viewBox="0 0 25 26" fill="none" xmlns="http://www.w3.org/2000/svg"> |
|||
<path d="M19.2388 2.93567C19.6559 2.86189 20.0869 2.92457 20.4624 3.11438C20.6268 3.19751 20.7749 3.30445 20.9058 3.42786L14.8003 10.6486L9.06885 11.6505V17.4279L5.28369 21.9034C4.89628 21.9358 4.50419 21.9177 4.11865 21.8439C3.31513 21.69 2.57688 21.3098 1.99756 20.7521C1.41823 20.1943 1.02361 19.4838 0.86377 18.7101C0.703931 17.9364 0.785586 17.1342 1.09912 16.4054C1.41265 15.6767 1.94341 15.0536 2.62451 14.6154C3.30572 14.1771 4.10699 13.9435 4.92627 13.9435C5.87728 13.9453 6.79857 14.2623 7.53564 14.8409V7.45227C7.52417 6.76299 7.7665 6.09178 8.21924 5.55774C8.6832 5.03604 9.32023 4.68401 10.022 4.56067L19.2388 2.93567ZM21.4653 16.8654C21.4635 17.7688 21.1426 18.6454 20.5562 19.3507C19.9697 20.0558 19.1519 20.5488 18.2368 20.7482C17.3215 20.9475 16.3628 20.841 15.5181 20.4474C14.6735 20.0538 13.9929 19.3959 13.5874 18.5812C13.2766 17.9567 13.1423 17.2688 13.1909 16.5851L16.2056 13.0197C16.5695 12.9214 16.9474 12.8686 17.3306 12.8693C18.269 12.871 19.179 13.1795 19.9116 13.7443V9.75598L18.8013 9.94934L21.4653 6.79895V16.8654Z" fill="#E4E3F7"/> |
|||
<rect x="22.1079" y="0.460083" width="2.60346" height="30.3502" transform="rotate(40.2151 22.1079 0.460083)" fill="#E4E3F7"/> |
|||
</svg> |
|||
@ -0,0 +1,81 @@ |
|||
import 'package:flutter/foundation.dart'; |
|||
import 'package:just_audio/just_audio.dart'; |
|||
|
|||
class AudioService { |
|||
final AudioPlayer _player = AudioPlayer(); |
|||
|
|||
Future<Duration?> setAudio({String? filePath}) async { |
|||
try { |
|||
return _player.setAudioSource(AudioSource.file(filePath ?? '')); |
|||
} catch (e) { |
|||
if (kDebugMode) { |
|||
print('$e'); |
|||
} |
|||
return Duration.zero; |
|||
} |
|||
} |
|||
|
|||
Future<void> play() async { |
|||
try { |
|||
return _player.play(); |
|||
} catch (e) { |
|||
if (kDebugMode) { |
|||
print('$e'); |
|||
} |
|||
} |
|||
} |
|||
|
|||
Future<void> pause() async { |
|||
try { |
|||
return _player.pause(); |
|||
} catch (e) { |
|||
if (kDebugMode) { |
|||
print('$e'); |
|||
} |
|||
} |
|||
} |
|||
|
|||
Future<void> stop() async { |
|||
try { |
|||
return _player.stop(); |
|||
} catch (e) { |
|||
if (kDebugMode) { |
|||
print('$e'); |
|||
} |
|||
} |
|||
} |
|||
|
|||
Future<void> dispose() async { |
|||
try { |
|||
return _player.dispose(); |
|||
} catch (e) { |
|||
if (kDebugMode) { |
|||
print('$e'); |
|||
} |
|||
} |
|||
} |
|||
|
|||
Future<void> changeMute() async { |
|||
try { |
|||
if (_player.volume == 0) { |
|||
await _player.setVolume(1); |
|||
} else { |
|||
await _player.setVolume(0); |
|||
} |
|||
} catch (e) { |
|||
if (kDebugMode) { |
|||
print('$e'); |
|||
} |
|||
} |
|||
} |
|||
|
|||
Stream<double> volumeStream() async* { |
|||
try { |
|||
yield* _player.volumeStream; |
|||
} catch (e) { |
|||
if (kDebugMode) { |
|||
print('$e'); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue