Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

marquee text #754

Open
wants to merge 27 commits into
base: redesign
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8e76316
marquee effect on song title
Decimate1405 May 28, 2024
fbf9b02
Merge pull request #1 from Decimate1405/marquee
Decimate1405 May 28, 2024
0e4a0ba
Merge pull request #2 from Decimate1405/redesign
Decimate1405 May 28, 2024
27708aa
marquee in song menu for overflow, instead of two lines
Decimate1405 May 28, 2024
0444946
Merge pull request #3 from Decimate1405/marquee
Decimate1405 May 28, 2024
da9b587
fixed non marquee text alignment issue
Decimate1405 May 28, 2024
0e5fea5
Merge pull request #4 from Decimate1405/marquee
Decimate1405 May 28, 2024
14bf1b9
added toggle to switch between 1 line or 2 lines of song title. Defau…
Decimate1405 May 31, 2024
81ca559
removed commented code
Decimate1405 May 31, 2024
70753f0
removed a character that was accidentally added
Decimate1405 May 31, 2024
d77668b
ditched custom scrolling_text for marquee, added dependency override …
Decimate1405 May 31, 2024
8ccb8f7
changed hive entry to 67, fixed alignment issues in nowplayingbar
Decimate1405 Jun 1, 2024
747727c
added checks for properly formatting title in player and nowplayingba…
Decimate1405 Jun 1, 2024
3677112
increased pause duration from 1 to 3 seconds. still need to fix one l…
Decimate1405 Jun 1, 2024
6951452
fixed duplicates in nowplaying bar
Decimate1405 Jun 1, 2024
3f111d2
changed subtitle description
Decimate1405 Jun 1, 2024
e577204
added BalancedText fallback if marquee isn't needed. Marquee text col…
Decimate1405 Jun 2, 2024
38ce9ec
marquee added in queue list
Decimate1405 Jun 2, 2024
79ddda6
added checks to properly handle >2 lines song titles to change to mar…
Decimate1405 Jun 3, 2024
6e57dfd
implemented marquee in track/album menu
Decimate1405 Jun 3, 2024
214e1e9
refactored code
Decimate1405 Jun 3, 2024
3bb3cb9
removed marquee from track/album screen
Decimate1405 Jun 4, 2024
c09cd94
nowplayingbar font color doesn't adapt to system color
Decimate1405 Jun 4, 2024
5d35833
kept marquee only for current playing track in queue list
Decimate1405 Jun 4, 2024
a6436eb
added marquee in hamburger menu song title
Decimate1405 Jun 4, 2024
afb8def
Moved the existing "one line marquee" setting to the customization se…
Decimate1405 Jul 10, 2024
81cc7fc
Added new customization option for truncating track title with ellips…
Decimate1405 Jul 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions lib/components/AlbumScreen/song_list_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:finamp/components/global_snackbar.dart';
import 'package:finamp/models/finamp_models.dart';
import 'package:finamp/models/jellyfin_models.dart' as jellyfin_models;
import 'package:finamp/services/finamp_user_helper.dart';
import 'package:finamp/services/one_line_marquee_helper.dart';
import 'package:finamp/services/queue_service.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
Expand Down Expand Up @@ -157,6 +158,7 @@ class _SongListTileState extends ConsumerState<SongListTile>
),
),
),

subtitle: Opacity(
opacity: playable ? 1.0 : 0.5,
child: Text.rich(
Expand Down Expand Up @@ -281,12 +283,12 @@ class _SongListTileState extends ConsumerState<SongListTile>
List<DownloadStub> offlineItems;
// If we're on the songs tab, just get all of the downloaded items
offlineItems = await downloadService.getAllSongs(
// nameFilter: widget.searchTerm,
viewFilter: finampUserHelper.currentUser?.currentView?.id,
nullableViewFilters:
settings.showDownloadsWithUnknownLibrary,
onlyFavorites:
settings.onlyShowFavourite && settings.trackOfflineFavorites,
// nameFilter: widget.searchTerm,
viewFilter: finampUserHelper.currentUser?.currentView?.id,
nullableViewFilters:
settings.showDownloadsWithUnknownLibrary,
onlyFavorites: settings.onlyShowFavourite &&
settings.trackOfflineFavorites,
);

var items = offlineItems
Expand Down
15 changes: 7 additions & 8 deletions lib/components/AlbumScreen/song_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:finamp/screens/artist_screen.dart';
import 'package:finamp/services/current_track_metadata_provider.dart';
import 'package:finamp/services/feedback_helper.dart';
import 'package:finamp/services/metadata_provider.dart';
import 'package:finamp/services/one_line_marquee_helper.dart';
import 'package:finamp/services/music_player_background_task.dart';
import 'package:finamp/services/queue_service.dart';
import 'package:finamp/services/theme_provider.dart';
Expand Down Expand Up @@ -836,20 +837,18 @@ class _SongInfoState extends ConsumerState<SongInfo> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
widget.item.name ??
OneLineMarqueeHelper(
key: ValueKey(
widget.item.id),
text: widget.item.name ??
AppLocalizations.of(context)!.unknownName,
textAlign: TextAlign.start,
style: TextStyle(
fontSize: widget.condensed ? 16 : 18,
height: 1.2,
color:
Theme.of(context).textTheme.bodyMedium?.color ??
Colors.white,
Theme.of(context).textTheme.bodyMedium?.color ??
Colors.white,
),
overflow: TextOverflow.ellipsis,
softWrap: true,
maxLines: 2,
),
Padding(
padding: widget.condensed
Expand Down
26 changes: 18 additions & 8 deletions lib/components/PlayerScreen/queue_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:finamp/models/finamp_models.dart';
import 'package:finamp/screens/blurred_player_screen_background.dart';
import 'package:finamp/services/feedback_helper.dart';
import 'package:finamp/services/finamp_settings_helper.dart';
import 'package:finamp/services/one_line_marquee_helper.dart';
import 'package:finamp/services/theme_provider.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
Expand Down Expand Up @@ -842,15 +843,24 @@ class _CurrentTrackState extends State<CurrentTrack> {
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
currentTrack?.item.title ??
AppLocalizations.of(context)!
.unknownName,
style: const TextStyle(
color: Colors.white,
SizedBox(
height: 20,
child: OneLineMarqueeHelper(
key: ValueKey(currentTrack?.item.id),
text: currentTrack?.item.title ??
AppLocalizations.of(context)!
.unknownName,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
overflow: TextOverflow.ellipsis),
height: 26 / 20,
color: Colors.white,
fontWeight:
Theme.of(context).brightness ==
Brightness.light
? FontWeight.w500
: FontWeight.w600,
),
),
),
const SizedBox(height: 4),
Row(
Expand Down
11 changes: 6 additions & 5 deletions lib/components/PlayerScreen/queue_list_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:finamp/models/finamp_models.dart';
import 'package:finamp/models/jellyfin_models.dart' as jellyfin_models;
import 'package:finamp/services/feedback_helper.dart';
import 'package:finamp/services/finamp_settings_helper.dart';
import 'package:finamp/services/one_line_marquee_helper.dart';
import 'package:finamp/services/process_artist.dart';
import 'package:finamp/services/queue_service.dart';
import 'package:flutter/material.dart' hide ReorderableList;
Expand Down Expand Up @@ -135,11 +136,11 @@ class _QueueListItemState extends State<QueueListItem>
widget.item.item.title,
style: widget.isCurrentTrack
? TextStyle(
color:
Theme.of(context).colorScheme.secondary,
fontSize: 16,
fontWeight: FontWeight.w400,
overflow: TextOverflow.ellipsis)
color:
Theme.of(context).colorScheme.secondary,
fontSize: 16,
fontWeight: FontWeight.w400,
overflow: TextOverflow.ellipsis)
: null,
overflow: TextOverflow.ellipsis,
),
Expand Down
26 changes: 18 additions & 8 deletions lib/components/PlayerScreen/song_name.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:audio_service/audio_service.dart';
import 'package:finamp/models/jellyfin_models.dart';
import 'package:finamp/screens/artist_screen.dart';
import 'package:finamp/services/finamp_settings_helper.dart';
import 'package:finamp/services/scrolling_text_helper.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
Expand Down Expand Up @@ -130,14 +131,23 @@ class SongNameContent extends StatelessWidget {
),
),
const Padding(padding: EdgeInsets.symmetric(vertical: 2)),
Text(
mediaItem == null
? AppLocalizations.of(context)!.noItem
: mediaItem!.title,
style: const TextStyle(fontSize: 24, fontWeight: FontWeight.w600),
overflow: TextOverflow.fade,
softWrap: false,
maxLines: 1,
Center(
child:
ScrollingTextHelper(
id: ValueKey(mediaItem!.id),
alignment: TextAlign.center,
text: mediaItem == null
? AppLocalizations.of(context)!.noItem
: mediaItem!.title,
style: TextStyle(
fontSize: 24,
height: 26 / 20,
fontWeight:
Theme.of(context).brightness == Brightness.light
? FontWeight.w500
: FontWeight.w600,
),
),
),
const Padding(padding: EdgeInsets.symmetric(vertical: 2)),
RichText(
Expand Down
27 changes: 8 additions & 19 deletions lib/components/PlayerScreen/song_name_content.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'package:balanced_text/balanced_text.dart';
import 'package:finamp/screens/player_screen.dart';
import 'package:finamp/services/scrolling_text_helper.dart';
import 'package:flutter/material.dart';
import 'package:finamp/components/AddToPlaylistScreen/add_to_playlist_button.dart';
import 'package:finamp/components/PlayerScreen/player_buttons_more.dart';
import 'package:finamp/models/finamp_models.dart';
import 'package:finamp/models/jellyfin_models.dart' as jellyfin_models;
import 'package:finamp/screens/player_screen.dart';
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';

import '../../services/queue_service.dart';
Expand Down Expand Up @@ -32,7 +32,6 @@ class SongNameContent extends StatelessWidget {
}

final currentTrack = snapshot.data!.currentTrack!;

final jellyfin_models.BaseItemDto? songBaseItemDto =
currentTrack.baseItem;

Expand All @@ -47,32 +46,22 @@ class SongNameContent extends StatelessWidget {
children: [
Center(
child: Container(
alignment: Alignment.center,
constraints: BoxConstraints(
maxHeight:
controller.shouldShow(PlayerHideable.twoLineTitle)
? 52
: 24,
maxWidth: 280,
),
child: BalancedText(
currentTrack.item.title,
textAlign: TextAlign.center,
child: ScrollingTextHelper(
id: ValueKey(currentTrack.item.id),
alignment: TextAlign.center,
text: currentTrack.item.title,
style: TextStyle(
fontSize: 20,
height: 26 / 20,
fontWeight:
Theme.of(context).brightness == Brightness.light
? FontWeight.w500
: FontWeight.w600,
overflow: TextOverflow.visible,
),
softWrap: true,
overflow: TextOverflow.ellipsis,
maxLines:
controller.shouldShow(PlayerHideable.twoLineTitle)
? 2
: 1,
useMarqueeCondition: false,
),
),
),
Expand Down
76 changes: 43 additions & 33 deletions lib/components/now_playing_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:finamp/components/AddToPlaylistScreen/add_to_playlist_button.dar
import 'package:finamp/models/finamp_models.dart';
import 'package:finamp/services/current_track_metadata_provider.dart';
import 'package:finamp/services/feedback_helper.dart';
import 'package:finamp/services/one_line_marquee_helper.dart';
import 'package:finamp/services/queue_service.dart';
import 'package:finamp/services/theme_provider.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -46,25 +47,20 @@ class NowPlayingBar extends ConsumerWidget {
]);

Color getProgressBackgroundColor(BuildContext context) {
return FinampSettingsHelper.finampSettings.showProgressOnNowPlayingBar ?
Color.alphaBlend(
Theme.of(context).brightness == Brightness.dark
? IconTheme.of(context)
.color!
.withOpacity(0.35)
: IconTheme.of(context)
.color!
.withOpacity(0.5),
Theme.of(context).brightness ==
Brightness.dark
? Colors.black
: Colors.white
) :
IconTheme.of(context).color!.withOpacity(0.85);
return FinampSettingsHelper.finampSettings.showProgressOnNowPlayingBar
? Color.alphaBlend(
Theme.of(context).brightness == Brightness.dark
? IconTheme.of(context).color!.withOpacity(0.35)
: IconTheme.of(context).color!.withOpacity(0.5),
Theme.of(context).brightness == Brightness.dark
? Colors.black
: Colors.white)
: IconTheme.of(context).color!.withOpacity(0.85);
}

Widget buildLoadingQueueBar(BuildContext context, Function()? retryCallback) {
final progressBackgroundColor = getProgressBackgroundColor(context).withOpacity(0.5);
final progressBackgroundColor =
getProgressBackgroundColor(context).withOpacity(0.5);

return SimpleGestureDetector(
onVerticalSwipe: (direction) {
Expand Down Expand Up @@ -138,7 +134,6 @@ class NowPlayingBar extends ConsumerWidget {

Widget buildNowPlayingBar(
BuildContext context, FinampQueueItem currentTrack) {

final audioHandler = GetIt.instance<MusicPlayerBackgroundTask>();

Duration? playbackPosition;
Expand All @@ -149,7 +144,7 @@ class NowPlayingBar extends ConsumerWidget {
: null;

final progressBackgroundColor = getProgressBackgroundColor(context);

return SafeArea(
child: Padding(
padding: const EdgeInsets.only(left: 12.0, bottom: 12.0, right: 12.0),
Expand Down Expand Up @@ -266,7 +261,8 @@ class NowPlayingBar extends ConsumerWidget {
Expanded(
child: Stack(
children: [
if (FinampSettingsHelper.finampSettings.showProgressOnNowPlayingBar)
if (FinampSettingsHelper.finampSettings
.showProgressOnNowPlayingBar)
Positioned(
left: 0,
top: 0,
Expand All @@ -279,7 +275,8 @@ class NowPlayingBar extends ConsumerWidget {
playbackPosition =
snapshot.data;
final screenSize =
MediaQuery.of(context).size;
MediaQuery.of(context)
.size;
return Container(
// rather hacky workaround, using LayoutBuilder would be nice but I couldn't get it to work...
width: max(
Expand All @@ -298,17 +295,20 @@ class NowPlayingBar extends ConsumerWidget {
.inMilliseconds)),
height: albumImageSize,
decoration: ShapeDecoration(
color: IconTheme.of(context)
.color!
.withOpacity(0.75),
color: IconTheme.of(
context)
.color!
.withOpacity(0.75),
shape:
const RoundedRectangleBorder(
borderRadius:
BorderRadius.only(
topRight:
Radius.circular(12),
Radius.circular(
12),
bottomRight:
Radius.circular(12),
Radius.circular(
12),
),
),
),
Expand All @@ -335,15 +335,25 @@ class NowPlayingBar extends ConsumerWidget {
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
currentTrack.item.title,
style: const TextStyle(
color: Colors.white,
SizedBox(
height: 20,
child: OneLineMarqueeHelper(
key: ValueKey(
currentTrack.item.id),
text: currentTrack
.item.title,
style: TextStyle(
fontSize: 16,
fontWeight:
FontWeight.w500,
overflow: TextOverflow
.ellipsis),
height: 26 / 20,
color: Colors.white,
fontWeight: Theme.of(
context)
.brightness ==
Brightness.light
? FontWeight.w500
: FontWeight.w600,
),
),
),
const SizedBox(height: 4),
Row(
Expand Down
Loading