Skip to content

Commit

Permalink
feat(yt): display red line under video thumbnails with user watch per…
Browse files Browse the repository at this point in the history
…centage
  • Loading branch information
MSOB7YY committed Jul 7, 2024
1 parent 00cae0f commit 02c9d8a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/youtube/widgets/yt_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class YoutubeCard extends StatelessWidget {
final String? channelID;
final bool displayChannelThumbnail;
final bool displaythirdLineText;
final List<Widget> onTopWidgets;
final List<Widget> Function(double width, double height)? onTopWidgets;
final String? smallBoxText;
final bool? checkmarkStatus;
final double thumbnailWidthPercentage;
Expand Down Expand Up @@ -48,7 +48,7 @@ class YoutubeCard extends StatelessWidget {
this.channelID,
this.displayChannelThumbnail = true,
this.displaythirdLineText = true,
this.onTopWidgets = const <Widget>[],
this.onTopWidgets,
this.smallBoxText,
this.checkmarkStatus,
this.thumbnailWidthPercentage = 1.0,
Expand Down Expand Up @@ -98,7 +98,7 @@ class YoutubeCard extends StatelessWidget {
width: thumbnailWidth,
height: thumbnailHeight,
borderRadius: 10.0,
onTopWidgets: onTopWidgets,
onTopWidgets: onTopWidgets?.call(thumbnailWidth, thumbnailHeight) ?? [],
smallBoxText: smallBoxText,
smallBoxIcon: smallBoxIcon,
extractColor: extractColor,
Expand Down
19 changes: 19 additions & 0 deletions lib/youtube/widgets/yt_video_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ class YoutubeVideoCard extends StatelessWidget {
DateTime? publishedDate = video.publishedAt.date;
final uploadDateAgo = publishedDate == null ? null : Jiffy.parseFromDateTime(publishedDate).fromNow();

final percentageWatched = video.percentageWatched;

return NamidaPopupWrapper(
openOnTap: false,
childrenDefault: getMenuItems,
Expand Down Expand Up @@ -104,6 +106,23 @@ class YoutubeVideoCard extends StatelessWidget {
smallBoxText: video.durSeconds?.secondsLabel,
bottomRightWidgets: YTUtils.getVideoCacheStatusIcons(videoId: videoId, context: context),
menuChildrenDefault: getMenuItems,
onTopWidgets: percentageWatched == null
? null
: (thumbWidth, thumbHeight) => [
Positioned(
bottom: 0,
left: 0,
child: SizedBox(
height: 1.25,
width: thumbWidth * percentageWatched,
child: const DecoratedBox(
decoration: BoxDecoration(
color: Color.fromARGB(190, 255, 20, 20),
),
),
),
),
],
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: namida
description: A Beautiful and Feature-rich Music Player, With YouTube & Video Support Built in Flutter
publish_to: "none"
version: 3.0.5-beta+240707210
version: 3.0.6-beta+240707211

environment:
sdk: ">=3.4.0 <4.0.0"
Expand Down

0 comments on commit 02c9d8a

Please sign in to comment.