mirror of
https://github.com/immich-app/immich.git
synced 2024-11-18 03:19:01 -07:00
2e5cd986dd
* update asset to include isArchive property * Not display archived assets on timeline * replace share button to archive button * Added archive page * Add bottom nav bar * clean up homepage * remove deadcode * improve on sync is archive * show archive asset correctly * better merge condition * Added back renderList to re-rendering don't jump around * Better way to handle showing archive assets * complete ArchiveSelectionNotifier * toggle archive * remove deadcode * fix unit tests * update assets in DB when changing assets * update asset state to reflect archived status * allow to archive assets via multi-select from timeline * fixed logic * Add options to bulk unarchive * regenerate api * Change position of toast message --------- Co-authored-by: Fynn Petersen-Frey <zoodyy@users.noreply.github.com>
173 lines
5.2 KiB
Dart
173 lines
5.2 KiB
Dart
import 'package:easy_localization/easy_localization.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:immich_mobile/modules/album/ui/add_to_album_sliverlist.dart';
|
|
import 'package:immich_mobile/modules/home/ui/delete_dialog.dart';
|
|
import 'package:immich_mobile/shared/ui/drag_sheet.dart';
|
|
import 'package:immich_mobile/shared/models/album.dart';
|
|
|
|
class ControlBottomAppBar extends ConsumerWidget {
|
|
final Function onShare;
|
|
final Function onFavorite;
|
|
final Function onArchive;
|
|
final Function onDelete;
|
|
final Function(Album album) onAddToAlbum;
|
|
final void Function() onCreateNewAlbum;
|
|
|
|
final List<Album> albums;
|
|
final List<Album> sharedAlbums;
|
|
|
|
const ControlBottomAppBar({
|
|
Key? key,
|
|
required this.onShare,
|
|
required this.onFavorite,
|
|
required this.onArchive,
|
|
required this.onDelete,
|
|
required this.sharedAlbums,
|
|
required this.albums,
|
|
required this.onAddToAlbum,
|
|
required this.onCreateNewAlbum,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
var isDarkMode = Theme.of(context).brightness == Brightness.dark;
|
|
|
|
Widget renderActionButtons() {
|
|
return Row(
|
|
children: [
|
|
ControlBoxButton(
|
|
iconData: Icons.ios_share_rounded,
|
|
label: "control_bottom_app_bar_share".tr(),
|
|
onPressed: () {
|
|
onShare();
|
|
},
|
|
),
|
|
ControlBoxButton(
|
|
iconData: Icons.star_rounded,
|
|
label: "control_bottom_app_bar_favorite".tr(),
|
|
onPressed: () {
|
|
onFavorite();
|
|
},
|
|
),
|
|
ControlBoxButton(
|
|
iconData: Icons.delete_outline_rounded,
|
|
label: "control_bottom_app_bar_delete".tr(),
|
|
onPressed: () {
|
|
showDialog(
|
|
context: context,
|
|
builder: (BuildContext context) {
|
|
return DeleteDialog(
|
|
onDelete: onDelete,
|
|
);
|
|
},
|
|
);
|
|
},
|
|
),
|
|
ControlBoxButton(
|
|
iconData: Icons.archive,
|
|
label: "control_bottom_app_bar_archive".tr(),
|
|
onPressed: () => onArchive(),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
return DraggableScrollableSheet(
|
|
initialChildSize: 0.30,
|
|
minChildSize: 0.15,
|
|
maxChildSize: 0.57,
|
|
snap: true,
|
|
builder: (
|
|
BuildContext context,
|
|
ScrollController scrollController,
|
|
) {
|
|
return Card(
|
|
color: isDarkMode ? Colors.grey[900] : Colors.grey[100],
|
|
surfaceTintColor: Colors.transparent,
|
|
elevation: 18.0,
|
|
shape: const RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.only(
|
|
topLeft: Radius.circular(12),
|
|
topRight: Radius.circular(12),
|
|
),
|
|
),
|
|
margin: const EdgeInsets.all(0),
|
|
child: CustomScrollView(
|
|
controller: scrollController,
|
|
slivers: [
|
|
SliverToBoxAdapter(
|
|
child: Column(
|
|
children: <Widget>[
|
|
const SizedBox(height: 12),
|
|
const CustomDraggingHandle(),
|
|
const SizedBox(height: 12),
|
|
renderActionButtons(),
|
|
const Divider(
|
|
indent: 16,
|
|
endIndent: 16,
|
|
thickness: 1,
|
|
),
|
|
AddToAlbumTitleRow(onCreateNewAlbum: onCreateNewAlbum),
|
|
],
|
|
),
|
|
),
|
|
SliverPadding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
sliver: AddToAlbumSliverList(
|
|
albums: albums,
|
|
sharedAlbums: sharedAlbums,
|
|
onAddToAlbum: onAddToAlbum,
|
|
),
|
|
),
|
|
const SliverToBoxAdapter(
|
|
child: SizedBox(height: 200),
|
|
)
|
|
],
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|
|
|
|
class AddToAlbumTitleRow extends StatelessWidget {
|
|
const AddToAlbumTitleRow({
|
|
super.key,
|
|
required this.onCreateNewAlbum,
|
|
});
|
|
|
|
final VoidCallback onCreateNewAlbum;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
const Text(
|
|
"common_add_to_album",
|
|
style: TextStyle(
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
).tr(),
|
|
TextButton.icon(
|
|
onPressed: onCreateNewAlbum,
|
|
icon: const Icon(Icons.add),
|
|
label: Text(
|
|
"common_create_new_album",
|
|
style: TextStyle(
|
|
color: Theme.of(context).primaryColor,
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 14,
|
|
),
|
|
).tr(),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|