Skip to content

Commit

Permalink
extracted playlist styles
Browse files Browse the repository at this point in the history
  • Loading branch information
riverscuomo committed Jul 31, 2024
1 parent e422589 commit 4dca045
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 25 deletions.
6 changes: 3 additions & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class MyApp extends StatelessWidget {
color: Colors.black, // Match your scaffold background color
child: Center(
child: ConstrainedBox(
constraints: BoxConstraints(maxWidth: 600),
constraints: const BoxConstraints(maxWidth: 600),
child: child!,
),
),
Expand Down Expand Up @@ -96,8 +96,8 @@ final spotifyThemeData = ThemeData(
textTheme: TextTheme(
titleLarge: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
bodyMedium: TextStyle(color: Colors.white70),
titleMedium: TextStyle(color: Colors.white54),
labelSmall: TextStyle(color: Colors.grey),
// titleMedium: TextStyle(color: Colors.white54),
labelMedium: TextStyle(color: Colors.grey[400]),
),
inputDecorationTheme: InputDecorationTheme(
fillColor: const Color(0xFF212121),
Expand Down
26 changes: 19 additions & 7 deletions lib/screens/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,9 @@ class _HomeScreenState extends State<HomeScreen> {
// ? _buildPlaylistSelectionOptions()
// :
ExpansionTile(
title: Text(targetPlaylist.name ?? 'Unknown Playlist'),
title: PlaylistTitle(context, targetPlaylist),
leading: PlaylistImageIcon(playlist: targetPlaylist),
subtitle: targetPlaylist.owner != null
? Text(
'Playlist • ${targetPlaylist.owner!.displayName}',
style: Theme.of(context).textTheme.labelSmall,
)
: null,
subtitle: playlistSubtitle(targetPlaylist, context),
initiallyExpanded: jobs.isEmpty,

children: [
Expand Down Expand Up @@ -268,3 +263,20 @@ class _HomeScreenState extends State<HomeScreen> {
);
}
}

Widget playlistSubtitle(PlaylistSimple playlist, BuildContext context) {
return playlist.owner != null
? Text(
'Playlist • ${playlist.owner!.displayName}',
style: Theme.of(context).textTheme.labelMedium,
)
: const SizedBox();
}

Text PlaylistTitle(BuildContext context, PlaylistSimple playlist) {
return Text(
playlist.name ?? 'Unknown Playlist',
style: Theme.of(context).textTheme.titleMedium,
overflow: TextOverflow.ellipsis,
);
}
17 changes: 2 additions & 15 deletions lib/widgets/spotify_style_playlist_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,8 @@ class SpotifyStylePlaylistTile extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
playlist.name ?? 'Unknown Playlist',
style: const TextStyle(
color: Colors.white,
fontSize: 16,
fontWeight: FontWeight.w500,
),
overflow: TextOverflow.ellipsis,
),
playlist.owner != null
? Text(
'Playlist • ${playlist.owner!.displayName}',
style: Theme.of(context).textTheme.labelSmall,
)
: Container(),
PlaylistTitle(context, playlist),
playlistSubtitle(playlist, context)
],
),
),
Expand Down

0 comments on commit 4dca045

Please sign in to comment.