Comments (2)
_pc.hide()
should be replaced with _pc.close()
.
Here is a sample main.dart
:
import 'package:flutter/material.dart';
import 'package:sliding_up_panel/sliding_up_panel.dart';
void main() => runApp(Playground());
class Playground extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Playground',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: HomePage(),
);
}
}
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
PanelController _pc = new PanelController();
Widget build(BuildContext context){
return WillPopScope(
onWillPop: _onWillPop,
child: Material(
child: SlidingUpPanel(
panel: Center(child: Text("Panel")),
body: Center(child: Text("Body"),),
collapsed: Container(color: Colors.orange,),
parallaxEnabled: true,
controller: _pc,
)
),
);
}
Future<bool> _onWillPop() async{
if(_pc.isPanelOpen()){
_pc.close();
return false;
}else{
return true;
}
}
}
from sliding_up_panel.
_pc.hide()
should be replaced with_pc.close()
.Here is a sample
main.dart
:import 'package:flutter/material.dart'; import 'package:sliding_up_panel/sliding_up_panel.dart'; void main() => runApp(Playground()); class Playground extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, title: 'Playground', theme: ThemeData( primarySwatch: Colors.blue, ), home: HomePage(), ); } } class HomePage extends StatefulWidget { @override _HomePageState createState() => _HomePageState(); } class _HomePageState extends State<HomePage> { PanelController _pc = new PanelController(); Widget build(BuildContext context){ return WillPopScope( onWillPop: _onWillPop, child: Material( child: SlidingUpPanel( panel: Center(child: Text("Panel")), body: Center(child: Text("Body"),), collapsed: Container(color: Colors.orange,), parallaxEnabled: true, controller: _pc, ) ), ); } Future<bool> _onWillPop() async{ if(_pc.isPanelOpen()){ _pc.close(); return false; }else{ return true; } } }
This only works for collapsing the panel when pressing the back button.
But WillPopScope
is preventing closing the application when the panel is not open.
Any solution for this?
from sliding_up_panel.
Related Issues (20)
- panel!=null || panel builder!=null is not true HOT 1
- Feature request: collapsed widget that will not disappear when panel is open
- Better Support On Landscape Orientation HOT 1
- Can the package be used in a commercial app? HOT 3
- RefreshIndicator doesn't work with panelBuilder
- in SlideDirection.DOWN listview is unscrollable even with panelBuilder
- Firebase Crashlytics _SlidingUpPanelState._onGestureSlide HOT 1
- The area at the top of the sliding up panel is not clickable HOT 4
- Still maintained ? HOT 6
- [sliding_up_panel] can't scroll embed Native scroll view in SlidingUpPannel
- [Bug] sometimes the collapsed widget is not touchable anymore HOT 1
- SlidingUpPanel is dragging down when I start scrolling horizontal list inside Panel
- How do I use PanelBuilder for multiple lists? HOT 2
- error: The named parameter 'panel' isn't defined.
- Is it possible to touch other views on top of the istview to swipe to close the panel when the listview scrolls up a certain distance? HOT 3
- When the Listview position is at 0, calling the jumpTo or animateTo methods of ScrollController is invalid. HOT 2
- Half panel content disappear when moving back from other screen [iOS]
- Cannot Center 'header' HOT 2
- [Suggestion] Make snapping have more "tolerance" for user gestures
- How to set min height to 1.0(full height) and can scroll to 0.0(bottom).
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sliding_up_panel.