Safearea fix for Home widgets

This commit is contained in:
Kingkor Roy Tirtho 2022-07-05 14:48:02 +06:00
parent 42257d9615
commit e2bba4ac94
6 changed files with 353 additions and 330 deletions

View File

@ -94,8 +94,7 @@ class Home extends HookConsumerWidget {
return null;
}, [backgroundColor]);
return SafeArea(
child: Scaffold(
return Scaffold(
body: Column(
children: [
if (_selectedIndex.value != 3)
@ -142,8 +141,7 @@ class Home extends HookConsumerWidget {
);
return PagedListView(
pagingController: pagingController,
builderDelegate:
PagedChildBuilderDelegate<Category>(
builderDelegate: PagedChildBuilderDelegate<Category>(
firstPageProgressIndicatorBuilder: (_) =>
const ShimmerCategories(),
newPageProgressIndicatorBuilder: (_) =>
@ -170,7 +168,6 @@ class Home extends HookConsumerWidget {
),
],
),
),
);
}
}

View File

@ -15,11 +15,13 @@ class UserLibrary extends ConsumerWidget {
return Expanded(
child: DefaultTabController(
length: 3,
child: SafeArea(
child: Scaffold(
appBar: TabBar(
indicator: const BoxDecoration(color: Colors.transparent),
labelColor: Theme.of(context).primaryColor,
unselectedLabelColor: Theme.of(context).textTheme.bodyText1?.color,
unselectedLabelColor:
Theme.of(context).textTheme.bodyText1?.color,
tabs: const [
Tab(text: "Playlist"),
Tab(text: "Artists"),
@ -35,6 +37,7 @@ class UserLibrary extends ConsumerWidget {
: const AnonymousFallback(),
),
),
),
);
}
}

View File

@ -52,7 +52,7 @@ class Lyrics extends HookConsumerWidget {
return Text(
lyrics == null && playback.track == null
? "No Track being played currently"
: lyrics!,
: lyrics ?? "",
style: textTheme.headline6
?.copyWith(color: textTheme.headline1?.color),
);

View File

@ -14,6 +14,7 @@ import 'package:spotube/helpers/artist-to-string.dart';
import 'package:spotube/helpers/image-to-url-string.dart';
import 'package:spotube/hooks/useAutoScrollController.dart';
import 'package:spotube/hooks/useBreakpoints.dart';
import 'package:spotube/hooks/useCustomStatusBarColor.dart';
import 'package:spotube/hooks/usePaletteColor.dart';
import 'package:spotube/hooks/useSyncedLyrics.dart';
import 'package:spotube/provider/Playback.dart';
@ -110,6 +111,12 @@ class SyncedLyrics extends HookConsumerWidget {
: textTheme.headline4?.copyWith(fontSize: 25))
?.copyWith(color: palette.titleTextColor);
useCustomStatusBarColor(
palette.color,
true,
noSetBGColor: true,
);
return Expanded(
child: Container(
clipBehavior: Clip.hardEdge,
@ -126,6 +133,7 @@ class SyncedLyrics extends HookConsumerWidget {
filter: ImageFilter.blur(sigmaX: 15, sigmaY: 15),
child: Container(
color: palette.color.withOpacity(.7),
child: SafeArea(
child: failed.value
? Lyrics(titleBarForegroundColor: palette.bodyTextColor)
: Column(
@ -206,6 +214,7 @@ class SyncedLyrics extends HookConsumerWidget {
),
),
),
),
);
}
}

View File

@ -120,6 +120,14 @@ class PlayerView extends HookConsumerWidget {
)..repeat();
return RotationTransition(
turns: Tween(begin: 0.0, end: 1.0).animate(controller),
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: paletteColor.titleTextColor,
width: 2,
),
shape: BoxShape.circle,
),
child: CircleAvatar(
backgroundImage: CachedNetworkImageProvider(
albumArt,
@ -128,6 +136,7 @@ class PlayerView extends HookConsumerWidget {
radius: MediaQuery.of(context).size.width *
(breakpoint.isSm ? 0.4 : 0.3),
),
),
);
}),
const Spacer(),

View File

@ -37,19 +37,22 @@ class Search extends HookConsumerWidget {
}
final searchSnapshot = ref.watch(searchQuery(searchTerm));
return Expanded(
return SafeArea(
child: Expanded(
child: Container(
color: Theme.of(context).backgroundColor,
child: Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
padding:
const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
child: Row(
children: [
Expanded(
child: TextField(
controller: controller,
decoration: const InputDecoration(hintText: "Search..."),
decoration:
const InputDecoration(hintText: "Search..."),
onSubmitted: (value) {
ref.read(searchTermStateProvider.notifier).state =
controller.value.text;
@ -116,9 +119,10 @@ class Search extends HookConsumerWidget {
imageToUrlString(track.value.album?.images),
isActive: playback.track?.id == track.value.id,
onTrackPlayButtonPressed: (currentTrack) async {
var isPlaylistPlaying = playback.playlist?.id !=
null &&
playback.playlist?.id == currentTrack.id;
var isPlaylistPlaying =
playback.playlist?.id != null &&
playback.playlist?.id ==
currentTrack.id;
if (!isPlaylistPlaying) {
playback.playPlaylist(
CurrentPlaylist(
@ -216,6 +220,7 @@ class Search extends HookConsumerWidget {
],
),
),
),
);
}
}