Skip to content

Commit

Permalink
Album support (#106)
Browse files Browse the repository at this point in the history
* Set up album services

* Album support

* test

* Implement album support

* Update dependencies

* Improvement

* Fix google drive album thumbnail load

* Fix google drive album thumbnail

* Add preview on albums

* Album screen

* Album preview

* test

* Fix pop error

* Fix hero animation

* Add new selection menu

* Add new selection menu

* push build

* publish build

* Minor fix

* Album support

* Album improvement

* Album support

* Dispose unused streams

* Update home list issue

---------

Co-authored-by: Sneha Canopas <[email protected]>
  • Loading branch information
cp-pratik-k and cp-sneha-s authored Jan 9, 2025
1 parent 53b9c31 commit 8bc55ec
Show file tree
Hide file tree
Showing 62 changed files with 5,531 additions and 406 deletions.
80 changes: 58 additions & 22 deletions .idea/libraries/Dart_Packages.xml

Large diffs are not rendered by default.

25 changes: 14 additions & 11 deletions .idea/libraries/Flutter_Plugins.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions app/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
<data android:pathPrefix="/auth" />
</intent-filter>

<meta-data
android:name="flutter_deeplinking_enabled"
android:value="false" />

</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
Expand Down
28 changes: 28 additions & 0 deletions app/assets/locales/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
"common_info":"Info",
"common_upload": "Upload",
"common_download": "Download",
"common_edit": "Edit",
"common_delete": "Delete",
"common_share": "Share",
"common_cancel": "Cancel",
"common_retry": "Retry",
"common_remove": "Remove",
"common_done": "Done",
"common_not_available": "N/A",
"common_open_settings": "Open Settings",
Expand Down Expand Up @@ -116,6 +118,32 @@
"empty_media_title": "Oh Snap! No Media Found!",
"empty_media_message": "Looks like your gallery is taking a little break.",

"@_ALBUM":{},
"album_screen_title": "Albums",
"empty_album_title": "Oops! No Albums Here!",
"empty_album_message": "It seems like there are no albums to show right now. You can create a new one. We've got you covered!",

"@_ADD_ALBUM":{},
"add_album_screen_title": "Album",
"album_name_field_title": "Album Name",
"store_in_title": "Store In",
"store_in_device_title": "Device",

"@_ALBUM_MEDIA_LIST":{},
"add_items_action_title": "Add Items",
"edit_album_action_title": "Edit Album",
"delete_album_action_title": "Delete Album",
"remove_item_action_title": "Remove Items",
"empty_album_media_list_title": "A Quiet Album",
"empty_album_media_list_message": "It looks like you don't have any media in this album just yet. Go ahead, add some photos or videos, and let's make this place sparkle!",

"@_MEDIA_SELECTION":{},
"select_from_device_title": "Select from Device",
"select_from_google_drive_title": "Select from Google Drive",
"select_from_dropbox_title": "Select from Dropbox",
"no_media_access_title": "No cloud media access",
"no_cloud_media_access_message": "You don't have access to view media files, check you sign in with the cloud!",


"@_MEDIA_INFO":{},
"name_text": "Name",
Expand Down
2 changes: 2 additions & 0 deletions app/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,7 @@
<true/>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>FlutterDeepLinkingEnabled</key>
<false/>
</dict>
</plist>
116 changes: 116 additions & 0 deletions app/lib/components/app_media_thumbnail.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import 'package:data/models/media/media.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:style/extensions/context_extensions.dart';
import 'package:style/text/app_text_style.dart';
import '../domain/formatter/duration_formatter.dart';
import 'thumbnail_builder.dart';

class AppMediaThumbnail extends StatelessWidget {
final AppMedia media;
final String heroTag;
final void Function()? onTap;
final void Function()? onLongTap;
final bool selected;

const AppMediaThumbnail({
super.key,
required this.media,
required this.heroTag,
this.onTap,
this.onLongTap,
this.selected = false,
});

@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, constraints) => GestureDetector(
onTap: onTap,
onLongPress: onLongTap,
child: Stack(
alignment: Alignment.bottomLeft,
children: [
AnimatedOpacity(
curve: Curves.easeInOut,
duration: const Duration(milliseconds: 100),
opacity: selected ? 0.6 : 1,
child: AppMediaImage(
radius: selected ? 4 : 0,
size: constraints.biggest,
media: media,
heroTag: heroTag,
),
),
if (media.type.isVideo) _videoDuration(context),
if (selected)
Align(
alignment: Alignment.topLeft,
child: Container(
margin: const EdgeInsets.all(4),
padding: const EdgeInsets.all(4),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: context.colorScheme.primary,
),
child: const Icon(
CupertinoIcons.checkmark_alt,
color: Colors.white,
size: 14,
),
),
),
],
),
),
);
}

Widget _videoDuration(BuildContext context) => Align(
alignment: Alignment.topCenter,
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
stops: [0.0, 0.9],
begin: Alignment.topRight,
end: Alignment.bottomRight,
colors: [
Colors.black.withValues(alpha: 0.4),
Colors.transparent,
],
),
),
padding: const EdgeInsets.all(4).copyWith(bottom: 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
(media.videoDuration ?? Duration.zero).format,
style: AppTextStyles.caption.copyWith(
color: Colors.white,
fontSize: 12,
shadows: [
Shadow(
color: Colors.grey.shade400,
blurRadius: 5,
),
],
),
),
const SizedBox(width: 2),
Icon(
CupertinoIcons.play_fill,
color: Colors.white,
size: 14,
shadows: [
Shadow(
color: Colors.grey.shade400,
blurRadius: 5,
),
],
),
],
),
),
);
}
13 changes: 9 additions & 4 deletions app/lib/components/app_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class AppPage extends StatelessWidget {
final Widget? body;
final Widget Function(BuildContext context)? bodyBuilder;
final bool automaticallyImplyLeading;
final bool? resizeToAvoidBottomInset;
final bool resizeToAvoidBottomInset;
final Color? backgroundColor;
final Color? barBackgroundColor;

Expand All @@ -24,7 +24,7 @@ class AppPage extends StatelessWidget {
this.leading,
this.body,
this.floatingActionButton,
this.resizeToAvoidBottomInset,
this.resizeToAvoidBottomInset = true,
this.bodyBuilder,
this.automaticallyImplyLeading = true,
this.barBackgroundColor,
Expand All @@ -50,6 +50,7 @@ class AppPage extends StatelessWidget {
leading: leading,
middle: titleWidget ?? _title(context),
border: null,
enableBackgroundFilterBlur: false,
trailing: actions == null
? null
: actions!.length == 1
Expand All @@ -63,7 +64,7 @@ class AppPage extends StatelessWidget {
? MaterialLocalizations.of(context).backButtonTooltip
: null,
),
resizeToAvoidBottomInset: resizeToAvoidBottomInset ?? true,
resizeToAvoidBottomInset: resizeToAvoidBottomInset,
backgroundColor: backgroundColor,
child: Stack(
alignment: Alignment.bottomRight,
Expand All @@ -89,7 +90,10 @@ class AppPage extends StatelessWidget {
leading == null
? null
: AppBar(
centerTitle: true,
backgroundColor: barBackgroundColor,
scrolledUnderElevation: 0.5,
shadowColor: context.colorScheme.textDisabled,
title: titleWidget ?? _title(context),
actions: [...?actions, const SizedBox(width: 16)],
leading: leading,
Expand Down Expand Up @@ -150,7 +154,8 @@ class AdaptiveAppBar extends StatelessWidget {
: Column(
children: [
AppBar(
backgroundColor: context.colorScheme.barColor,
centerTitle: true,
backgroundColor: context.colorScheme.surface,
leading: leading,
actions: actions,
automaticallyImplyLeading: automaticallyImplyLeading,
Expand Down
1 change: 1 addition & 0 deletions app/lib/components/app_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Future<T?> showAppSheet<T>({
required Widget child,
}) {
return showModalBottomSheet(
useRootNavigator: true,
backgroundColor: context.colorScheme.containerNormalOnSurface,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(22),
Expand Down
Loading

0 comments on commit 8bc55ec

Please sign in to comment.