Replaced the CreateCollectionPage with the new CreateCollectionSheet on move, add & unhide

This commit is contained in:
ashilkn 2023-01-23 18:26:07 +05:30
parent 4b0d1c430c
commit 6d7b0bc694
3 changed files with 29 additions and 53 deletions

View file

@ -1,7 +1,6 @@
import 'package:fast_base58/fast_base58.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:page_transition/page_transition.dart';
import 'package:photos/core/configuration.dart';
import 'package:photos/models/collection.dart';
import 'package:photos/models/device_collection.dart';
@ -19,7 +18,6 @@ import 'package:photos/ui/components/blur_menu_item_widget.dart';
import 'package:photos/ui/components/bottom_action_bar/expanded_menu_widget.dart';
import 'package:photos/ui/components/button_widget.dart';
import 'package:photos/ui/components/models/button_type.dart';
import 'package:photos/ui/create_collection_page.dart';
import 'package:photos/ui/create_collection_sheet.dart'
as create_collection_sheet;
import 'package:photos/ui/sharing/manage_links_widget.dart';
@ -256,7 +254,12 @@ class _FileSelectionActionWidgetState extends State<FileSelectionActionWidget> {
widget.selectedFiles
.unSelectAll(split.ownedByOtherUsers.toSet(), skipNotify: true);
}
await _selectionCollectionForAction(CollectionActionType.moveFiles);
create_collection_sheet.createCollectionSheet(
widget.selectedFiles,
null,
context,
actionType: create_collection_sheet.CollectionActionType.moveFiles,
);
}
Future<void> _addToAlbum() async {
@ -264,7 +267,6 @@ class _FileSelectionActionWidgetState extends State<FileSelectionActionWidget> {
widget.selectedFiles
.unSelectAll(split.ownedByOtherUsers.toSet(), skipNotify: true);
}
// await _selectionCollectionForAction(CollectionActionType.addFiles);
create_collection_sheet.createCollectionSheet(
widget.selectedFiles,
null,
@ -345,7 +347,12 @@ class _FileSelectionActionWidgetState extends State<FileSelectionActionWidget> {
widget.selectedFiles
.unSelectAll(split.ownedByOtherUsers.toSet(), skipNotify: true);
}
await _selectionCollectionForAction(CollectionActionType.unHide);
create_collection_sheet.createCollectionSheet(
widget.selectedFiles,
null,
context,
actionType: create_collection_sheet.CollectionActionType.unHide,
);
}
Future<void> _onCreatedSharedLinkClicked() async {
@ -413,20 +420,4 @@ class _FileSelectionActionWidgetState extends State<FileSelectionActionWidget> {
showShortToast(context, "Link copied to clipboard");
}
}
Future<Object?> _selectionCollectionForAction(
CollectionActionType type,
) async {
return Navigator.push(
context,
PageTransition(
type: PageTransitionType.bottomToTop,
child: CreateCollectionPage(
widget.selectedFiles,
null,
actionType: type,
),
),
);
}
}

View file

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:page_transition/page_transition.dart';
import 'package:photos/models/collection.dart';
import 'package:photos/models/device_collection.dart';
import 'package:photos/models/gallery_type.dart';
@ -8,7 +7,8 @@ import 'package:photos/models/selected_files.dart';
import 'package:photos/theme/ente_theme.dart';
import 'package:photos/ui/components/bottom_action_bar/bottom_action_bar_widget.dart';
import 'package:photos/ui/components/icon_button_widget.dart';
import 'package:photos/ui/create_collection_page.dart';
import 'package:photos/ui/create_collection_sheet.dart'
as create_collection_sheet;
import 'package:photos/ui/viewer/actions/file_selection_actions_widget.dart';
import 'package:photos/utils/delete_file_util.dart';
import 'package:photos/utils/magic_util.dart';
@ -85,9 +85,14 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {
icon: Icons.visibility_off_outlined,
iconButtonType: IconButtonType.primary,
iconColor: iconColor,
onTap: () => _selectionCollectionForAction(
CollectionActionType.unHide,
),
onTap: () {
create_collection_sheet.createCollectionSheet(
widget.selectedFiles,
null,
context,
actionType: create_collection_sheet.CollectionActionType.unHide,
);
},
),
);
}
@ -143,22 +148,6 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {
widget.selectedFiles.clearAll();
}
Future<Object?> _selectionCollectionForAction(
CollectionActionType type,
) async {
return Navigator.push(
context,
PageTransition(
type: PageTransitionType.bottomToTop,
child: CreateCollectionPage(
widget.selectedFiles,
null,
actionType: type,
),
),
);
}
_selectedFilesListener() {
widget.selectedFiles.files.isNotEmpty
? _bottomPosition.value = 0.0

View file

@ -6,7 +6,6 @@ import 'package:flutter/material.dart';
import 'package:like_button/like_button.dart';
import 'package:logging/logging.dart';
import 'package:media_extension/media_extension.dart';
import 'package:page_transition/page_transition.dart';
import 'package:path/path.dart' as file_path;
import 'package:photo_manager/photo_manager.dart';
import 'package:photos/core/event_bus.dart';
@ -26,7 +25,8 @@ import 'package:photos/ui/common/progress_dialog.dart';
import 'package:photos/ui/components/action_sheet_widget.dart';
import 'package:photos/ui/components/button_widget.dart';
import 'package:photos/ui/components/models/button_type.dart';
import 'package:photos/ui/create_collection_page.dart';
import 'package:photos/ui/create_collection_sheet.dart'
as create_collection_sheet;
import 'package:photos/ui/viewer/file/custom_app_bar.dart';
import 'package:photos/utils/delete_file_util.dart';
import 'package:photos/utils/dialog_util.dart';
@ -272,16 +272,12 @@ class FadingAppBarState extends State<FadingAppBar> {
Future<void> _handleUnHideRequest(BuildContext context) async {
final s = SelectedFiles();
s.files.add(widget.file);
Navigator.push(
Navigator.pop(context);
create_collection_sheet.createCollectionSheet(
s,
null,
context,
PageTransition(
type: PageTransitionType.bottomToTop,
child: CreateCollectionPage(
s,
null,
actionType: CollectionActionType.unHide,
),
),
actionType: create_collection_sheet.CollectionActionType.unHide,
);
}