Open MadReal opened 5 years ago
@MadReal Can you attach a sample main.dart
file that reproduces this issue?
Here it is
import 'dart:ui';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:sliding_up_panel/sliding_up_panel.dart';
main() {
runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Example',
theme: ThemeData(
brightness: Brightness.dark,
primaryColor: Colors.blueAccent,
accentColor: Colors.blueAccent,
canvasColor: Colors.black54,
fontFamily: 'opensans'),
home: Home(),
),
);
}
class Home extends StatefulWidget {
const Home({Key key}) : super(key: key);
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> {
bool showBottomBar = true;
void setShowBottomBar(bool value) {
setState(() {
showBottomBar = value;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
extendBody: true,
appBar: AppBar(title: Text('Example')),
body: Center(child: Text('Example Body')),
bottomNavigationBar: Column(
mainAxisSize: MainAxisSize.min,
children: [
_BuildSlidingUpPanel(setShowBottomBar: setShowBottomBar),
if (showBottomBar)
CupertinoTabBar(
items: [
BottomNavigationBarItem(icon: Icon(Icons.access_alarm), title: Text('Tab')),
BottomNavigationBarItem(icon: Icon(Icons.access_alarm), title: Text('Tab')),
BottomNavigationBarItem(icon: Icon(Icons.access_alarm), title: Text('Tab')),
BottomNavigationBarItem(icon: Icon(Icons.access_alarm), title: Text('Tab')),
BottomNavigationBarItem(icon: Icon(Icons.access_alarm), title: Text('Tab'))
],
),
],
));
}
}
class _BuildSlidingUpPanel extends StatelessWidget {
static const _kPlayerBodyHeight = 58.0;
static const _kPlayerPaddingTop = 5.0;
final _pc = PanelController();
final Function(bool) setShowBottomBar;
_BuildSlidingUpPanel({this.setShowBottomBar});
@override
Widget build(BuildContext context) => SlidingUpPanel(
minHeight: _kPlayerBodyHeight,
maxHeight: MediaQuery.of(context).size.height,
controller: _pc,
onPanelSlide: (double value) {
setShowBottomBar(value == 0);
},
collapsed: Stack(
overflow: Overflow.visible,
children: [
// blurred background
ClipRect(
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 20, sigmaY: 20),
child: GestureDetector(
behavior: HitTestBehavior.opaque,
// onTap: playerStatus.pc.open,
child: Container(
padding: EdgeInsets.only(top: _kPlayerPaddingTop),
color: Colors.red.withAlpha(120),
width: double.infinity,
child: Row(
children: [
SizedBox(width: 10),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Swipe to open', overflow: TextOverflow.ellipsis),
])),
],
),
),
),
),
),
],
),
panel: Scaffold(body: Text('body')),
);
}
@akshathjain any update? Do you see the error too?
@MadReal I've been able to reproduce the issue. I'm currently looking into what is causing it.
this seems to be related to other issues which is causing the bottom of the body to be covered by a navigation bar... any quick workaround to this? I have been trying to add paddings of kBottomNavigationBarHeight but it's not enough it seems...
has this ever been resolved?
I'm having this same issue. It seems that the SlidingUpPanel uses a Stack widget with a height of the entire screen. So, to calculate the visible area height you need to take into account the height of the navigation bar, status bar, toolbar, etc.
Hello, I'm trying to extend the Panel to "full height" when it is open
Although there are a couple of problems:
First is this error:
The second issue is that there is no "safe area". I'm actually trying to emulate a "view" when the panel is open, with AppBar and Body but I can't achieve that because the content is pushed to the very edges