Skip to content
Snippets Groups Projects
Commit 17b68264 authored by Erik Hinkelmanns's avatar Erik Hinkelmanns
Browse files

- when there is no song in que the user will be redirected to the search page

parent 9bcf4b6b
No related branches found
No related tags found
No related merge requests found
......@@ -17,7 +17,8 @@ void printErr(String msg) {
}
class HomePage extends StatelessWidget {
const HomePage({super.key});
final pageController;
const HomePage({super.key, this.pageController});
@override
Widget build(BuildContext context) {
......@@ -95,7 +96,10 @@ class HomePage extends StatelessWidget {
textColor: Colors.white,
shape: const CircleBorder(),
onPressed: (){
play().then((value) => MusicPlayerState.of(context).rebuildPage());
pageController.animateToPage(2,
duration: const Duration(milliseconds: 500),
curve: Curves.ease);
//_title = _titleList[2];
},
child: const Icon(
Icons.play_arrow_rounded,
......
......@@ -50,7 +50,7 @@ class _HUDState extends State<HUD> {
int _currentIndex = 0;
final List<String> _titleList = ["Player", "Mood", "Search"];
String _title = "";
PageController _pageController = PageController(initialPage: 0);
final PageController _pageController = PageController(initialPage: 0);
@override
void initState() {
......@@ -71,10 +71,10 @@ class _HUDState extends State<HUD> {
_title = _titleList[newIndex];
});
},
children: const [
HomePage(),
StateMoodPage(),
StateSearcgPage(),
children: [
HomePage(pageController: _pageController,),
const StateMoodPage(),
const StateSearcgPage(),
],
),
bottomNavigationBar: Column(
......@@ -93,7 +93,7 @@ class _HUDState extends State<HUD> {
),
BottomNavigationBarItem(icon: Icon(Icons.mood), label: "Moods"),
BottomNavigationBarItem(
icon: Icon(Icons.search), label: "Suchen"),
icon: Icon(Icons.search), label: "Search"),
],
onTap: (newIndex) {
_pageController.animateToPage(newIndex,
......
......@@ -34,12 +34,6 @@ class MusicPlayerState extends InheritedWidget {
rebuildStream.sink.add(null);
}
void rebuildPage() async {
playerState = await getPlayerState();
currentTrackImageUri = playerState?.track?.imageUri;
rebuildStream.sink.add(null);
}
void updatePlayerState() async {
playerState = await getPlayerState();
currentTrackImageUri = playerState?.track?.imageUri;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment