Lyrics & sync with album color

This commit is contained in:
2024-08-28 18:41:32 +08:00
parent 289ea3ce40
commit 70039a4901
13 changed files with 455 additions and 38 deletions

View File

@ -0,0 +1,35 @@
import 'package:flutter/material.dart';
import 'package:rhythm_box/widgets/lyrics/synced.dart';
import 'package:rhythm_box/widgets/player/bottom_player.dart';
class LyricsScreen extends StatelessWidget {
const LyricsScreen({super.key});
@override
Widget build(BuildContext context) {
return Material(
color: Theme.of(context).colorScheme.surface,
child: Scaffold(
appBar: AppBar(
title: const Text('Lyrics'),
),
body: const Column(
children: [
Expanded(
child: SyncedLyrics(
defaultTextZoom: 67,
),
),
],
),
bottomNavigationBar: const SizedBox(
height: 83,
child: Material(
elevation: 2,
child: BottomPlayer(usePop: true),
),
),
),
);
}
}

View File

@ -5,6 +5,7 @@ import 'package:dismissible_page/dismissible_page.dart';
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:get/get.dart';
import 'package:go_router/go_router.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:media_kit/media_kit.dart';
import 'package:rhythm_box/providers/audio_player.dart';
@ -16,14 +17,7 @@ import 'package:rhythm_box/services/audio_services/image.dart';
import 'package:rhythm_box/widgets/tracks/querying_track_info.dart';
class PlayerScreen extends StatefulWidget {
final Duration durationCurrent, durationTotal, durationBuffered;
const PlayerScreen({
super.key,
required this.durationCurrent,
required this.durationTotal,
required this.durationBuffered,
});
const PlayerScreen({super.key});
@override
State<PlayerScreen> createState() => _PlayerScreenState();
@ -72,9 +66,9 @@ class _PlayerScreenState extends State<PlayerScreen> {
@override
void initState() {
super.initState();
_durationCurrent = widget.durationCurrent;
_durationTotal = widget.durationTotal;
_bufferProgress = widget.durationBuffered.inMilliseconds.toDouble();
_durationCurrent = audioPlayer.position;
_durationTotal = audioPlayer.duration;
_bufferProgress = audioPlayer.bufferedPosition.inMilliseconds.toDouble();
_subscriptions = [
audioPlayer.durationStream
.listen((dur) => setState(() => _durationTotal = dur)),
@ -298,7 +292,9 @@ class _PlayerScreenState extends State<PlayerScreen> {
child: TextButton.icon(
icon: const Icon(Icons.lyrics),
label: const Text('Lyrics'),
onPressed: () {},
onPressed: () {
GoRouter.of(context).pushNamed('playerLyrics');
},
),
),
const Gap(4),