2021-08-20 14:06:37 +08:00
|
|
|
import 'package:flutter/widgets.dart';
|
|
|
|
import 'package:nc_photos/account.dart';
|
|
|
|
import 'package:nc_photos/entity/album.dart';
|
|
|
|
import 'package:nc_photos/entity/album/provider.dart';
|
|
|
|
import 'package:nc_photos/widget/album_browser.dart';
|
2022-01-15 18:35:15 +08:00
|
|
|
import 'package:nc_photos/widget/smart_album_browser.dart';
|
2021-08-20 14:06:37 +08:00
|
|
|
|
2021-11-21 21:36:13 +08:00
|
|
|
/// Push the corresponding browser route for this album
|
2023-04-16 18:29:23 +08:00
|
|
|
void push(BuildContext context, Account account, Album album) {
|
2021-08-20 14:06:37 +08:00
|
|
|
if (album.provider is AlbumStaticProvider) {
|
2023-04-16 18:29:23 +08:00
|
|
|
Navigator.of(context).pushNamed(AlbumBrowser.routeName,
|
2021-08-20 14:06:37 +08:00
|
|
|
arguments: AlbumBrowserArguments(account, album));
|
2022-01-15 18:35:15 +08:00
|
|
|
} else if (album.provider is AlbumSmartProvider) {
|
2023-04-16 18:29:23 +08:00
|
|
|
Navigator.of(context).pushNamed(SmartAlbumBrowser.routeName,
|
2022-01-15 18:35:15 +08:00
|
|
|
arguments: SmartAlbumBrowserArguments(account, album));
|
2021-08-20 14:06:37 +08:00
|
|
|
}
|
|
|
|
}
|
2021-11-21 21:52:10 +08:00
|
|
|
|
|
|
|
/// Push the corresponding browser route for this album and replace the current
|
|
|
|
/// route
|
2023-04-16 18:29:23 +08:00
|
|
|
void pushReplacement(BuildContext context, Account account, Album album) {
|
2021-11-21 21:52:10 +08:00
|
|
|
if (album.provider is AlbumStaticProvider) {
|
2023-04-16 18:29:23 +08:00
|
|
|
Navigator.of(context).pushReplacementNamed(AlbumBrowser.routeName,
|
2021-11-21 21:52:10 +08:00
|
|
|
arguments: AlbumBrowserArguments(account, album));
|
|
|
|
}
|
|
|
|
}
|