Favourites

This commit is contained in:
Mguy13 2022-12-25 01:55:53 +01:00
parent 6a84a9bef0
commit 1747ab0245
23 changed files with 469 additions and 67 deletions

View file

@ -1,5 +1,6 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:mc_gallery/features/core/data/constants/const_media.dart';
import '/features/core/data/constants/const_colors.dart';
import '/features/core/data/constants/const_durations.dart';
@ -80,9 +81,21 @@ class GalleryView extends StatelessWidget {
valueListenable: model.isSearchingListenable,
builder: (context, final isSearching, _) => AnimatedSwitcher(
duration: ConstDurations.oneAndHalfDefaultAnimationDuration,
child: !isSearching
? _DownloadedGalleryView(galleryViewModel: model)
: _SearchGalleryView(galleryViewModel: model),
child: Column(
children: [
ValueListenableBuilder<bool>(
valueListenable: model.isViewingFavouriteListenable,
builder: (context, final isViewingFavourites, child) =>
Switch(
value: isViewingFavourites,
onChanged: model.onFavouriteViewChange,
),
),
!isSearching
? _DownloadedGalleryView(galleryViewModel: model)
: _SearchGalleryView(galleryViewModel: model),
],
),
),
);
}