openAlbums method

Future<void> openAlbums()

Push the album browser onto the sheet's nested stack (host?.push(AlbumsScreen)); on pop with a non-null result, switch the active album. Mirrors telegram's MediaPickerScreen → MediaGroupsScreen → pop-with-collection flow.

Implementation

Future<void> openAlbums() async {
  final picked = await host?.push(
    AlbumsScreen(
      albums: _albums,
      sheetController: sheetController,
      selectedId: _currentAlbum?.id,
    ),
  );
  // `picked == null` is genuine cancel (back arrow). The "Recents"
  // row pops the actual `recents` album so it round-trips through
  // `selectAlbum` and reloads the grid even when the current album
  // is something else.
  if (_closed || picked == null) return;
  await selectAlbum(picked.id == 'recents' ? null : picked);
}