Comments (10)
Oh thanks, I understand ๐ .
To do this, you need to pass a SlidableController
to all your Slidable
s. Then you can call the close
method on the SlidableController.activeState
property inside the onTap
callback of a GestureDetector
.
I suggest you to create a Widget for this:
class CloseSlidableOnTap extends StatelessWidget {
CloseSlidableOnTap({
Key key,
this.child,
this.controller,
}) : super(key: key);
final Widget child;
final SlidableController controller;
@override
Widget build(BuildContext context) {
return GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () => controller.activeState?.close(),
child: child,
);
}
}
from flutter_slidable.
How can I pass a SlidableController
to all my Slidable
. Slidable isn't have controller property. @letsar
from flutter_slidable.
oh thanks very much!
from flutter_slidable.
Hi @zywj, can post the minimal code to reproduce this issue please?
from flutter_slidable.
thanks for you reply. I just don't know how to hide the slidable when I tap other areas on the screen, not just the slidable item area.
from flutter_slidable.
I'm sorry, can you post an image or a video showing what you want? I'm not sure to understand.
from flutter_slidable.
sorry. I didn't describe my needs very clear.
I want to close the slidable when I tap the any other areas on the screen.
let me show you a image.
from flutter_slidable.
@letsar Hi, is there a way we can close a slidable automatically when any of its outside area is tapped?
from flutter_slidable.
@minhdanh
In slidable: wrap child with builder then use gesture detector to handle on tap -> (in on Tap send notification to close slidable, it is marked as internal use but it works if you need it asap)
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Slidable.of(context)!.close();
SlidableGroupNotification.dispatch(
context,
SlidableAutoCloseNotification(
groupTag: '0',
controller: Slidable.of(context)!,
),
assertParentExists: false,
);
},
child: Container(
Tho this is only useful if you want to close slidables when clicking on another slidable (not anywhere on the screen)
from flutter_slidable.
Thank you @Rongix
from flutter_slidable.
Related Issues (20)
- How to provide border radius to it ?
- The icon of SlidableAction will not be displayed in the center when padding is not set
- Style problem HOT 2
- How do I add a remove animation๏ผ
- How to open panes when creating widgets in Flutter slideable package
- When SlidableAction slides to the left to open, close the current page.
- Slidable open Not effective ๏ผ
- Doesn't work inside a PageView HOT 1
- how to dismiss slidableAction when using other widget HOT 1
- Want notification when automatically turning off sideslip
- Selection of text inside `TextField` triggers slidable
- how to open slidable in InitState HOT 1
- How to define custom height? HOT 1
- Edit label style and icons size
- Secondary deletion
- How to set the slider extent? HOT 1
- Subsequent row is open after Slidable row is dismissed.
- Focus on flutter web HOT 1
- Query: Smooth DismissiblePane Implementation within ActionPane?
- Slidable widget not closing properly HOT 1
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 flutter_slidable.