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 40 commits into
base: redesign
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 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
1fc7860
fixed improper text formatting between single and double line titles
Decimate1405 Jan 29, 2025
bf4b704
added new toggle to force truncate song title if it exceeds two lines
Decimate1405 Jan 29, 2025
093f143
simplified marquee and truncate toggle descriptions
Decimate1405 Jan 29, 2025
c20cbb3
implemented marquee for long album names
Decimate1405 Jan 29, 2025
e175a09
oneLineMarquee on will use marquee for length 2 or more, off will onl…
Decimate1405 Jan 29, 2025
98a9f5f
chip padding fixed, width adjusts dynamically and after a certain thr…
Decimate1405 Jan 29, 2025
3d61f48
fixed an edge case in oneLineMarquee off
Decimate1405 Jan 29, 2025
bfaee4c
album marquee edge cases fixed
Decimate1405 Jan 29, 2025
98ad7ac
oneLineMarquee off more edge cases
Decimate1405 Jan 29, 2025
cf91e43
more edge cases for marquee
Decimate1405 Jan 31, 2025
ea75a87
removed truncate toggle as marquee toggle handles both cases. reworde…
Decimate1405 Feb 2, 2025
b815600
--ignore-- updated pubspec
Decimate1405 Feb 2, 2025
9d16a5b
Merge remote-tracking branch 'origin/redesign' into pr/Decimate1405/754
Chaphasilor Feb 15, 2025
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
19 changes: 7 additions & 12 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 @@ -314,7 +315,7 @@ class _SongMenuState extends ConsumerState<SongMenu> {
),
ListTile(
leading: Icon(
TablerIcons.playlist,
Icons.playlist_add,
color: iconColor,
),
title: Text(AppLocalizations.of(context)!.addToQueue),
Expand Down Expand Up @@ -836,20 +837,17 @@ 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,
),
overflow: TextOverflow.ellipsis,
softWrap: true,
maxLines: 2,
),
Padding(
padding: widget.condensed
Expand All @@ -873,11 +871,8 @@ class _SongInfoState extends ConsumerState<SongInfo> {
color:
Theme.of(context).textTheme.bodyMedium?.color ??
Colors.white,
backgroundColor: IconTheme.of(context)
.color
?.withOpacity(0.1) ??
Theme.of(context).textTheme.bodyMedium?.color ??
Colors.white,
backgroundColor:
IconTheme.of(context).color!.withOpacity(0.1),
key: widget.item.album == null
? null
: ValueKey("${widget.item.album}-album"),
Expand Down
72 changes: 61 additions & 11 deletions lib/components/PlayerScreen/album_chip.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import 'package:finamp/models/jellyfin_models.dart' as jellyfin_models;
import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:get_it/get_it.dart';
import 'package:finamp/services/scrolling_text_helper.dart';
import 'package:marquee/marquee.dart';

import '../../models/jellyfin_models.dart';
import '../../screens/album_screen.dart';
Expand All @@ -14,26 +17,73 @@ final _borderRadius = BorderRadius.circular(4);
class AlbumChip extends StatelessWidget {
const AlbumChip({
super.key,
this.item,
this.backgroundColor,
this.color,
required this.item,
required this.backgroundColor,
required this.color,
});

final BaseItemDto? item;
final BaseItemDto item;
final Color? backgroundColor;
final Color? color;

@override
Widget build(BuildContext context) {
if (item == null) return const _EmptyAlbumChip();
if (item?.album == null) return const SizedBox.shrink();

// Calculate text width
final textSpan = TextSpan(
text: item?.album ?? '',
style: Theme.of(context).textTheme.bodyMedium,
);
final textPainter = TextPainter(
text: textSpan,
textDirection: TextDirection.ltr,
)..layout();

final textWidth = textPainter.width + 24;
final screenWidth = MediaQuery.of(context).size.width - 32;
final shouldScroll = textWidth > screenWidth;

return Container(
constraints: const BoxConstraints(minWidth: 10),
child: _AlbumChipContent(
item: item!,
color: color,
backgroundColor: backgroundColor,
));
height: 32,
width: shouldScroll ? screenWidth : textWidth,
decoration: BoxDecoration(
color: backgroundColor?.withOpacity(0.1),
borderRadius: BorderRadius.circular(4),
),
child: Material(
type: MaterialType.transparency,
child: InkWell(
borderRadius: BorderRadius.circular(4),
onTap: () => Navigator.of(context).pushNamed(
AlbumScreen.routeName,
arguments: item?.albumId,
),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Center(
child: shouldScroll
? Marquee(
text: item?.album ?? '',
style: Theme.of(context).textTheme.bodyMedium,
scrollAxis: Axis.horizontal,
crossAxisAlignment: CrossAxisAlignment.center,
blankSpace: 50.0,
velocity: 30.0,
pauseAfterRound: const Duration(seconds: 1),
startAfter: const Duration(seconds: 1),
fadingEdgeStartFraction: 0.1,
fadingEdgeEndFraction: 0.1,
)
: Text(
item?.album ?? '',
style: Theme.of(context).textTheme.bodyMedium,
),
),
),
),
),
);
}
}

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 @@ -11,6 +11,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 @@ -847,15 +848,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
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
Loading