small fixes (db and routes)
This commit is contained in:
parent
eef7ea7f35
commit
fe2c00cee0
3 changed files with 21 additions and 5 deletions
|
@ -9,6 +9,7 @@ import '../../domain/entities/playlist.dart';
|
|||
import '../../domain/entities/smart_list.dart';
|
||||
import '../state/audio_store.dart';
|
||||
import '../state/music_data_store.dart';
|
||||
import '../state/navigation_store.dart';
|
||||
import '../state/settings_store.dart';
|
||||
import '../theming.dart';
|
||||
import 'playlist_page.dart';
|
||||
|
@ -31,6 +32,7 @@ class _PlaylistsPageState extends State<PlaylistsPage> with AutomaticKeepAliveCl
|
|||
final AudioStore audioStore = GetIt.I<AudioStore>();
|
||||
final SettingsStore settingsStore = GetIt.I<SettingsStore>();
|
||||
final MusicDataStore musicDataStore = GetIt.I<MusicDataStore>();
|
||||
final NavigationStore navStore = GetIt.I<NavigationStore>();
|
||||
|
||||
super.build(context);
|
||||
return Observer(builder: (_) {
|
||||
|
@ -49,7 +51,8 @@ class _PlaylistsPageState extends State<PlaylistsPage> with AutomaticKeepAliveCl
|
|||
final SmartList smartList = smartLists[index];
|
||||
return ListTile(
|
||||
title: Text(smartList.name),
|
||||
onTap: () => Navigator.of(context).push(
|
||||
onTap: () => navStore.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (BuildContext context) => SmartListPage(smartList: smartList),
|
||||
),
|
||||
|
@ -64,7 +67,8 @@ class _PlaylistsPageState extends State<PlaylistsPage> with AutomaticKeepAliveCl
|
|||
final Playlist playlist = playlists[i];
|
||||
return ListTile(
|
||||
title: Text(playlist.name),
|
||||
onTap: () => Navigator.of(context).push(
|
||||
onTap: () => navStore.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (BuildContext context) => PlaylistPage(playlist: playlist),
|
||||
),
|
||||
|
@ -104,7 +108,8 @@ class _PlaylistsPageState extends State<PlaylistsPage> with AutomaticKeepAliveCl
|
|||
backgroundColor: LIGHT2,
|
||||
foregroundColor: Colors.white,
|
||||
label: 'Add Smartlist',
|
||||
onTap: () => Navigator.of(context).push(
|
||||
onTap: () => navStore.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (BuildContext context) => const SmartListFormPage(),
|
||||
),
|
||||
|
|
|
@ -3,6 +3,7 @@ import 'package:flutter_mobx/flutter_mobx.dart';
|
|||
import 'package:get_it/get_it.dart';
|
||||
|
||||
import '../../domain/entities/smart_list.dart';
|
||||
import '../state/navigation_store.dart';
|
||||
import '../state/settings_store.dart';
|
||||
import '../theming.dart';
|
||||
import 'smart_list_form_page.dart';
|
||||
|
@ -14,6 +15,7 @@ class SmartListsSettingsPage extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final SettingsStore settingsStore = GetIt.I<SettingsStore>();
|
||||
final NavigationStore navStore = GetIt.I<NavigationStore>();
|
||||
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
|
@ -29,7 +31,8 @@ class SmartListsSettingsPage extends StatelessWidget {
|
|||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.add),
|
||||
onPressed: () => Navigator.of(context).push(
|
||||
onPressed: () => navStore.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (BuildContext context) => const SmartListFormPage(),
|
||||
),
|
||||
|
@ -47,7 +50,8 @@ class SmartListsSettingsPage extends StatelessWidget {
|
|||
final SmartList smartList = smartLists[index];
|
||||
return ListTile(
|
||||
title: Text(smartList.name),
|
||||
onTap: () => Navigator.of(context).push(
|
||||
onTap: () => navStore.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (BuildContext context) => SmartListFormPage(smartList: smartList),
|
||||
),
|
||||
|
|
|
@ -75,6 +75,13 @@ class LocalMusicFetcherImpl implements LocalMusicFetcher {
|
|||
albumIdMap[albumString] = album.id;
|
||||
if (album.albumArtPath != null) albumArtMap[albumString] = album.albumArtPath!;
|
||||
artistSet.add(album.artist);
|
||||
} else {
|
||||
// we already encountered the album (at least by albumString)
|
||||
// make sure the id is consistent
|
||||
if (album.id != albumIdMap[albumString]) {
|
||||
songs.add(song.copyWith(albumId: albumIdMap[albumString]));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
songs.add(song);
|
||||
continue;
|
||||
|
|
Loading…
Add table
Reference in a new issue