mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
fix: SafeArea for global bottom items not working
This commit is contained in:
parent
d845180e60
commit
b558cc17f1
@ -1,5 +1,6 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
@ -179,17 +180,38 @@ class RootApp extends HookConsumerWidget {
|
||||
return getSidebarTileList(context.l10n).map((s) => s.name).toList();
|
||||
}, []);
|
||||
|
||||
final bottomPlayerKey = useMemoized(() => GlobalKey<State>(), []);
|
||||
final navigationBarKey = useMemoized(() => GlobalKey<State>(), []);
|
||||
|
||||
final bottomPadding = useMemoized(() {
|
||||
return [bottomPlayerKey, navigationBarKey]
|
||||
.map((k) =>
|
||||
(k.currentContext?.findRenderObject() as RenderBox?)
|
||||
?.size
|
||||
.height ??
|
||||
0)
|
||||
.sum;
|
||||
}, [bottomPlayerKey, navigationBarKey]);
|
||||
|
||||
final scaffold = MediaQuery.removeViewInsets(
|
||||
context: context,
|
||||
removeBottom: true,
|
||||
child: Scaffold(
|
||||
footers: const [
|
||||
BottomPlayer(),
|
||||
SpotubeNavigationBar(),
|
||||
footers: [
|
||||
BottomPlayer(key: bottomPlayerKey),
|
||||
SpotubeNavigationBar(key: navigationBarKey),
|
||||
],
|
||||
floatingFooter: true,
|
||||
// Fix for safe are not working for bottom bar
|
||||
child: MediaQuery(
|
||||
data: MediaQuery.of(context).copyWith(
|
||||
padding: MediaQuery.of(context).padding.copyWith(
|
||||
bottom: bottomPadding,
|
||||
),
|
||||
),
|
||||
child: Sidebar(child: child),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
if (!kIsAndroid) {
|
||||
|
Loading…
Reference in New Issue
Block a user