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 'dart:async';
|
||||||
|
|
||||||
|
import 'package:collection/collection.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.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';
|
||||||
@ -179,16 +180,37 @@ class RootApp extends HookConsumerWidget {
|
|||||||
return getSidebarTileList(context.l10n).map((s) => s.name).toList();
|
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(
|
final scaffold = MediaQuery.removeViewInsets(
|
||||||
context: context,
|
context: context,
|
||||||
removeBottom: true,
|
removeBottom: true,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
footers: const [
|
footers: [
|
||||||
BottomPlayer(),
|
BottomPlayer(key: bottomPlayerKey),
|
||||||
SpotubeNavigationBar(),
|
SpotubeNavigationBar(key: navigationBarKey),
|
||||||
],
|
],
|
||||||
floatingFooter: true,
|
floatingFooter: true,
|
||||||
child: Sidebar(child: child),
|
// 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),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user