fix: genre border issues

This commit is contained in:
Kingkor Roy Tirtho 2023-12-12 21:27:14 +06:00
parent 792f702f9e
commit 2fb16e64e9
6 changed files with 66 additions and 24 deletions

View File

@ -117,7 +117,7 @@ class HomeGenresSection extends HookConsumerWidget {
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
child: Ink( child: Ink(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(8),
image: DecorationImage( image: DecorationImage(
image: UniversalImage.imageProvider( image: UniversalImage.imageProvider(
category.icons!.first.url!, category.icons!.first.url!,
@ -127,7 +127,7 @@ class HomeGenresSection extends HookConsumerWidget {
), ),
child: Ink( child: Ink(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(5),
color: colorScheme.surfaceVariant, color: colorScheme.surfaceVariant,
gradient: categoriesQuery.isLoading ? null : gradient, gradient: categoriesQuery.isLoading ? null : gradient,
), ),

View File

@ -283,5 +283,6 @@
"go_to_album": "Go to Album", "go_to_album": "Go to Album",
"discord_rich_presence": "Discord Rich Presence", "discord_rich_presence": "Discord Rich Presence",
"browse_all": "Browse All", "browse_all": "Browse All",
"genres": "Genres" "genres": "Genres",
"explore_genres": "Explore Genres"
} }

View File

@ -43,8 +43,9 @@ class GenrePlaylistsPage extends HookConsumerWidget {
return Scaffold( return Scaffold(
appBar: const PageWindowTitleBar( appBar: const PageWindowTitleBar(
automaticallyImplyLeading: true, leading: BackButton(color: Colors.white),
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
foregroundColor: Colors.white,
), ),
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
body: CustomScrollView( body: CustomScrollView(
@ -52,7 +53,11 @@ class GenrePlaylistsPage extends HookConsumerWidget {
slivers: [ slivers: [
SliverAppBar( SliverAppBar(
automaticallyImplyLeading: false, 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( flexibleSpace: FlexibleSpaceBar(
stretchModes: const [ stretchModes: const [
StretchMode.zoomBackground, StretchMode.zoomBackground,
@ -76,6 +81,7 @@ class GenrePlaylistsPage extends HookConsumerWidget {
title: Text( title: Text(
category.name!, category.name!,
style: Theme.of(context).textTheme.headlineMedium?.copyWith( style: Theme.of(context).textTheme.headlineMedium?.copyWith(
color: Colors.white,
letterSpacing: 3, letterSpacing: 3,
shadows: [ shadows: [
const Shadow( const Shadow(

View File

@ -1,12 +1,15 @@
import 'dart:math';
import 'package:auto_size_text/auto_size_text.dart'; import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:skeletonizer/skeletonizer.dart';
import 'package:spotify/spotify.dart' hide Offset; 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/components/shared/page_window_title_bar.dart';
import 'package:spotube/extensions/constrains.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/provider/user_preferences/user_preferences_provider.dart';
import 'package:spotube/services/queries/queries.dart'; import 'package:spotube/services/queries/queries.dart';
@ -29,7 +32,10 @@ class GenrePage extends HookConsumerWidget {
final mediaQuery = MediaQuery.of(context); final mediaQuery = MediaQuery.of(context);
return Scaffold( return Scaffold(
appBar: const PageWindowTitleBar(automaticallyImplyLeading: true), appBar: PageWindowTitleBar(
title: Text(context.l10n.explore_genres),
automaticallyImplyLeading: true,
),
body: SafeArea( body: SafeArea(
top: false, top: false,
child: GridView.builder( child: GridView.builder(
@ -45,6 +51,7 @@ class GenrePage extends HookConsumerWidget {
itemCount: categories.length, itemCount: categories.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final category = categories[index]; final category = categories[index];
final gradient = gradients[Random().nextInt(gradients.length)];
return InkWell( return InkWell(
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
onTap: () { onTap: () {
@ -58,12 +65,14 @@ class GenrePage extends HookConsumerWidget {
image: NetworkImage(category.icons!.first.url!), image: NetworkImage(category.icons!.first.url!),
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
gradient: gradient,
), ),
child: Align( child: Align(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
child: AutoSizeText( child: AutoSizeText(
category.name!, category.name!,
style: textTheme.titleLarge?.copyWith( style: textTheme.titleLarge?.copyWith(
color: Colors.white,
shadows: [ shadows: [
// stroke shadow // stroke shadow
const Shadow( const Shadow(

View File

@ -13,7 +13,9 @@ class CategoryQueries {
const CategoryQueries(); const CategoryQueries();
Query<List<Category>, dynamic> listAll( Query<List<Category>, dynamic> listAll(
WidgetRef ref, Market recommendationMarket) { WidgetRef ref,
Market recommendationMarket,
) {
ref.watch(userPreferencesProvider.select((s) => s.locale)); ref.watch(userPreferencesProvider.select((s) => s.locale));
final locale = useContext().l10n.localeName; final locale = useContext().l10n.localeName;
final query = useSpotifyQuery<List<Category>, dynamic>( final query = useSpotifyQuery<List<Category>, dynamic>(
@ -26,7 +28,7 @@ class CategoryQueries {
) )
.all(); .all();
return categories.toList(); return categories.toList()..shuffle();
}, },
ref: ref, ref: ref,
); );

View File

@ -3,104 +3,128 @@
"go_to_album", "go_to_album",
"discord_rich_presence", "discord_rich_presence",
"browse_all", "browse_all",
"genres" "genres",
"explore_genres"
], ],
"bn": [ "bn": [
"go_to_album", "go_to_album",
"discord_rich_presence", "discord_rich_presence",
"browse_all", "browse_all",
"genres" "genres",
"explore_genres"
], ],
"ca": [ "ca": [
"go_to_album", "go_to_album",
"discord_rich_presence", "discord_rich_presence",
"browse_all", "browse_all",
"genres" "genres",
"explore_genres"
], ],
"de": [ "de": [
"go_to_album", "go_to_album",
"discord_rich_presence", "discord_rich_presence",
"browse_all", "browse_all",
"genres" "genres",
"explore_genres"
], ],
"es": [ "es": [
"go_to_album", "go_to_album",
"discord_rich_presence", "discord_rich_presence",
"browse_all", "browse_all",
"genres" "genres",
"explore_genres"
], ],
"fa": [ "fa": [
"go_to_album", "go_to_album",
"discord_rich_presence", "discord_rich_presence",
"browse_all", "browse_all",
"genres" "genres",
"explore_genres"
], ],
"fr": [ "fr": [
"go_to_album", "go_to_album",
"discord_rich_presence", "discord_rich_presence",
"browse_all", "browse_all",
"genres" "genres",
"explore_genres"
], ],
"hi": [ "hi": [
"go_to_album", "go_to_album",
"discord_rich_presence", "discord_rich_presence",
"browse_all", "browse_all",
"genres" "genres",
"explore_genres"
],
"it": [
"audio_source",
"go_to_album",
"discord_rich_presence",
"browse_all",
"genres",
"explore_genres"
], ],
"ja": [ "ja": [
"go_to_album", "go_to_album",
"discord_rich_presence", "discord_rich_presence",
"browse_all", "browse_all",
"genres" "genres",
"explore_genres"
], ],
"pl": [ "pl": [
"go_to_album", "go_to_album",
"discord_rich_presence", "discord_rich_presence",
"browse_all", "browse_all",
"genres" "genres",
"explore_genres"
], ],
"pt": [ "pt": [
"go_to_album", "go_to_album",
"discord_rich_presence", "discord_rich_presence",
"browse_all", "browse_all",
"genres" "genres",
"explore_genres"
], ],
"ru": [ "ru": [
"go_to_album", "go_to_album",
"discord_rich_presence", "discord_rich_presence",
"browse_all", "browse_all",
"genres" "genres",
"explore_genres"
], ],
"tr": [ "tr": [
"go_to_album", "go_to_album",
"discord_rich_presence", "discord_rich_presence",
"browse_all", "browse_all",
"genres" "genres",
"explore_genres"
], ],
"uk": [ "uk": [
"go_to_album", "go_to_album",
"discord_rich_presence", "discord_rich_presence",
"browse_all", "browse_all",
"genres" "genres",
"explore_genres"
], ],
"zh": [ "zh": [
"go_to_album", "go_to_album",
"discord_rich_presence", "discord_rich_presence",
"browse_all", "browse_all",
"genres" "genres",
"explore_genres"
] ]
} }