Skip to content

Commit

Permalink
fix: genre border issues
Browse files Browse the repository at this point in the history
  • Loading branch information
KRTirtho committed Dec 12, 2023
1 parent 792f702 commit 2fb16e6
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 24 deletions.
4 changes: 2 additions & 2 deletions lib/components/home/sections/genres.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class HomeGenresSection extends HookConsumerWidget {
borderRadius: BorderRadius.circular(8),
child: Ink(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
borderRadius: BorderRadius.circular(8),
image: DecorationImage(
image: UniversalImage.imageProvider(
category.icons!.first.url!,
Expand All @@ -127,7 +127,7 @@ class HomeGenresSection extends HookConsumerWidget {
),
child: Ink(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
borderRadius: BorderRadius.circular(5),
color: colorScheme.surfaceVariant,
gradient: categoriesQuery.isLoading ? null : gradient,
),
Expand Down
3 changes: 2 additions & 1 deletion lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -283,5 +283,6 @@
"go_to_album": "Go to Album",
"discord_rich_presence": "Discord Rich Presence",
"browse_all": "Browse All",
"genres": "Genres"
"genres": "Genres",
"explore_genres": "Explore Genres"
}
10 changes: 8 additions & 2 deletions lib/pages/home/genres/genre_playlists.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,21 @@ class GenrePlaylistsPage extends HookConsumerWidget {

return Scaffold(
appBar: const PageWindowTitleBar(
automaticallyImplyLeading: true,
leading: BackButton(color: Colors.white),
backgroundColor: Colors.transparent,
foregroundColor: Colors.white,
),
extendBodyBehindAppBar: true,
body: CustomScrollView(
controller: scrollController,
slivers: [
SliverAppBar(
automaticallyImplyLeading: false,
expandedHeight: mediaQuery.mdAndDown ? 200 : 250,
expandedHeight: mediaQuery.mdAndDown ? 200 : 150,
pinned: true,
floating: false,
title: const Text(""),
backgroundColor: Colors.brown.withOpacity(0.7),
flexibleSpace: FlexibleSpaceBar(
stretchModes: const [
StretchMode.zoomBackground,
Expand All @@ -76,6 +81,7 @@ class GenrePlaylistsPage extends HookConsumerWidget {
title: Text(
category.name!,
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
color: Colors.white,
letterSpacing: 3,
shadows: [
const Shadow(
Expand Down
13 changes: 11 additions & 2 deletions lib/pages/home/genres/genres.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import 'dart:math';

import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:skeletonizer/skeletonizer.dart';
import 'package:spotify/spotify.dart' hide Offset;
import 'package:spotube/collections/gradients.dart';
import 'package:spotube/components/shared/page_window_title_bar.dart';
import 'package:spotube/extensions/constrains.dart';
import 'package:spotube/extensions/context.dart';

import 'package:spotube/provider/user_preferences/user_preferences_provider.dart';
import 'package:spotube/services/queries/queries.dart';
Expand All @@ -29,7 +32,10 @@ class GenrePage extends HookConsumerWidget {
final mediaQuery = MediaQuery.of(context);

return Scaffold(
appBar: const PageWindowTitleBar(automaticallyImplyLeading: true),
appBar: PageWindowTitleBar(
title: Text(context.l10n.explore_genres),
automaticallyImplyLeading: true,
),
body: SafeArea(
top: false,
child: GridView.builder(
Expand All @@ -45,6 +51,7 @@ class GenrePage extends HookConsumerWidget {
itemCount: categories.length,
itemBuilder: (context, index) {
final category = categories[index];
final gradient = gradients[Random().nextInt(gradients.length)];
return InkWell(
borderRadius: BorderRadius.circular(8),
onTap: () {
Expand All @@ -58,12 +65,14 @@ class GenrePage extends HookConsumerWidget {
image: NetworkImage(category.icons!.first.url!),
fit: BoxFit.cover,
),
gradient: gradient,
),
child: Align(
alignment: Alignment.bottomCenter,
child: AutoSizeText(
category.name!,
style: textTheme.titleLarge?.copyWith(
color: Colors.white,
shadows: [
// stroke shadow
const Shadow(
Expand Down
6 changes: 4 additions & 2 deletions lib/services/queries/category.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ class CategoryQueries {
const CategoryQueries();

Query<List<Category>, dynamic> listAll(
WidgetRef ref, Market recommendationMarket) {
WidgetRef ref,
Market recommendationMarket,
) {
ref.watch(userPreferencesProvider.select((s) => s.locale));
final locale = useContext().l10n.localeName;
final query = useSpotifyQuery<List<Category>, dynamic>(
Expand All @@ -26,7 +28,7 @@ class CategoryQueries {
)
.all();

return categories.toList();
return categories.toList()..shuffle();
},
ref: ref,
);
Expand Down
54 changes: 39 additions & 15 deletions untranslated_messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,104 +3,128 @@
"go_to_album",
"discord_rich_presence",
"browse_all",
"genres"
"genres",
"explore_genres"
],

"bn": [
"go_to_album",
"discord_rich_presence",
"browse_all",
"genres"
"genres",
"explore_genres"
],

"ca": [
"go_to_album",
"discord_rich_presence",
"browse_all",
"genres"
"genres",
"explore_genres"
],

"de": [
"go_to_album",
"discord_rich_presence",
"browse_all",
"genres"
"genres",
"explore_genres"
],

"es": [
"go_to_album",
"discord_rich_presence",
"browse_all",
"genres"
"genres",
"explore_genres"
],

"fa": [
"go_to_album",
"discord_rich_presence",
"browse_all",
"genres"
"genres",
"explore_genres"
],

"fr": [
"go_to_album",
"discord_rich_presence",
"browse_all",
"genres"
"genres",
"explore_genres"
],

"hi": [
"go_to_album",
"discord_rich_presence",
"browse_all",
"genres"
"genres",
"explore_genres"
],

"it": [
"audio_source",
"go_to_album",
"discord_rich_presence",
"browse_all",
"genres",
"explore_genres"
],

"ja": [
"go_to_album",
"discord_rich_presence",
"browse_all",
"genres"
"genres",
"explore_genres"
],

"pl": [
"go_to_album",
"discord_rich_presence",
"browse_all",
"genres"
"genres",
"explore_genres"
],

"pt": [
"go_to_album",
"discord_rich_presence",
"browse_all",
"genres"
"genres",
"explore_genres"
],

"ru": [
"go_to_album",
"discord_rich_presence",
"browse_all",
"genres"
"genres",
"explore_genres"
],

"tr": [
"go_to_album",
"discord_rich_presence",
"browse_all",
"genres"
"genres",
"explore_genres"
],

"uk": [
"go_to_album",
"discord_rich_presence",
"browse_all",
"genres"
"genres",
"explore_genres"
],

"zh": [
"go_to_album",
"discord_rich_presence",
"browse_all",
"genres"
"genres",
"explore_genres"
]
}

0 comments on commit 2fb16e6

Please sign in to comment.