Refactor: Organize widgets (#1190)

This commit is contained in:
Neeraj Gupta 2023-06-07 12:48:04 +05:30 committed by GitHub
commit 78f5dc064f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
47 changed files with 652 additions and 645 deletions

View file

@ -1,5 +1,5 @@
PODS: PODS:
- background_fetch (1.1.4): - background_fetch (1.1.6):
- Flutter - Flutter
- camera_avfoundation (0.0.1): - camera_avfoundation (0.0.1):
- Flutter - Flutter
@ -8,30 +8,30 @@ PODS:
- ReachabilitySwift - ReachabilitySwift
- device_info (0.0.1): - device_info (0.0.1):
- Flutter - Flutter
- Firebase/CoreOnly (10.3.0): - Firebase/CoreOnly (10.9.0):
- FirebaseCore (= 10.3.0) - FirebaseCore (= 10.9.0)
- Firebase/Messaging (10.3.0): - Firebase/Messaging (10.9.0):
- Firebase/CoreOnly - Firebase/CoreOnly
- FirebaseMessaging (~> 10.3.0) - FirebaseMessaging (~> 10.9.0)
- firebase_core (2.5.0): - firebase_core (2.13.1):
- Firebase/CoreOnly (= 10.3.0) - Firebase/CoreOnly (= 10.9.0)
- Flutter - Flutter
- firebase_messaging (14.2.2): - firebase_messaging (14.6.2):
- Firebase/Messaging (= 10.3.0) - Firebase/Messaging (= 10.9.0)
- firebase_core - firebase_core
- Flutter - Flutter
- FirebaseCore (10.3.0): - FirebaseCore (10.9.0):
- FirebaseCoreInternal (~> 10.0) - FirebaseCoreInternal (~> 10.0)
- GoogleUtilities/Environment (~> 7.8) - GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/Logger (~> 7.8) - GoogleUtilities/Logger (~> 7.8)
- FirebaseCoreInternal (10.5.0): - FirebaseCoreInternal (10.10.0):
- "GoogleUtilities/NSData+zlib (~> 7.8)" - "GoogleUtilities/NSData+zlib (~> 7.8)"
- FirebaseInstallations (10.5.0): - FirebaseInstallations (10.10.0):
- FirebaseCore (~> 10.0) - FirebaseCore (~> 10.0)
- GoogleUtilities/Environment (~> 7.8) - GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/UserDefaults (~> 7.8) - GoogleUtilities/UserDefaults (~> 7.8)
- PromisesObjC (~> 2.1) - PromisesObjC (~> 2.1)
- FirebaseMessaging (10.3.0): - FirebaseMessaging (10.9.0):
- FirebaseCore (~> 10.0) - FirebaseCore (~> 10.0)
- FirebaseInstallations (~> 10.0) - FirebaseInstallations (~> 10.0)
- GoogleDataTransport (~> 9.2) - GoogleDataTransport (~> 9.2)
@ -71,26 +71,26 @@ PODS:
- FMDB (2.7.5): - FMDB (2.7.5):
- FMDB/standard (= 2.7.5) - FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5) - FMDB/standard (2.7.5)
- GoogleDataTransport (9.2.1): - GoogleDataTransport (9.2.3):
- GoogleUtilities/Environment (~> 7.7) - GoogleUtilities/Environment (~> 7.7)
- nanopb (< 2.30910.0, >= 2.30908.0) - nanopb (< 2.30910.0, >= 2.30908.0)
- PromisesObjC (< 3.0, >= 1.2) - PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/AppDelegateSwizzler (7.11.0): - GoogleUtilities/AppDelegateSwizzler (7.11.1):
- GoogleUtilities/Environment - GoogleUtilities/Environment
- GoogleUtilities/Logger - GoogleUtilities/Logger
- GoogleUtilities/Network - GoogleUtilities/Network
- GoogleUtilities/Environment (7.11.0): - GoogleUtilities/Environment (7.11.1):
- PromisesObjC (< 3.0, >= 1.2) - PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/Logger (7.11.0): - GoogleUtilities/Logger (7.11.1):
- GoogleUtilities/Environment - GoogleUtilities/Environment
- GoogleUtilities/Network (7.11.0): - GoogleUtilities/Network (7.11.1):
- GoogleUtilities/Logger - GoogleUtilities/Logger
- "GoogleUtilities/NSData+zlib" - "GoogleUtilities/NSData+zlib"
- GoogleUtilities/Reachability - GoogleUtilities/Reachability
- "GoogleUtilities/NSData+zlib (7.11.0)" - "GoogleUtilities/NSData+zlib (7.11.1)"
- GoogleUtilities/Reachability (7.11.0): - GoogleUtilities/Reachability (7.11.1):
- GoogleUtilities/Logger - GoogleUtilities/Logger
- GoogleUtilities/UserDefaults (7.11.0): - GoogleUtilities/UserDefaults (7.11.1):
- GoogleUtilities/Logger - GoogleUtilities/Logger
- image_editor_common (1.0.0): - image_editor_common (1.0.0):
- Flutter - Flutter
@ -135,14 +135,14 @@ PODS:
- photo_manager (2.0.0): - photo_manager (2.0.0):
- Flutter - Flutter
- FlutterMacOS - FlutterMacOS
- PromisesObjC (2.1.1) - PromisesObjC (2.2.0)
- ReachabilitySwift (5.0.0) - ReachabilitySwift (5.0.0)
- receive_sharing_intent (0.0.1): - receive_sharing_intent (0.0.1):
- Flutter - Flutter
- SDWebImage (5.15.2): - SDWebImage (5.16.0):
- SDWebImage/Core (= 5.15.2) - SDWebImage/Core (= 5.16.0)
- SDWebImage/Core (5.15.2) - SDWebImage/Core (5.16.0)
- SDWebImageWebPCoder (0.10.1): - SDWebImageWebPCoder (0.11.0):
- libwebp (~> 1.0) - libwebp (~> 1.0)
- SDWebImage/Core (~> 5.15) - SDWebImage/Core (~> 5.15)
- Sentry/HybridSDK (7.31.5) - Sentry/HybridSDK (7.31.5)
@ -155,7 +155,7 @@ PODS:
- shared_preferences_foundation (0.0.1): - shared_preferences_foundation (0.0.1):
- Flutter - Flutter
- FlutterMacOS - FlutterMacOS
- sqflite (0.0.2): - sqflite (0.0.3):
- Flutter - Flutter
- FMDB (>= 2.7.5) - FMDB (>= 2.7.5)
- tflite_flutter (0.1.0): - tflite_flutter (0.1.0):
@ -318,17 +318,17 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/wakelock/ios" :path: ".symlinks/plugins/wakelock/ios"
SPEC CHECKSUMS: SPEC CHECKSUMS:
background_fetch: bd64e544b303ee4cd4cf2fe8cb2187b72aecf9ca background_fetch: bc9b44b0bf8b434e282a2ac9be8662800a0296ed
camera_avfoundation: 07c77549ea54ad95d8581be86617c094a46280d9 camera_avfoundation: 3125e8cd1a4387f6f31c6c63abb8a55892a9eeeb
connectivity_plus: 413a8857dd5d9f1c399a39130850d02fe0feaf7e connectivity_plus: 413a8857dd5d9f1c399a39130850d02fe0feaf7e
device_info: d7d233b645a32c40dfdc212de5cf646ca482f175 device_info: d7d233b645a32c40dfdc212de5cf646ca482f175
Firebase: f92fc551ead69c94168d36c2b26188263860acd9 Firebase: bd152f0f3d278c4060c5c71359db08ebcfd5a3e2
firebase_core: f95c8bbe65213d406d592573ad42a12d64849cb8 firebase_core: ce64b0941c6d87c6ef5022ae9116a158236c8c94
firebase_messaging: 3daef9f9ee5b91de2f282895ec91cc5e5ca78556 firebase_messaging: 42912365e62efc1ea3e00724e5eecba6068ddb88
FirebaseCore: 988754646ab3bd4bdcb740f1bfe26b9f6c0d5f2a FirebaseCore: b68d3616526ec02e4d155166bbafb8eca64af557
FirebaseCoreInternal: e463f41bb935cd049505bf7e9a5bdd7dcea90df6 FirebaseCoreInternal: 971029061d326000d65bfdc21f5502c75c8b0893
FirebaseInstallations: 935bc4abb6f7a035cab7a0c31cb777b2be3dd254 FirebaseInstallations: 52153982b057d3afcb4e1fbb3eb0b6d00611e681
FirebaseMessaging: e345b219fd15d325f0cf2fef28cb8ce00d851b3f FirebaseMessaging: 6b7052cc3da7bc8e5f72bef871243e8f04a14eed
fk_user_agent: 1f47ec39291e8372b1d692b50084b0d54103c545 fk_user_agent: 1f47ec39291e8372b1d692b50084b0d54103c545
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_email_sender: 02d7443217d8c41483223627972bfdc09f74276b flutter_email_sender: 02d7443217d8c41483223627972bfdc09f74276b
@ -338,12 +338,12 @@ SPEC CHECKSUMS:
flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef
flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be
flutter_sodium: c84426b4de738514b5b66cfdeb8a06634e72fe0b flutter_sodium: c84426b4de738514b5b66cfdeb8a06634e72fe0b
fluttertoast: eb263d302cc92e04176c053d2385237e9f43fad0 fluttertoast: fafc4fa4d01a6a9e4f772ecd190ffa525e9e2d9c
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
GoogleDataTransport: ea169759df570f4e37bdee1623ec32a7e64e67c4 GoogleDataTransport: f0308f5905a745f94fb91fea9c6cbaf3831cb1bd
GoogleUtilities: c2bdc4cf2ce786c4d2e6b3bcfd599a25ca78f06f GoogleUtilities: 9aa0ad5a7bc171f8bae016300bfcfa3fb8425749
image_editor_common: d6f6644ae4a6de80481e89fe6d0a8c49e30b4b43 image_editor_common: d6f6644ae4a6de80481e89fe6d0a8c49e30b4b43
in_app_purchase_storekit: 6b297e2b5eab9fa3251a492d57301722e4132a71 in_app_purchase_storekit: 4fb7ee9e824b1f09107fbfbbce8c4b276366dc43
integration_test: a1e7d09bd98eca2fc37aefd79d4f41ad37bdbbe5 integration_test: a1e7d09bd98eca2fc37aefd79d4f41ad37bdbbe5
libwebp: f62cb61d0a484ba548448a4bd52aabf150ff6eef libwebp: f62cb61d0a484ba548448a4bd52aabf150ff6eef
local_auth_ios: c6cf091ded637a88f24f86a8875d8b0f526e2605 local_auth_ios: c6cf091ded637a88f24f86a8875d8b0f526e2605
@ -355,23 +355,23 @@ SPEC CHECKSUMS:
open_mail_app: 794172f6a22cd16319d3ddaf45e945b2f74952b0 open_mail_app: 794172f6a22cd16319d3ddaf45e945b2f74952b0
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852 path_provider_foundation: eaf5b3e458fc0e5fbb9940fb09980e853fe058b8
photo_manager: 4f6810b7dfc4feb03b461ac1a70dacf91fba7604 photo_manager: 4f6810b7dfc4feb03b461ac1a70dacf91fba7604
PromisesObjC: ab77feca74fa2823e7af4249b8326368e61014cb PromisesObjC: 09985d6d70fbe7878040aa746d78236e6946d2ef
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
receive_sharing_intent: c0d87310754e74c0f9542947e7cbdf3a0335a3b1 receive_sharing_intent: c0d87310754e74c0f9542947e7cbdf3a0335a3b1
SDWebImage: 8ab87d4b3e5cc4927bd47f78db6ceb0b94442577 SDWebImage: 2aea163b50bfcb569a2726b6a754c54a4506fcf6
SDWebImageWebPCoder: 4851414d9f8894e328e8b97c93ea4f4f4e4418ae SDWebImageWebPCoder: 295a6573c512f54ad2dd58098e64e17dcf008499
Sentry: 4c9babff9034785067c896fd580b1f7de44da020 Sentry: 4c9babff9034785067c896fd580b1f7de44da020
sentry_flutter: b10ae7a5ddcbc7f04648eeb2672b5747230172f1 sentry_flutter: 1346a880b24c0240807b53b10cf50ddad40f504e
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68 share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
shared_preferences_foundation: 297b3ebca31b34ec92be11acd7fb0ba932c822ca shared_preferences_foundation: e2dae3258e06f44cc55f49d42024fd8dd03c590c
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
tflite_flutter: 9157a660578930a99728974f247369af1c3595d5 tflite_flutter: 9157a660578930a99728974f247369af1c3595d5
tflite_flutter_helper: 543b46b6bd064b21c92ea6e54bc0b29f1ce74cb5 tflite_flutter_helper: 543b46b6bd064b21c92ea6e54bc0b29f1ce74cb5
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196 Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
uni_links: d97da20c7701486ba192624d99bffaaffcfc298a uni_links: d97da20c7701486ba192624d99bffaaffcfc298a
url_launcher_ios: fb12c43172927bb5cf75aeebd073f883801f1993 url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
video_player_avfoundation: 81e49bb3d9fb63dccf9fa0f6d877dc3ddbeac126 video_player_avfoundation: 81e49bb3d9fb63dccf9fa0f6d877dc3ddbeac126
video_thumbnail: c4e2a3c539e247d4de13cd545344fd2d26ffafd1 video_thumbnail: c4e2a3c539e247d4de13cd545344fd2d26ffafd1
wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f

View file

@ -13,7 +13,7 @@ import "package:photos/generated/l10n.dart";
import "package:photos/l10n/l10n.dart"; import "package:photos/l10n/l10n.dart";
import 'package:photos/services/app_lifecycle_service.dart'; import 'package:photos/services/app_lifecycle_service.dart';
import 'package:photos/services/sync_service.dart'; import 'package:photos/services/sync_service.dart';
import 'package:photos/ui/home_widget.dart'; import 'package:photos/ui/tabs/home_widget.dart';
import "package:photos/ui/viewer/actions/file_viewer.dart"; import "package:photos/ui/viewer/actions/file_viewer.dart";
import "package:photos/utils/intent_util.dart"; import "package:photos/utils/intent_util.dart";

View file

@ -101,7 +101,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
resizeToAvoidBottomInset: isKeypadOpen, resizeToAvoidBottomInset: isKeypadOpen,
appBar: AppBar( appBar: AppBar(
leading: widget.mode == PasswordEntryMode.reset leading: widget.mode == PasswordEntryMode.reset
? Container() ? const SizedBox.shrink()
: IconButton( : IconButton(
icon: const Icon(Icons.arrow_back), icon: const Icon(Icons.arrow_back),
color: Theme.of(context).iconTheme.color, color: Theme.of(context).iconTheme.color,
@ -142,7 +142,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
passwordStrengthColor = Colors.orangeAccent; passwordStrengthColor = Colors.orangeAccent;
} }
if (_volatilePassword != null) { if (_volatilePassword != null) {
return Container(); return const SizedBox.shrink();
} }
return Column( return Column(
children: [ children: [

View file

@ -10,7 +10,7 @@ import "package:photos/generated/l10n.dart";
import 'package:photos/ui/account/recovery_page.dart'; import 'package:photos/ui/account/recovery_page.dart';
import 'package:photos/ui/common/dynamic_fab.dart'; import 'package:photos/ui/common/dynamic_fab.dart';
import 'package:photos/ui/components/buttons/button_widget.dart'; import 'package:photos/ui/components/buttons/button_widget.dart';
import 'package:photos/ui/home_widget.dart'; import 'package:photos/ui/tabs/home_widget.dart';
import 'package:photos/utils/dialog_util.dart'; import 'package:photos/utils/dialog_util.dart';
import 'package:photos/utils/email_util.dart'; import 'package:photos/utils/email_util.dart';

View file

@ -9,10 +9,10 @@ import 'package:photos/ui/viewer/file/no_thumbnail_widget.dart';
import 'package:photos/ui/viewer/file/thumbnail_widget.dart'; import 'package:photos/ui/viewer/file/thumbnail_widget.dart';
///https://www.figma.com/file/SYtMyLBs5SAOkTbfMMzhqt/ente-Visual-Design?node-id=7480%3A33462&t=H5AvR79OYDnB9ekw-4 ///https://www.figma.com/file/SYtMyLBs5SAOkTbfMMzhqt/ente-Visual-Design?node-id=7480%3A33462&t=H5AvR79OYDnB9ekw-4
class AlbumListItemWidget extends StatelessWidget { class AlbumColumnItemWidget extends StatelessWidget {
final CollectionWithThumbnail item; final CollectionWithThumbnail item;
const AlbumListItemWidget( const AlbumColumnItemWidget(
this.item, { this.item, {
super.key, super.key,
}); });

View file

@ -7,23 +7,22 @@ import "package:photos/events/collection_updated_event.dart";
import "package:photos/generated/l10n.dart"; import "package:photos/generated/l10n.dart";
import "package:photos/models/collection_items.dart"; import "package:photos/models/collection_items.dart";
import "package:photos/theme/ente_theme.dart"; import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/collections/collection_item_widget.dart"; import "package:photos/ui/collections/album/row_item.dart";
import "package:photos/ui/common/loading_widget.dart"; import "package:photos/ui/common/loading_widget.dart";
class AlbumHorizontalListWidget extends StatefulWidget { class AlbumHorizontalList extends StatefulWidget {
final Future<List<CollectionWithThumbnail>> Function() collectionsFuture; final Future<List<CollectionWithThumbnail>> Function() collectionsFuture;
const AlbumHorizontalListWidget( const AlbumHorizontalList(
this.collectionsFuture, { this.collectionsFuture, {
Key? key, Key? key,
}) : super(key: key); }) : super(key: key);
@override @override
State<AlbumHorizontalListWidget> createState() => State<AlbumHorizontalList> createState() => _AlbumHorizontalListState();
_AlbumHorizontalListWidgetState();
} }
class _AlbumHorizontalListWidgetState extends State<AlbumHorizontalListWidget> { class _AlbumHorizontalListState extends State<AlbumHorizontalList> {
late StreamSubscription<CollectionUpdatedEvent> late StreamSubscription<CollectionUpdatedEvent>
_collectionUpdatesSubscription; _collectionUpdatesSubscription;
late Logger _logger; late Logger _logger;
@ -34,7 +33,7 @@ class _AlbumHorizontalListWidgetState extends State<AlbumHorizontalListWidget> {
Bus.instance.on<CollectionUpdatedEvent>().listen((event) { Bus.instance.on<CollectionUpdatedEvent>().listen((event) {
setState(() {}); setState(() {});
}); });
_logger = Logger((_AlbumHorizontalListWidgetState).toString()); _logger = Logger((_AlbumHorizontalListState).toString());
super.initState(); super.initState();
} }
@ -84,7 +83,7 @@ class _AlbumHorizontalListWidgetState extends State<AlbumHorizontalListWidget> {
padding: const EdgeInsets.symmetric(horizontal: 8), padding: const EdgeInsets.symmetric(horizontal: 8),
itemBuilder: (context, index) { itemBuilder: (context, index) {
final item = collectionsWithThumbnail[index]; final item = collectionsWithThumbnail[index];
return CollectionItem( return AlbumRowItemWidget(
item, item,
120, 120,
shouldRender: true, shouldRender: true,

View file

@ -12,13 +12,13 @@ import 'package:photos/ui/viewer/gallery/collection_page.dart';
import 'package:photos/utils/navigation_util.dart'; import 'package:photos/utils/navigation_util.dart';
import 'package:visibility_detector/visibility_detector.dart'; import 'package:visibility_detector/visibility_detector.dart';
class CollectionItem extends StatelessWidget { class AlbumRowItemWidget extends StatelessWidget {
final CollectionWithThumbnail c; final CollectionWithThumbnail c;
final double sideOfThumbnail; final double sideOfThumbnail;
final bool shouldRender; final bool shouldRender;
final bool showFileCount; final bool showFileCount;
CollectionItem( AlbumRowItemWidget(
this.c, this.c,
this.sideOfThumbnail, { this.sideOfThumbnail, {
this.shouldRender = false, this.shouldRender = false,

View file

@ -16,9 +16,9 @@ import 'package:photos/services/collections_service.dart';
import 'package:photos/services/ignored_files_service.dart'; import 'package:photos/services/ignored_files_service.dart';
import 'package:photos/services/remote_sync_service.dart'; import 'package:photos/services/remote_sync_service.dart';
import "package:photos/ui/actions/collection/collection_sharing_actions.dart"; import "package:photos/ui/actions/collection/collection_sharing_actions.dart";
import "package:photos/ui/collection_action_sheet.dart"; import "package:photos/ui/collections/album/column_item.dart";
import 'package:photos/ui/components/album_list_item_widget.dart'; import "package:photos/ui/collections/album/new_list_item.dart";
import 'package:photos/ui/components/new_album_list_widget.dart'; import 'package:photos/ui/collections/collection_action_sheet.dart';
import "package:photos/ui/sharing/share_collection_page.dart"; import "package:photos/ui/sharing/share_collection_page.dart";
import 'package:photos/ui/viewer/gallery/collection_page.dart'; import 'package:photos/ui/viewer/gallery/collection_page.dart';
import "package:photos/ui/viewer/gallery/empty_state.dart"; import "package:photos/ui/viewer/gallery/empty_state.dart";
@ -28,7 +28,7 @@ import 'package:photos/utils/share_util.dart';
import 'package:photos/utils/toast_util.dart'; import 'package:photos/utils/toast_util.dart';
import 'package:receive_sharing_intent/receive_sharing_intent.dart'; import 'package:receive_sharing_intent/receive_sharing_intent.dart';
class CollectionsListWidget extends StatelessWidget { class AlbumVerticalListWidget extends StatelessWidget {
final List<CollectionWithThumbnail> collectionsWithThumbnail; final List<CollectionWithThumbnail> collectionsWithThumbnail;
final CollectionActionType actionType; final CollectionActionType actionType;
final SelectedFiles? selectedFiles; final SelectedFiles? selectedFiles;
@ -36,7 +36,7 @@ class CollectionsListWidget extends StatelessWidget {
final String searchQuery; final String searchQuery;
final bool shouldShowCreateAlbum; final bool shouldShowCreateAlbum;
CollectionsListWidget( AlbumVerticalListWidget(
this.collectionsWithThumbnail, this.collectionsWithThumbnail,
this.actionType, this.actionType,
this.selectedFiles, this.selectedFiles,
@ -70,7 +70,7 @@ class CollectionsListWidget extends StatelessWidget {
return GestureDetector( return GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () => _albumListItemOnTap(context, item), onTap: () => _albumListItemOnTap(context, item),
child: AlbumListItemWidget( child: AlbumColumnItemWidget(
item, item,
), ),
); );

View file

@ -7,10 +7,10 @@ import "package:photos/services/collections_service.dart";
import 'package:photos/ui/viewer/gallery/archive_page.dart'; import 'package:photos/ui/viewer/gallery/archive_page.dart';
import 'package:photos/utils/navigation_util.dart'; import 'package:photos/utils/navigation_util.dart';
class ArchivedCollectionsButtonWidget extends StatelessWidget { class ArchivedCollectionsButton extends StatelessWidget {
final TextStyle textStyle; final TextStyle textStyle;
const ArchivedCollectionsButtonWidget( const ArchivedCollectionsButton(
this.textStyle, { this.textStyle, {
Key? key, Key? key,
}) : super(key: key); }) : super(key: key);

View file

@ -8,8 +8,8 @@ import "package:photos/generated/l10n.dart";
import 'package:photos/ui/viewer/gallery/trash_page.dart'; import 'package:photos/ui/viewer/gallery/trash_page.dart';
import 'package:photos/utils/navigation_util.dart'; import 'package:photos/utils/navigation_util.dart';
class TrashButtonWidget extends StatefulWidget { class TrashSectionButton extends StatefulWidget {
const TrashButtonWidget( const TrashSectionButton(
this.textStyle, { this.textStyle, {
Key? key, Key? key,
}) : super(key: key); }) : super(key: key);
@ -17,10 +17,10 @@ class TrashButtonWidget extends StatefulWidget {
final TextStyle textStyle; final TextStyle textStyle;
@override @override
State<TrashButtonWidget> createState() => _TrashButtonWidgetState(); State<TrashSectionButton> createState() => _TrashSectionButtonState();
} }
class _TrashButtonWidgetState extends State<TrashButtonWidget> { class _TrashSectionButtonState extends State<TrashSectionButton> {
late StreamSubscription<TrashUpdatedEvent> _trashUpdatedEventSubscription; late StreamSubscription<TrashUpdatedEvent> _trashUpdatedEventSubscription;
@override @override

View file

@ -8,10 +8,10 @@ import 'package:photos/services/hidden_service.dart';
import 'package:photos/ui/viewer/gallery/uncategorized_page.dart'; import 'package:photos/ui/viewer/gallery/uncategorized_page.dart';
import 'package:photos/utils/navigation_util.dart'; import 'package:photos/utils/navigation_util.dart';
class UnCatCollectionsButtonWidget extends StatelessWidget { class UnCategorizedCollections extends StatelessWidget {
final TextStyle textStyle; final TextStyle textStyle;
const UnCatCollectionsButtonWidget( const UnCategorizedCollections(
this.textStyle, { this.textStyle, {
Key? key, Key? key,
}) : super(key: key); }) : super(key: key);

View file

@ -12,7 +12,7 @@ import 'package:photos/models/selected_files.dart';
import 'package:photos/services/collections_service.dart'; import 'package:photos/services/collections_service.dart';
import 'package:photos/theme/colors.dart'; import 'package:photos/theme/colors.dart';
import 'package:photos/theme/ente_theme.dart'; import 'package:photos/theme/ente_theme.dart';
import "package:photos/ui/collections_list_widget.dart"; import 'package:photos/ui/collections/album/vertical_list.dart';
import 'package:photos/ui/common/loading_widget.dart'; import 'package:photos/ui/common/loading_widget.dart';
import 'package:photos/ui/components/bottom_of_title_bar_widget.dart'; import 'package:photos/ui/components/bottom_of_title_bar_widget.dart';
import 'package:photos/ui/components/buttons/button_widget.dart'; import 'package:photos/ui/components/buttons/button_widget.dart';
@ -229,7 +229,7 @@ class _CollectionActionSheetState extends State<CollectionActionSheet> {
radius: const Radius.circular(2), radius: const Radius.circular(2),
child: Padding( child: Padding(
padding: const EdgeInsets.only(right: 12), padding: const EdgeInsets.only(right: 12),
child: CollectionsListWidget( child: AlbumVerticalListWidget(
searchResults, searchResults,
widget.actionType, widget.actionType,
widget.selectedFiles, widget.selectedFiles,

View file

@ -2,7 +2,7 @@ import 'dart:math';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:photos/models/collection_items.dart'; import 'package:photos/models/collection_items.dart';
import 'package:photos/ui/collections/collection_item_widget.dart'; import "package:photos/ui/collections/album/row_item.dart";
import 'package:photos/ui/collections/create_new_album_widget.dart'; import 'package:photos/ui/collections/create_new_album_widget.dart';
class RemoteCollectionsGridViewWidget extends StatelessWidget { class RemoteCollectionsGridViewWidget extends StatelessWidget {
@ -46,7 +46,7 @@ class RemoteCollectionsGridViewWidget extends StatelessWidget {
// to disable GridView's scrolling // to disable GridView's scrolling
itemBuilder: (context, index) { itemBuilder: (context, index) {
if (index < collections!.length) { if (index < collections!.length) {
return CollectionItem( return AlbumRowItemWidget(
collections![index], collections![index],
sideOfThumbnail, sideOfThumbnail,
shouldRender: index < collectionItemsToPreload, shouldRender: index < collectionItemsToPreload,

View file

@ -6,7 +6,7 @@ import 'package:photos/events/tab_changed_event.dart';
import 'package:photos/models/selected_files.dart'; import 'package:photos/models/selected_files.dart';
import "package:photos/theme/colors.dart"; import "package:photos/theme/colors.dart";
import 'package:photos/theme/ente_theme.dart'; import 'package:photos/theme/ente_theme.dart';
import 'package:photos/ui/nav_bar.dart'; import 'package:photos/ui/tabs/nav_bar.dart';
class HomeBottomNavigationBar extends StatefulWidget { class HomeBottomNavigationBar extends StatefulWidget {
const HomeBottomNavigationBar( const HomeBottomNavigationBar(

View file

@ -9,8 +9,8 @@ import 'package:photos/events/local_import_progress.dart';
import 'package:photos/events/sync_status_update_event.dart'; import 'package:photos/events/sync_status_update_event.dart';
import "package:photos/generated/l10n.dart"; import "package:photos/generated/l10n.dart";
import 'package:photos/services/local_sync_service.dart'; import 'package:photos/services/local_sync_service.dart';
import 'package:photos/ui/backup_folder_selection_page.dart';
import 'package:photos/ui/common/bottom_shadow.dart'; import 'package:photos/ui/common/bottom_shadow.dart';
import 'package:photos/ui/settings/backup/backup_folder_selection_page.dart';
import 'package:photos/utils/navigation_util.dart'; import 'package:photos/utils/navigation_util.dart';
class LoadingPhotosWidget extends StatefulWidget { class LoadingPhotosWidget extends StatefulWidget {

View file

@ -4,8 +4,8 @@ import 'package:flutter/material.dart';
import 'package:photo_manager/photo_manager.dart'; import 'package:photo_manager/photo_manager.dart';
import "package:photos/generated/l10n.dart"; import "package:photos/generated/l10n.dart";
import 'package:photos/services/local_sync_service.dart'; import 'package:photos/services/local_sync_service.dart';
import 'package:photos/ui/backup_folder_selection_page.dart';
import 'package:photos/ui/common/gradient_button.dart'; import 'package:photos/ui/common/gradient_button.dart';
import 'package:photos/ui/settings/backup/backup_folder_selection_page.dart';
import 'package:photos/utils/navigation_util.dart'; import 'package:photos/utils/navigation_util.dart';
class PreserveFooterWidget extends StatelessWidget { class PreserveFooterWidget extends StatelessWidget {

View file

@ -2,8 +2,8 @@ import 'package:flutter/material.dart';
import 'package:photo_manager/photo_manager.dart'; import 'package:photo_manager/photo_manager.dart';
import 'package:photos/generated/l10n.dart'; import 'package:photos/generated/l10n.dart';
import 'package:photos/services/local_sync_service.dart'; import 'package:photos/services/local_sync_service.dart';
import 'package:photos/ui/backup_folder_selection_page.dart';
import 'package:photos/ui/common/gradient_button.dart'; import 'package:photos/ui/common/gradient_button.dart';
import 'package:photos/ui/settings/backup/backup_folder_selection_page.dart';
import 'package:photos/utils/navigation_util.dart'; import 'package:photos/utils/navigation_util.dart';
class StartBackupHookWidget extends StatelessWidget { class StartBackupHookWidget extends StatelessWidget {

View file

@ -143,7 +143,7 @@ class SlideFadeTransition extends StatelessWidget {
return AnimatedBuilder( return AnimatedBuilder(
animation: animation!, animation: animation!,
builder: (context, child) => builder: (context, child) =>
animation!.value == 0.0 ? Container() : child!, animation!.value == 0.0 ? const SizedBox.shrink() : child!,
child: SlideTransition( child: SlideTransition(
position: Tween( position: Tween(
begin: const Offset(0.3, 0.0), begin: const Offset(0.3, 0.0),

View file

@ -63,7 +63,7 @@ class _PaymentWebPageState extends State<PaymentWebPage> {
children: <Widget>[ children: <Widget>[
(progress != 1.0) (progress != 1.0)
? LinearProgressIndicator(value: progress) ? LinearProgressIndicator(value: progress)
: Container(), : const SizedBox.shrink(),
Expanded( Expanded(
child: InAppWebView( child: InAppWebView(
initialUrlRequest: URLRequest(url: initPaymentUrl), initialUrlRequest: URLRequest(url: initPaymentUrl),

View file

@ -5,7 +5,7 @@ import "package:photos/generated/l10n.dart";
import 'package:photos/models/billing_plan.dart'; import 'package:photos/models/billing_plan.dart';
import 'package:photos/models/subscription.dart'; import 'package:photos/models/subscription.dart';
import 'package:photos/services/billing_service.dart'; import 'package:photos/services/billing_service.dart';
import 'package:photos/ui/home_widget.dart'; import "package:photos/ui/tabs/home_widget.dart";
class SkipSubscriptionWidget extends StatelessWidget { class SkipSubscriptionWidget extends StatelessWidget {
const SkipSubscriptionWidget({ const SkipSubscriptionWidget({

View file

@ -46,7 +46,7 @@ class _AppVersionWidgetState extends State<AppVersionWidget> {
), ),
); );
} }
return Container(); return const SizedBox.shrink();
}, },
), ),
); );

View file

@ -109,7 +109,7 @@ class _BackupFolderSelectionPageState extends State<BackupFolderSelectionPage> {
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
), ),
_deviceCollections == null _deviceCollections == null
? Container() ? const SizedBox.shrink()
: GestureDetector( : GestureDetector(
behavior: HitTestBehavior.translucent, behavior: HitTestBehavior.translucent,
child: Padding( child: Padding(

View file

@ -8,13 +8,13 @@ import 'package:photos/services/deduplication_service.dart';
import 'package:photos/services/sync_service.dart'; import 'package:photos/services/sync_service.dart';
import 'package:photos/services/update_service.dart'; import 'package:photos/services/update_service.dart';
import 'package:photos/theme/ente_theme.dart'; import 'package:photos/theme/ente_theme.dart';
import 'package:photos/ui/backup_folder_selection_page.dart'; import "package:photos/ui/components/captioned_text_widget.dart";
import 'package:photos/ui/backup_settings_screen.dart';
import 'package:photos/ui/components/captioned_text_widget.dart';
import 'package:photos/ui/components/dialog_widget.dart'; import 'package:photos/ui/components/dialog_widget.dart';
import 'package:photos/ui/components/expandable_menu_item_widget.dart'; import 'package:photos/ui/components/expandable_menu_item_widget.dart';
import 'package:photos/ui/components/menu_item_widget/menu_item_widget.dart'; import 'package:photos/ui/components/menu_item_widget/menu_item_widget.dart';
import 'package:photos/ui/components/models/button_type.dart'; import 'package:photos/ui/components/models/button_type.dart';
import 'package:photos/ui/settings/backup/backup_folder_selection_page.dart';
import 'package:photos/ui/settings/backup/backup_settings_screen.dart';
import 'package:photos/ui/settings/common_settings.dart'; import 'package:photos/ui/settings/common_settings.dart';
import 'package:photos/ui/tools/deduplicate_page.dart'; import 'package:photos/ui/tools/deduplicate_page.dart';
import 'package:photos/ui/tools/free_space_page.dart'; import 'package:photos/ui/tools/free_space_page.dart';

View file

@ -6,11 +6,11 @@ import 'package:photos/services/billing_service.dart';
import "package:photos/services/feature_flag_service.dart"; import "package:photos/services/feature_flag_service.dart";
import 'package:photos/services/user_service.dart'; import 'package:photos/services/user_service.dart';
import 'package:photos/theme/ente_theme.dart'; import 'package:photos/theme/ente_theme.dart';
import 'package:photos/ui/advanced_settings_screen.dart'; import "package:photos/ui/components/captioned_text_widget.dart";
import 'package:photos/ui/components/captioned_text_widget.dart'; import "package:photos/ui/components/expandable_menu_item_widget.dart";
import 'package:photos/ui/components/expandable_menu_item_widget.dart';
import 'package:photos/ui/components/menu_item_widget/menu_item_widget.dart'; import 'package:photos/ui/components/menu_item_widget/menu_item_widget.dart';
import "package:photos/ui/growth/referral_screen.dart"; import "package:photos/ui/growth/referral_screen.dart";
import 'package:photos/ui/settings/advanced_settings_screen.dart';
import 'package:photos/ui/settings/common_settings.dart'; import 'package:photos/ui/settings/common_settings.dart';
import "package:photos/ui/settings/language_picker.dart"; import "package:photos/ui/settings/language_picker.dart";
import 'package:photos/utils/navigation_util.dart'; import 'package:photos/utils/navigation_util.dart';

View file

@ -16,7 +16,7 @@ import "package:photos/ui/growth/referral_screen.dart";
import 'package:photos/ui/settings/about_section_widget.dart'; import 'package:photos/ui/settings/about_section_widget.dart';
import 'package:photos/ui/settings/account_section_widget.dart'; import 'package:photos/ui/settings/account_section_widget.dart';
import 'package:photos/ui/settings/app_version_widget.dart'; import 'package:photos/ui/settings/app_version_widget.dart';
import 'package:photos/ui/settings/backup_section_widget.dart'; import 'package:photos/ui/settings/backup/backup_section_widget.dart';
import 'package:photos/ui/settings/debug_section_widget.dart'; import 'package:photos/ui/settings/debug_section_widget.dart';
import 'package:photos/ui/settings/general_section_widget.dart'; import 'package:photos/ui/settings/general_section_widget.dart';
import 'package:photos/ui/settings/inherited_settings_state.dart'; import 'package:photos/ui/settings/inherited_settings_state.dart';

View file

@ -1,495 +0,0 @@
import 'dart:async';
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:logging/logging.dart';
import 'package:photos/core/configuration.dart';
import 'package:photos/core/event_bus.dart';
import 'package:photos/db/files_db.dart';
import 'package:photos/events/collection_updated_event.dart';
import 'package:photos/events/local_photos_updated_event.dart';
import 'package:photos/events/tab_changed_event.dart';
import 'package:photos/events/user_logged_out_event.dart';
import "package:photos/generated/l10n.dart";
import 'package:photos/models/collection.dart';
import 'package:photos/models/collection_items.dart';
import 'package:photos/models/gallery_type.dart';
import 'package:photos/services/collections_service.dart';
import 'package:photos/theme/colors.dart';
import 'package:photos/ui/collections/section_title.dart';
import 'package:photos/ui/common/gradient_button.dart';
import 'package:photos/ui/common/loading_widget.dart';
import "package:photos/ui/new_shared_collections_gallery.dart";
import 'package:photos/ui/sharing/user_avator_widget.dart';
import 'package:photos/ui/viewer/file/thumbnail_widget.dart';
import 'package:photos/ui/viewer/gallery/collection_page.dart';
import 'package:photos/utils/navigation_util.dart';
import 'package:photos/utils/share_util.dart';
import 'package:photos/utils/toast_util.dart';
class SharedCollectionGallery extends StatefulWidget {
const SharedCollectionGallery({Key? key}) : super(key: key);
@override
State<SharedCollectionGallery> createState() =>
_SharedCollectionGalleryState();
}
class _SharedCollectionGalleryState extends State<SharedCollectionGallery>
with AutomaticKeepAliveClientMixin {
final Logger _logger = Logger("SharedCollectionGallery");
late StreamSubscription<LocalPhotosUpdatedEvent> _localFilesSubscription;
late StreamSubscription<CollectionUpdatedEvent>
_collectionUpdatesSubscription;
late StreamSubscription<UserLoggedOutEvent> _loggedOutEvent;
@override
void initState() {
_localFilesSubscription =
Bus.instance.on<LocalPhotosUpdatedEvent>().listen((event) {
debugPrint("SetState Shared Collections on ${event.reason}");
setState(() {});
});
_collectionUpdatesSubscription =
Bus.instance.on<CollectionUpdatedEvent>().listen((event) {
debugPrint("SetState Shared Collections on ${event.reason}");
setState(() {});
});
_loggedOutEvent = Bus.instance.on<UserLoggedOutEvent>().listen((event) {
setState(() {});
});
super.initState();
}
@override
Widget build(BuildContext context) {
super.build(context);
return FutureBuilder<SharedCollections>(
future:
Future.value(CollectionsService.instance.getLatestCollectionFiles())
.then((files) async {
final List<CollectionWithThumbnail> outgoing = [];
final List<CollectionWithThumbnail> incoming = [];
for (final file in files) {
if (file.collectionID == null) {
_logger.severe("collection id should not be null");
continue;
}
final Collection? c =
CollectionsService.instance.getCollectionByID(file.collectionID!);
if (c == null) {
_logger
.severe("shared collection is not cached ${file.collectionID}");
CollectionsService.instance
.fetchCollectionByID(file.collectionID!)
.ignore();
continue;
}
if (c.owner!.id == Configuration.instance.getUserID()) {
if (c.hasSharees || c.hasLink || c.isSharedFilesCollection()) {
outgoing.add(
CollectionWithThumbnail(
c,
file,
),
);
}
} else {
incoming.add(
CollectionWithThumbnail(
c,
file,
),
);
}
}
outgoing.sort((first, second) {
if (second.collection.isSharedFilesCollection() ==
first.collection.isSharedFilesCollection()) {
return second.collection.updationTime
.compareTo(first.collection.updationTime);
} else {
if (first.collection.isSharedFilesCollection()) {
return 1;
}
return -1;
}
});
incoming.sort((first, second) {
return second.collection.updationTime
.compareTo(first.collection.updationTime);
});
return SharedCollections(outgoing, incoming);
}),
builder: (context, snapshot) {
if (snapshot.hasData) {
if ((snapshot.data?.incoming.length ?? 0) == 0 &&
(snapshot.data?.outgoing.length ?? 0) == 0) {
return const Center(child: EmptyStateWidget());
}
return _getSharedCollectionsGallery(snapshot.data!);
} else if (snapshot.hasError) {
_logger.severe(
"critical: failed to load share gallery",
snapshot.error,
snapshot.stackTrace,
);
return Center(child: Text(S.of(context).somethingWentWrong));
} else {
return const EnteLoadingWidget();
}
},
);
}
Widget _getSharedCollectionsGallery(SharedCollections collections) {
const double horizontalPaddingOfGridRow = 16;
const double crossAxisSpacingOfGrid = 9;
final Size size = MediaQuery.of(context).size;
final int albumsCountInOneRow = max(size.width ~/ 220.0, 2);
final double totalWhiteSpaceOfRow = (horizontalPaddingOfGridRow * 2) +
(albumsCountInOneRow - 1) * crossAxisSpacingOfGrid;
final double sideOfThumbnail = (size.width / albumsCountInOneRow) -
(totalWhiteSpaceOfRow / albumsCountInOneRow);
return SingleChildScrollView(
child: Container(
margin: const EdgeInsets.only(bottom: 50),
child: Column(
children: [
const SizedBox(height: 12),
SectionTitle(title: S.of(context).sharedWithMe),
const SizedBox(height: 12),
collections.incoming.isNotEmpty
? Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: GridView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
return IncomingCollectionItem(
collections.incoming[index],
);
},
itemCount: collections.incoming.length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: albumsCountInOneRow,
mainAxisSpacing: 12,
crossAxisSpacing: crossAxisSpacingOfGrid,
childAspectRatio:
sideOfThumbnail / (sideOfThumbnail + 24),
), //24 is height of album title
),
)
: _getIncomingCollectionEmptyState(),
const SizedBox(height: 16),
SectionTitle(title: S.of(context).sharedByMe),
const SizedBox(height: 12),
collections.outgoing.isNotEmpty
? ListView.builder(
shrinkWrap: true,
padding: const EdgeInsets.only(bottom: 12),
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
return OutgoingCollectionItem(
collections.outgoing[index],
);
},
itemCount: collections.outgoing.length,
)
: _getOutgoingCollectionEmptyState(),
const SizedBox(height: 32),
],
),
),
);
}
Widget _getIncomingCollectionEmptyState() {
return SizedBox(
height: 220,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
S.of(context).askYourLovedOnesToShare,
style: Theme.of(context).textTheme.caption,
),
const Padding(padding: EdgeInsets.only(top: 14)),
SizedBox(
width: 200,
height: 50,
child: GradientButton(
onTap: () async {
shareText(S.of(context).shareTextRecommendUsingEnte);
},
iconData: Icons.outgoing_mail,
text: S.of(context).invite,
),
),
const SizedBox(height: 60),
],
),
);
}
Widget _getOutgoingCollectionEmptyState() {
return SizedBox(
height: 200,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
S.of(context).shareYourFirstAlbum,
style: Theme.of(context).textTheme.caption,
),
const Padding(padding: EdgeInsets.only(top: 14)),
SizedBox(
width: 200,
height: 50,
child: GradientButton(
onTap: () async {
await showToast(
context,
S.of(context).shareAlbumHint,
toastLength: Toast.LENGTH_LONG,
);
Bus.instance.fire(
TabChangedEvent(1, TabChangedEventSource.collectionsPage),
);
},
iconData: Icons.person_add,
text: S.of(context).share,
),
),
const SizedBox(height: 60),
],
),
);
}
@override
void dispose() {
_localFilesSubscription.cancel();
_collectionUpdatesSubscription.cancel();
_loggedOutEvent.cancel();
super.dispose();
}
@override
bool get wantKeepAlive => true;
}
class OutgoingCollectionItem extends StatelessWidget {
final CollectionWithThumbnail c;
const OutgoingCollectionItem(
this.c, {
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
final shareesName = <String>[];
if (c.collection.hasSharees) {
for (int index = 0; index < c.collection.sharees!.length; index++) {
final sharee = c.collection.sharees![index]!;
final String name =
(sharee.name?.isNotEmpty ?? false) ? sharee.name! : sharee.email;
if (index < 2) {
shareesName.add(name);
} else {
final remaining = c.collection.sharees!.length - index;
if (remaining == 1) {
// If it's the last sharee
shareesName.add(name);
} else {
shareesName.add(
"and " +
remaining.toString() +
" other" +
(remaining > 1 ? "s" : ""),
);
}
break;
}
}
}
return GestureDetector(
behavior: HitTestBehavior.opaque,
child: Container(
margin: const EdgeInsets.fromLTRB(16, 12, 16, 12),
child: Row(
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.circular(1),
child: SizedBox(
height: 60,
width: 60,
child: Hero(
tag: "outgoing_collection" + c.thumbnail!.tag,
child: ThumbnailWidget(
c.thumbnail,
key: Key("outgoing_collection" + c.thumbnail!.tag),
),
),
),
),
const Padding(padding: EdgeInsets.all(8)),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
c.collection.displayName,
style: const TextStyle(
fontSize: 16,
),
),
const Padding(padding: EdgeInsets.all(2)),
c.collection.hasLink
? (c.collection.publicURLs!.first!.isExpired
? const Icon(
Icons.link,
color: warning500,
)
: const Icon(Icons.link))
: Container(),
],
),
shareesName.isEmpty
? Container()
: Padding(
padding: const EdgeInsets.fromLTRB(0, 4, 0, 0),
child: Text(
S.of(context).sharedWith(shareesName.join(", ")),
style: TextStyle(
fontSize: 14,
color: Theme.of(context).primaryColorLight,
),
textAlign: TextAlign.left,
overflow: TextOverflow.ellipsis,
),
),
],
),
),
],
),
),
onTap: () {
final page = CollectionPage(
c,
appBarType: GalleryType.ownedCollection,
tagPrefix: "outgoing_collection",
);
routeToPage(context, page);
},
);
}
}
class IncomingCollectionItem extends StatelessWidget {
final CollectionWithThumbnail c;
const IncomingCollectionItem(
this.c, {
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
const double horizontalPaddingOfGridRow = 16;
const double crossAxisSpacingOfGrid = 9;
final TextStyle albumTitleTextStyle =
Theme.of(context).textTheme.subtitle1!.copyWith(fontSize: 14);
final Size size = MediaQuery.of(context).size;
final int albumsCountInOneRow = max(size.width ~/ 220.0, 2);
final double totalWhiteSpaceOfRow = (horizontalPaddingOfGridRow * 2) +
(albumsCountInOneRow - 1) * crossAxisSpacingOfGrid;
final double sideOfThumbnail = (size.width / albumsCountInOneRow) -
(totalWhiteSpaceOfRow / albumsCountInOneRow);
return GestureDetector(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.circular(1),
child: SizedBox(
height: sideOfThumbnail,
width: sideOfThumbnail,
child: Stack(
children: [
Hero(
tag: "shared_collection" + c.thumbnail!.tag,
child: ThumbnailWidget(
c.thumbnail,
key: Key("shared_collection" + c.thumbnail!.tag),
shouldShowArchiveStatus: c.collection.hasShareeArchived(),
shouldShowSyncStatus: false,
),
),
Align(
alignment: Alignment.bottomRight,
child: Padding(
padding: const EdgeInsets.only(right: 8.0, bottom: 8.0),
child: UserAvatarWidget(
c.collection.owner!,
thumbnailView: true,
),
),
),
],
),
),
),
const SizedBox(height: 4),
Row(
children: [
Container(
constraints: BoxConstraints(maxWidth: sideOfThumbnail - 40),
child: Text(
c.collection.displayName,
style: albumTitleTextStyle,
overflow: TextOverflow.ellipsis,
),
),
FutureBuilder<int>(
future: FilesDB.instance.collectionFileCount(c.collection.id),
builder: (context, snapshot) {
if (snapshot.hasData && snapshot.data! > 0) {
return RichText(
text: TextSpan(
style: albumTitleTextStyle.copyWith(
color: albumTitleTextStyle.color!.withOpacity(0.5),
),
children: [
const TextSpan(text: " \u2022 "),
TextSpan(text: snapshot.data.toString()),
],
),
);
} else {
return Container();
}
},
),
],
),
],
),
onTap: () {
routeToPage(
context,
CollectionPage(
c,
appBarType: GalleryType.sharedCollection,
tagPrefix: "shared_collection",
),
);
},
);
}
}

View file

@ -30,22 +30,22 @@ import 'package:photos/services/user_service.dart';
import 'package:photos/states/user_details_state.dart'; import 'package:photos/states/user_details_state.dart';
import 'package:photos/theme/colors.dart'; import 'package:photos/theme/colors.dart';
import 'package:photos/theme/ente_theme.dart'; import 'package:photos/theme/ente_theme.dart';
import 'package:photos/ui/collection_action_sheet.dart'; import 'package:photos/ui/collections/collection_action_sheet.dart';
import 'package:photos/ui/collections_gallery_widget.dart'; import "package:photos/ui/common/bottom_shadow.dart";
import 'package:photos/ui/common/bottom_shadow.dart';
import 'package:photos/ui/extents_page_view.dart'; import 'package:photos/ui/extents_page_view.dart';
import 'package:photos/ui/home/grant_permissions_widget.dart'; import 'package:photos/ui/home/grant_permissions_widget.dart';
import 'package:photos/ui/home/header_widget.dart'; import 'package:photos/ui/home/header_widget.dart';
import 'package:photos/ui/home/home_bottom_nav_bar.dart'; import 'package:photos/ui/home/home_bottom_nav_bar.dart';
import 'package:photos/ui/home/home_gallery_widget.dart'; import 'package:photos/ui/home/home_gallery_widget.dart';
import 'package:photos/ui/home/landing_page_widget.dart'; import 'package:photos/ui/home/landing_page_widget.dart';
import "package:photos/ui/home/loading_photos_widget.dart";
import 'package:photos/ui/home/preserve_footer_widget.dart'; import 'package:photos/ui/home/preserve_footer_widget.dart';
import 'package:photos/ui/home/start_backup_hook_widget.dart'; import 'package:photos/ui/home/start_backup_hook_widget.dart';
import 'package:photos/ui/loading_photos_widget.dart';
import 'package:photos/ui/notification/update/change_log_page.dart'; import 'package:photos/ui/notification/update/change_log_page.dart';
import 'package:photos/ui/settings/app_update_dialog.dart'; import 'package:photos/ui/settings/app_update_dialog.dart';
import 'package:photos/ui/settings_page.dart'; import 'package:photos/ui/settings_page.dart';
import "package:photos/ui/shared_collections_gallery.dart"; import "package:photos/ui/tabs/shared_collections_tab.dart";
import "package:photos/ui/tabs/user_collections_tab.dart";
import 'package:photos/utils/dialog_util.dart'; import 'package:photos/utils/dialog_util.dart';
import 'package:receive_sharing_intent/receive_sharing_intent.dart'; import 'package:receive_sharing_intent/receive_sharing_intent.dart';
import 'package:uni_links/uni_links.dart'; import 'package:uni_links/uni_links.dart';
@ -60,8 +60,8 @@ class HomeWidget extends StatefulWidget {
} }
class _HomeWidgetState extends State<HomeWidget> { class _HomeWidgetState extends State<HomeWidget> {
static const _deviceFolderGalleryWidget = CollectionsGalleryWidget(); static const _userCollectionsTab = UserCollectionsTab();
static const _sharedCollectionGallery = SharedCollectionGallery(); static const _sharedCollectionTab = SharedCollectionsTab();
static final _settingsPage = SettingsPage( static final _settingsPage = SettingsPage(
emailNotifier: UserService.instance.emailValueNotifier, emailNotifier: UserService.instance.emailValueNotifier,
); );
@ -375,8 +375,8 @@ class _HomeWidgetState extends State<HomeWidget> {
footer: const PreserveFooterWidget(), footer: const PreserveFooterWidget(),
selectedFiles: _selectedFiles, selectedFiles: _selectedFiles,
), ),
_deviceFolderGalleryWidget, _userCollectionsTab,
_sharedCollectionGallery, _sharedCollectionTab,
], ],
); );
}, },

View file

@ -1,29 +1,19 @@
import "package:flutter/material.dart"; import "package:flutter/material.dart";
import "package:photos/core/constants.dart"; import "package:fluttertoast/fluttertoast.dart";
import "package:photos/core/event_bus.dart";
import "package:photos/events/tab_changed_event.dart";
import "package:photos/generated/l10n.dart"; import "package:photos/generated/l10n.dart";
import "package:photos/theme/ente_theme.dart"; import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/collection_action_sheet.dart"; import 'package:photos/ui/collections/collection_action_sheet.dart';
import "package:photos/ui/common/gradient_button.dart";
import 'package:photos/ui/components/buttons/button_widget.dart'; import 'package:photos/ui/components/buttons/button_widget.dart';
import "package:photos/ui/components/empty_state_item_widget.dart"; import "package:photos/ui/components/empty_state_item_widget.dart";
import "package:photos/ui/components/models/button_type.dart"; import "package:photos/ui/components/models/button_type.dart";
import "package:photos/utils/share_util.dart"; import "package:photos/utils/share_util.dart";
import "package:photos/utils/toast_util.dart";
class NewSharedCollectionsGallery extends StatelessWidget { class SharedEmptyStateWidget extends StatelessWidget {
const NewSharedCollectionsGallery({super.key}); const SharedEmptyStateWidget({super.key});
@override
Widget build(BuildContext context) {
return Center(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: restrictedMaxWidth),
child: const EmptyStateWidget(),
),
);
}
}
class EmptyStateWidget extends StatelessWidget {
const EmptyStateWidget({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -117,3 +107,76 @@ class EmptyStateWidget extends StatelessWidget {
); );
} }
} }
class OutgoingAlbumEmptyState extends StatelessWidget {
const OutgoingAlbumEmptyState({super.key});
@override
Widget build(BuildContext context) {
return SizedBox(
height: 200,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
S.of(context).shareYourFirstAlbum,
style: Theme.of(context).textTheme.caption,
),
const Padding(padding: EdgeInsets.only(top: 14)),
SizedBox(
width: 200,
height: 50,
child: GradientButton(
onTap: () async {
await showToast(
context,
S.of(context).shareAlbumHint,
toastLength: Toast.LENGTH_LONG,
);
Bus.instance.fire(
TabChangedEvent(1, TabChangedEventSource.collectionsPage),
);
},
iconData: Icons.person_add,
text: S.of(context).share,
),
),
const SizedBox(height: 60),
],
),
);
}
}
class IncomingAlbumEmptyState extends StatelessWidget {
const IncomingAlbumEmptyState({super.key});
@override
Widget build(BuildContext context) {
return SizedBox(
height: 220,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
S.of(context).askYourLovedOnesToShare,
style: Theme.of(context).textTheme.caption,
),
const Padding(padding: EdgeInsets.only(top: 14)),
SizedBox(
width: 200,
height: 50,
child: GradientButton(
onTap: () async {
shareText(S.of(context).shareTextRecommendUsingEnte);
},
iconData: Icons.outgoing_mail,
text: S.of(context).invite,
),
),
const SizedBox(height: 60),
],
),
);
}
}

View file

@ -0,0 +1,113 @@
import "dart:math";
import "package:flutter/material.dart";
import "package:photos/db/files_db.dart";
import "package:photos/models/collection_items.dart";
import "package:photos/models/gallery_type.dart";
import "package:photos/ui/sharing/user_avator_widget.dart";
import "package:photos/ui/viewer/file/thumbnail_widget.dart";
import "package:photos/ui/viewer/gallery/collection_page.dart";
import "package:photos/utils/navigation_util.dart";
class IncomingAlbumItem extends StatelessWidget {
final CollectionWithThumbnail c;
const IncomingAlbumItem(
this.c, {
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
const double horizontalPaddingOfGridRow = 16;
const double crossAxisSpacingOfGrid = 9;
final TextStyle albumTitleTextStyle =
Theme.of(context).textTheme.subtitle1!.copyWith(fontSize: 14);
final Size size = MediaQuery.of(context).size;
final int albumsCountInOneRow = max(size.width ~/ 220.0, 2);
final double totalWhiteSpaceOfRow = (horizontalPaddingOfGridRow * 2) +
(albumsCountInOneRow - 1) * crossAxisSpacingOfGrid;
final double sideOfThumbnail = (size.width / albumsCountInOneRow) -
(totalWhiteSpaceOfRow / albumsCountInOneRow);
return GestureDetector(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.circular(1),
child: SizedBox(
height: sideOfThumbnail,
width: sideOfThumbnail,
child: Stack(
children: [
Hero(
tag: "shared_collection" + c.thumbnail!.tag,
child: ThumbnailWidget(
c.thumbnail,
key: Key("shared_collection" + c.thumbnail!.tag),
shouldShowArchiveStatus: c.collection.hasShareeArchived(),
shouldShowSyncStatus: false,
),
),
Align(
alignment: Alignment.bottomRight,
child: Padding(
padding: const EdgeInsets.only(right: 8.0, bottom: 8.0),
child: UserAvatarWidget(
c.collection.owner!,
thumbnailView: true,
),
),
),
],
),
),
),
const SizedBox(height: 4),
Row(
children: [
Container(
constraints: BoxConstraints(maxWidth: sideOfThumbnail - 40),
child: Text(
c.collection.displayName,
style: albumTitleTextStyle,
overflow: TextOverflow.ellipsis,
),
),
FutureBuilder<int>(
future: FilesDB.instance.collectionFileCount(c.collection.id),
builder: (context, snapshot) {
if (snapshot.hasData && snapshot.data! > 0) {
return RichText(
text: TextSpan(
style: albumTitleTextStyle.copyWith(
color: albumTitleTextStyle.color!.withOpacity(0.5),
),
children: [
const TextSpan(text: " \u2022 "),
TextSpan(text: snapshot.data.toString()),
],
),
);
} else {
return const SizedBox.shrink();
}
},
),
],
),
],
),
onTap: () {
routeToPage(
context,
CollectionPage(
c,
appBarType: GalleryType.sharedCollection,
tagPrefix: "shared_collection",
),
);
},
);
}
}

View file

@ -0,0 +1,116 @@
import "package:flutter/material.dart";
import "package:photos/generated/l10n.dart";
import "package:photos/models/collection_items.dart";
import "package:photos/models/gallery_type.dart";
import 'package:photos/theme/colors.dart';
import "package:photos/ui/viewer/file/thumbnail_widget.dart";
import "package:photos/ui/viewer/gallery/collection_page.dart";
import "package:photos/utils/navigation_util.dart";
class OutgoingAlbumItem extends StatelessWidget {
final CollectionWithThumbnail c;
const OutgoingAlbumItem({super.key, required this.c});
@override
Widget build(BuildContext context) {
final shareesName = <String>[];
if (c.collection.hasSharees) {
for (int index = 0; index < c.collection.sharees!.length; index++) {
final sharee = c.collection.sharees![index]!;
final String name =
(sharee.name?.isNotEmpty ?? false) ? sharee.name! : sharee.email;
if (index < 2) {
shareesName.add(name);
} else {
final remaining = c.collection.sharees!.length - index;
if (remaining == 1) {
// If it's the last sharee
shareesName.add(name);
} else {
shareesName.add(
"and " +
remaining.toString() +
" other" +
(remaining > 1 ? "s" : ""),
);
}
break;
}
}
}
return GestureDetector(
behavior: HitTestBehavior.opaque,
child: Container(
margin: const EdgeInsets.fromLTRB(16, 12, 16, 12),
child: Row(
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.circular(1),
child: SizedBox(
height: 60,
width: 60,
child: Hero(
tag: "outgoing_collection" + c.thumbnail!.tag,
child: ThumbnailWidget(
c.thumbnail,
key: ValueKey("outgoing_collection" + c.thumbnail!.tag),
),
),
),
),
const Padding(padding: EdgeInsets.all(8)),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
c.collection.displayName,
style: const TextStyle(
fontSize: 16,
),
),
const Padding(padding: EdgeInsets.all(2)),
c.collection.hasLink
? (c.collection.publicURLs!.first!.isExpired
? const Icon(
Icons.link,
color: warning500,
)
: const Icon(Icons.link))
: const SizedBox.shrink(),
],
),
shareesName.isEmpty
? const SizedBox.shrink()
: Padding(
padding: const EdgeInsets.fromLTRB(0, 4, 0, 0),
child: Text(
S.of(context).sharedWith(shareesName.join(", ")),
style: TextStyle(
fontSize: 14,
color: Theme.of(context).primaryColorLight,
),
textAlign: TextAlign.left,
overflow: TextOverflow.ellipsis,
),
),
],
),
),
],
),
),
onTap: () {
final page = CollectionPage(
c,
appBarType: GalleryType.ownedCollection,
tagPrefix: "outgoing_collection",
);
routeToPage(context, page);
},
);
}
}

View file

@ -0,0 +1,212 @@
import 'dart:async';
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:logging/logging.dart';
import 'package:photos/core/configuration.dart';
import 'package:photos/core/event_bus.dart';
import 'package:photos/events/collection_updated_event.dart';
import 'package:photos/events/local_photos_updated_event.dart';
import 'package:photos/events/user_logged_out_event.dart';
import "package:photos/generated/l10n.dart";
import 'package:photos/models/collection.dart';
import 'package:photos/models/collection_items.dart';
import "package:photos/models/file.dart";
import 'package:photos/services/collections_service.dart';
import 'package:photos/ui/common/loading_widget.dart';
import 'package:photos/ui/tabs/section_title.dart';
import "package:photos/ui/tabs/shared/empty_state.dart";
import "package:photos/ui/tabs/shared/incoming_album_item.dart";
import "package:photos/ui/tabs/shared/outgoing_album_item.dart";
class SharedCollectionsTab extends StatefulWidget {
const SharedCollectionsTab({Key? key}) : super(key: key);
@override
State<SharedCollectionsTab> createState() => _SharedCollectionsTabState();
}
class _SharedCollectionsTabState extends State<SharedCollectionsTab>
with AutomaticKeepAliveClientMixin {
final Logger _logger = Logger("SharedCollectionGallery");
late StreamSubscription<LocalPhotosUpdatedEvent> _localFilesSubscription;
late StreamSubscription<CollectionUpdatedEvent>
_collectionUpdatesSubscription;
late StreamSubscription<UserLoggedOutEvent> _loggedOutEvent;
@override
void initState() {
_localFilesSubscription =
Bus.instance.on<LocalPhotosUpdatedEvent>().listen((event) {
debugPrint("SetState Shared Collections on ${event.reason}");
setState(() {});
});
_collectionUpdatesSubscription =
Bus.instance.on<CollectionUpdatedEvent>().listen((event) {
debugPrint("SetState Shared Collections on ${event.reason}");
setState(() {});
});
_loggedOutEvent = Bus.instance.on<UserLoggedOutEvent>().listen((event) {
setState(() {});
});
super.initState();
}
@override
Widget build(BuildContext context) {
super.build(context);
return FutureBuilder<SharedCollections>(
future:
Future.value(CollectionsService.instance.getLatestCollectionFiles())
.then((files) async {
return _getSharedCollections(files);
}),
builder: (context, snapshot) {
if (snapshot.hasData) {
if ((snapshot.data?.incoming.length ?? 0) == 0 &&
(snapshot.data?.outgoing.length ?? 0) == 0) {
return const Center(child: SharedEmptyStateWidget());
}
return _getSharedCollectionsGallery(snapshot.data!);
} else if (snapshot.hasError) {
_logger.severe(
"critical: failed to load share gallery",
snapshot.error,
snapshot.stackTrace,
);
return Center(child: Text(S.of(context).somethingWentWrong));
} else {
return const EnteLoadingWidget();
}
},
);
}
Widget _getSharedCollectionsGallery(SharedCollections collections) {
const double horizontalPaddingOfGridRow = 16;
const double crossAxisSpacingOfGrid = 9;
final Size size = MediaQuery.of(context).size;
final int albumsCountInOneRow = max(size.width ~/ 220.0, 2);
final double totalWhiteSpaceOfRow = (horizontalPaddingOfGridRow * 2) +
(albumsCountInOneRow - 1) * crossAxisSpacingOfGrid;
final double sideOfThumbnail = (size.width / albumsCountInOneRow) -
(totalWhiteSpaceOfRow / albumsCountInOneRow);
return SingleChildScrollView(
child: Container(
margin: const EdgeInsets.only(bottom: 50),
child: Column(
children: [
const SizedBox(height: 12),
SectionTitle(title: S.of(context).sharedWithMe),
const SizedBox(height: 12),
collections.incoming.isNotEmpty
? Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: GridView.builder(
shrinkWrap: true,
scrollDirection: Axis.vertical,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
return IncomingAlbumItem(
collections.incoming[index],
);
},
itemCount: collections.incoming.length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: albumsCountInOneRow,
mainAxisSpacing: 12,
crossAxisSpacing: crossAxisSpacingOfGrid,
childAspectRatio:
sideOfThumbnail / (sideOfThumbnail + 24),
), //24 is height of album title
),
)
: const IncomingAlbumEmptyState(),
const SizedBox(height: 16),
SectionTitle(title: S.of(context).sharedByMe),
const SizedBox(height: 12),
collections.outgoing.isNotEmpty
? ListView.builder(
shrinkWrap: true,
padding: const EdgeInsets.only(bottom: 12),
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
return OutgoingAlbumItem(
c: collections.outgoing[index],
);
},
itemCount: collections.outgoing.length,
)
: const OutgoingAlbumEmptyState(),
const SizedBox(height: 32),
],
),
),
);
}
SharedCollections _getSharedCollections(List<File> recentFileForCollections) {
final List<CollectionWithThumbnail> outgoing = [];
final List<CollectionWithThumbnail> incoming = [];
for (final file in recentFileForCollections) {
if (file.collectionID == null) {
_logger.severe("collection id should not be null");
continue;
}
final Collection? c =
CollectionsService.instance.getCollectionByID(file.collectionID!);
if (c == null) {
_logger.severe("shared collection is not cached ${file.collectionID}");
CollectionsService.instance
.fetchCollectionByID(file.collectionID!)
.ignore();
continue;
}
if (c.owner!.id == Configuration.instance.getUserID()) {
if (c.hasSharees || c.hasLink || c.isSharedFilesCollection()) {
outgoing.add(
CollectionWithThumbnail(
c,
file,
),
);
}
} else {
incoming.add(
CollectionWithThumbnail(
c,
file,
),
);
}
}
outgoing.sort((first, second) {
if (second.collection.isSharedFilesCollection() ==
first.collection.isSharedFilesCollection()) {
return second.collection.updationTime
.compareTo(first.collection.updationTime);
} else {
if (first.collection.isSharedFilesCollection()) {
return 1;
}
return -1;
}
});
incoming.sort((first, second) {
return second.collection.updationTime
.compareTo(first.collection.updationTime);
});
return SharedCollections(outgoing, incoming);
}
@override
void dispose() {
_localFilesSubscription.cancel();
_collectionUpdatesSubscription.cancel();
_loggedOutEvent.cancel();
super.dispose();
}
@override
bool get wantKeepAlive => true;
}

View file

@ -15,30 +15,29 @@ import 'package:photos/models/collection.dart';
import 'package:photos/models/collection_items.dart'; import 'package:photos/models/collection_items.dart';
import 'package:photos/services/collections_service.dart'; import 'package:photos/services/collections_service.dart';
import "package:photos/services/remote_sync_service.dart"; import "package:photos/services/remote_sync_service.dart";
import 'package:photos/ui/collections/archived_collections_button_widget.dart'; import "package:photos/ui/collections/button/archived_button.dart";
import "package:photos/ui/collections/button/hidden_button.dart";
import "package:photos/ui/collections/button/trash_button.dart";
import "package:photos/ui/collections/button/uncategorized_button.dart";
import 'package:photos/ui/collections/device_folders_grid_view_widget.dart'; import 'package:photos/ui/collections/device_folders_grid_view_widget.dart';
import 'package:photos/ui/collections/hidden_collections_button_widget.dart';
import 'package:photos/ui/collections/remote_collections_grid_view_widget.dart'; import 'package:photos/ui/collections/remote_collections_grid_view_widget.dart';
import 'package:photos/ui/collections/section_title.dart';
import 'package:photos/ui/collections/trash_button_widget.dart';
import 'package:photos/ui/collections/uncat_collections_button_widget.dart';
import 'package:photos/ui/common/loading_widget.dart'; import 'package:photos/ui/common/loading_widget.dart';
import 'package:photos/ui/components/buttons/icon_button_widget.dart'; import 'package:photos/ui/components/buttons/icon_button_widget.dart';
import 'package:photos/ui/tabs/section_title.dart';
import 'package:photos/ui/viewer/actions/delete_empty_albums.dart'; import 'package:photos/ui/viewer/actions/delete_empty_albums.dart';
import 'package:photos/ui/viewer/gallery/empty_state.dart'; import 'package:photos/ui/viewer/gallery/empty_state.dart';
import 'package:photos/utils/local_settings.dart'; import 'package:photos/utils/local_settings.dart';
class CollectionsGalleryWidget extends StatefulWidget { class UserCollectionsTab extends StatefulWidget {
const CollectionsGalleryWidget({Key? key}) : super(key: key); const UserCollectionsTab({Key? key}) : super(key: key);
@override @override
State<CollectionsGalleryWidget> createState() => State<UserCollectionsTab> createState() => _UserCollectionsTabState();
_CollectionsGalleryWidgetState();
} }
class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget> class _UserCollectionsTabState extends State<UserCollectionsTab>
with AutomaticKeepAliveClientMixin { with AutomaticKeepAliveClientMixin {
final _logger = Logger((_CollectionsGalleryWidgetState).toString()); final _logger = Logger((_UserCollectionsTabState).toString());
late StreamSubscription<LocalPhotosUpdatedEvent> _localFilesSubscription; late StreamSubscription<LocalPhotosUpdatedEvent> _localFilesSubscription;
late StreamSubscription<CollectionUpdatedEvent> late StreamSubscription<CollectionUpdatedEvent>
_collectionUpdatesSubscription; _collectionUpdatesSubscription;
@ -174,13 +173,13 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
padding: const EdgeInsets.symmetric(horizontal: 16), padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column( child: Column(
children: [ children: [
UnCatCollectionsButtonWidget(trashAndHiddenTextStyle), UnCategorizedCollections(trashAndHiddenTextStyle),
const SizedBox(height: 12), const SizedBox(height: 12),
ArchivedCollectionsButtonWidget(trashAndHiddenTextStyle), ArchivedCollectionsButton(trashAndHiddenTextStyle),
const SizedBox(height: 12), const SizedBox(height: 12),
HiddenCollectionsButtonWidget(trashAndHiddenTextStyle), HiddenCollectionsButtonWidget(trashAndHiddenTextStyle),
const SizedBox(height: 12), const SizedBox(height: 12),
TrashButtonWidget(trashAndHiddenTextStyle), TrashSectionButton(trashAndHiddenTextStyle),
], ],
), ),
), ),

View file

@ -309,7 +309,7 @@ class _DeduplicatePageState extends State<DeduplicatePage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
Container(), const SizedBox.shrink(),
PopupMenuButton( PopupMenuButton(
initialValue: sortKey.index, initialValue: sortKey.index,
child: Padding( child: Padding(

View file

@ -16,7 +16,7 @@ import 'package:photos/services/hidden_service.dart';
import 'package:photos/theme/ente_theme.dart'; import 'package:photos/theme/ente_theme.dart';
import 'package:photos/ui/actions/collection/collection_file_actions.dart'; import 'package:photos/ui/actions/collection/collection_file_actions.dart';
import 'package:photos/ui/actions/collection/collection_sharing_actions.dart'; import 'package:photos/ui/actions/collection/collection_sharing_actions.dart';
import 'package:photos/ui/collection_action_sheet.dart'; import 'package:photos/ui/collections/collection_action_sheet.dart';
import 'package:photos/ui/components/action_sheet_widget.dart'; import 'package:photos/ui/components/action_sheet_widget.dart';
import 'package:photos/ui/components/blur_menu_item_widget.dart'; 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/bottom_action_bar/expanded_menu_widget.dart';

View file

@ -6,7 +6,7 @@ import 'package:photos/models/gallery_type.dart';
import "package:photos/models/metadata/common_keys.dart"; import "package:photos/models/metadata/common_keys.dart";
import 'package:photos/models/selected_files.dart'; import 'package:photos/models/selected_files.dart';
import 'package:photos/theme/ente_theme.dart'; import 'package:photos/theme/ente_theme.dart';
import 'package:photos/ui/collection_action_sheet.dart'; import 'package:photos/ui/collections/collection_action_sheet.dart';
import 'package:photos/ui/components/bottom_action_bar/bottom_action_bar_widget.dart'; import 'package:photos/ui/components/bottom_action_bar/bottom_action_bar_widget.dart';
import 'package:photos/ui/components/buttons/icon_button_widget.dart'; import 'package:photos/ui/components/buttons/icon_button_widget.dart';
import 'package:photos/ui/viewer/actions/file_selection_actions_widget.dart'; import 'package:photos/ui/viewer/actions/file_selection_actions_widget.dart';

View file

@ -21,7 +21,7 @@ import 'package:photos/services/collections_service.dart';
import 'package:photos/services/hidden_service.dart'; import 'package:photos/services/hidden_service.dart';
import 'package:photos/services/ignored_files_service.dart'; import 'package:photos/services/ignored_files_service.dart';
import 'package:photos/services/local_sync_service.dart'; import 'package:photos/services/local_sync_service.dart';
import 'package:photos/ui/collection_action_sheet.dart'; import 'package:photos/ui/collections/collection_action_sheet.dart';
import 'package:photos/ui/viewer/file/custom_app_bar.dart'; import 'package:photos/ui/viewer/file/custom_app_bar.dart';
import "package:photos/ui/viewer/file_details/favorite_widget.dart"; import "package:photos/ui/viewer/file_details/favorite_widget.dart";
import "package:photos/ui/viewer/file_details/upload_icon_widget.dart"; import "package:photos/ui/viewer/file_details/upload_icon_widget.dart";

View file

@ -10,7 +10,7 @@ import 'package:photos/models/trash_file.dart';
import 'package:photos/theme/colors.dart'; import 'package:photos/theme/colors.dart';
import 'package:photos/theme/ente_theme.dart'; import 'package:photos/theme/ente_theme.dart';
import "package:photos/ui/actions/file/file_actions.dart"; import "package:photos/ui/actions/file/file_actions.dart";
import 'package:photos/ui/collection_action_sheet.dart'; import 'package:photos/ui/collections/collection_action_sheet.dart';
import 'package:photos/utils/delete_file_util.dart'; import 'package:photos/utils/delete_file_util.dart';
import 'package:photos/utils/share_util.dart'; import 'package:photos/utils/share_util.dart';

View file

@ -9,7 +9,7 @@ import 'package:photos/models/gallery_type.dart';
import "package:photos/models/metadata/common_keys.dart"; import "package:photos/models/metadata/common_keys.dart";
import 'package:photos/models/selected_files.dart'; import 'package:photos/models/selected_files.dart';
import 'package:photos/services/collections_service.dart'; import 'package:photos/services/collections_service.dart';
import "package:photos/ui/components/album_horizontal_list_widget.dart"; import "package:photos/ui/collections/album/horizontal_list.dart";
import 'package:photos/ui/viewer/actions/file_selection_overlay_bar.dart'; import 'package:photos/ui/viewer/actions/file_selection_overlay_bar.dart';
import "package:photos/ui/viewer/gallery/empty_state.dart"; import "package:photos/ui/viewer/gallery/empty_state.dart";
import 'package:photos/ui/viewer/gallery/gallery.dart'; import 'package:photos/ui/viewer/gallery/gallery.dart';
@ -68,7 +68,7 @@ class ArchivePage extends StatelessWidget {
emptyState: EmptyState( emptyState: EmptyState(
text: S.of(context).youDontHaveAnyArchivedItems, text: S.of(context).youDontHaveAnyArchivedItems,
), ),
header: AlbumHorizontalListWidget( header: AlbumHorizontalList(
CollectionsService.instance.getArchivedCollectionWithThumb, CollectionsService.instance.getArchivedCollectionWithThumb,
), ),
); );

View file

@ -111,7 +111,7 @@ class TrashPage extends StatelessWidget {
), ),
); );
} else { } else {
return Container(); return const SizedBox.shrink();
} }
}, },
); );

View file

@ -49,8 +49,8 @@ dependencies:
expansion_tile_card: ^2.0.0 expansion_tile_card: ^2.0.0
extended_image: ^6.2.1 extended_image: ^6.2.1
fast_base58: ^0.2.1 fast_base58: ^0.2.1
firebase_core: ^2.4.1 firebase_core: ^2.13.1
firebase_messaging: ^14.2.1 firebase_messaging: ^14.6.2
fk_user_agent: ^2.0.1 fk_user_agent: ^2.0.1
flutter: flutter:
sdk: flutter sdk: flutter

View file

@ -4,10 +4,10 @@
cd "$(dirname "$(readlink -f "$0")")" cd "$(dirname "$(readlink -f "$0")")"
# Pull from the latest tag where binaries were built # Pull from the latest tag where binaries were built
ANDROID_TAG="tf_2.5" ANDROID_TAG="tf_2.5"
IOS_TAG="v0.5.0" IOS_TAG="v0.5.0"
IOS_URL="https://github.com/am15h/tflite_flutter_plugin/releases/download/" IOS_URL="https://github.com/am15h/tflite_flutter_plugin/releases/download/"
ANDROID_URL="https://github.com/am15h/tflite_flutter_plugin/releases/download/" ANDROID_URL="https://github.com/am15h/tflite_flutter_plugin/releases/download/"