fix(player): gradient bg not taking full height

This commit is contained in:
Kingkor Roy Tirtho 2023-04-15 10:08:39 +06:00
parent da26c9a677
commit 62ad86e88d

View File

@ -76,142 +76,147 @@ class PlayerView extends HookConsumerWidget {
leading: const BackButton(), leading: const BackButton(),
), ),
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
body: AnimateGradient( body: SizedBox(
animateAlignments: true, height: double.infinity,
primaryBegin: Alignment.topLeft, child: AnimateGradient(
primaryEnd: Alignment.bottomLeft, animateAlignments: true,
secondaryBegin: Alignment.bottomRight, primaryBegin: Alignment.topLeft,
secondaryEnd: Alignment.topRight, primaryEnd: Alignment.bottomLeft,
duration: const Duration(seconds: 15), secondaryBegin: Alignment.bottomRight,
primaryColors: [ secondaryEnd: Alignment.topRight,
palette.dominantColor?.color ?? theme.colorScheme.primary, duration: const Duration(seconds: 15),
palette.mutedColor?.color ?? theme.colorScheme.secondary, primaryColors: [
], palette.dominantColor?.color ?? theme.colorScheme.primary,
secondaryColors: [ palette.mutedColor?.color ?? theme.colorScheme.secondary,
(palette.darkVibrantColor ?? palette.lightVibrantColor)?.color ?? ],
theme.colorScheme.primaryContainer, secondaryColors: [
(palette.darkMutedColor ?? palette.lightMutedColor)?.color ?? (palette.darkVibrantColor ?? palette.lightVibrantColor)?.color ??
theme.colorScheme.secondaryContainer, theme.colorScheme.primaryContainer,
], (palette.darkMutedColor ?? palette.lightMutedColor)?.color ??
child: SingleChildScrollView( theme.colorScheme.secondaryContainer,
child: Container( ],
alignment: Alignment.center, child: SingleChildScrollView(
width: double.infinity, child: Container(
child: ConstrainedBox( alignment: Alignment.center,
constraints: const BoxConstraints(maxWidth: 580), width: double.infinity,
child: SafeArea( child: ConstrainedBox(
child: Padding( constraints: const BoxConstraints(maxWidth: 580),
padding: const EdgeInsets.all(8.0), child: SafeArea(
child: Column( child: Padding(
children: [ padding: const EdgeInsets.all(8.0),
Padding( child: Column(
padding: const EdgeInsets.all(8.0), children: [
child: Container( Padding(
constraints: const BoxConstraints( padding: const EdgeInsets.all(8.0),
maxHeight: 300, maxWidth: 300), child: Container(
decoration: BoxDecoration( constraints: const BoxConstraints(
borderRadius: BorderRadius.circular(20), maxHeight: 300, maxWidth: 300),
boxShadow: const [ decoration: BoxDecoration(
BoxShadow( borderRadius: BorderRadius.circular(20),
color: Colors.black26, boxShadow: const [
spreadRadius: 2, BoxShadow(
blurRadius: 10, color: Colors.black26,
offset: Offset(0, 0), spreadRadius: 2,
blurRadius: 10,
offset: Offset(0, 0),
),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(20),
child: UniversalImage(
path: albumArt,
placeholder: Assets.albumPlaceholder.path,
fit: BoxFit.cover,
), ),
),
),
),
const SizedBox(height: 60),
Container(
padding: const EdgeInsets.symmetric(horizontal: 16),
alignment: Alignment.centerLeft,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AutoSizeText(
currentTrack?.name ?? "Not playing",
style: TextStyle(
color: titleTextColor,
fontSize: 22,
),
maxFontSize: 22,
maxLines: 1,
textAlign: TextAlign.start,
),
if (isLocalTrack)
Text(
TypeConversionUtils.artists_X_String<
Artist>(
currentTrack?.artists ?? [],
),
style: theme.textTheme.bodyMedium!.copyWith(
fontWeight: FontWeight.bold,
color: bodyTextColor,
),
)
else
TypeConversionUtils
.artists_X_ClickableArtists(
currentTrack?.artists ?? [],
textStyle:
theme.textTheme.bodyMedium!.copyWith(
fontWeight: FontWeight.bold,
color: bodyTextColor,
),
onRouteChange: (route) {
GoRouter.of(context).pop();
GoRouter.of(context).push(route);
},
),
], ],
), ),
child: ClipRRect(
borderRadius: BorderRadius.circular(20),
child: UniversalImage(
path: albumArt,
placeholder: Assets.albumPlaceholder.path,
fit: BoxFit.cover,
),
),
), ),
), const SizedBox(height: 10),
const SizedBox(height: 60), PlayerControls(palette: palette),
Container( const SizedBox(height: 25),
padding: const EdgeInsets.symmetric(horizontal: 16), PlayerActions(
alignment: Alignment.centerLeft, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
child: Column( floatingQueue: false,
crossAxisAlignment: CrossAxisAlignment.start, extraActions: [
children: [ if (auth != null)
AutoSizeText( IconButton(
currentTrack?.name ?? "Not playing", tooltip: "Open Lyrics",
style: TextStyle( icon: const Icon(SpotubeIcons.music),
color: titleTextColor, onPressed: () {
fontSize: 22, showModalBottomSheet(
), context: context,
maxFontSize: 22, isDismissible: true,
maxLines: 1, enableDrag: true,
textAlign: TextAlign.start, isScrollControlled: true,
), backgroundColor: Colors.black38,
if (isLocalTrack) barrierColor: Colors.black12,
Text( shape: const RoundedRectangleBorder(
TypeConversionUtils.artists_X_String<Artist>( borderRadius: BorderRadius.only(
currentTrack?.artists ?? [], topLeft: Radius.circular(20),
), topRight: Radius.circular(20),
style: theme.textTheme.bodyMedium!.copyWith( ),
fontWeight: FontWeight.bold, ),
color: bodyTextColor, constraints: BoxConstraints(
), maxHeight:
) MediaQuery.of(context).size.height *
else 0.8,
TypeConversionUtils.artists_X_ClickableArtists( ),
currentTrack?.artists ?? [], builder: (context) =>
textStyle: const LyricsPage(isModal: true),
theme.textTheme.bodyMedium!.copyWith( );
fontWeight: FontWeight.bold,
color: bodyTextColor,
),
onRouteChange: (route) {
GoRouter.of(context).pop();
GoRouter.of(context).push(route);
}, },
), )
], ],
), ),
), const SizedBox(height: 25)
const SizedBox(height: 10), ],
PlayerControls(palette: palette), ),
const SizedBox(height: 25),
PlayerActions(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
floatingQueue: false,
extraActions: [
if (auth != null)
IconButton(
tooltip: "Open Lyrics",
icon: const Icon(SpotubeIcons.music),
onPressed: () {
showModalBottomSheet(
context: context,
isDismissible: true,
enableDrag: true,
isScrollControlled: true,
backgroundColor: Colors.black38,
barrierColor: Colors.black12,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20),
),
),
constraints: BoxConstraints(
maxHeight:
MediaQuery.of(context).size.height *
0.8,
),
builder: (context) =>
const LyricsPage(isModal: true),
);
},
)
],
),
const SizedBox(height: 25)
],
), ),
), ),
), ),