Comments (5)
I forgot to mention you should use the Slidable.builder
constructor and SlideActionBuilderDelegate
s, otherwise you will end up with the same context as the Slidable
. This is why Slidable.of(context)
is null
.
from flutter_slidable.
Hi,
I thought we could do this with Scrollable.of
but we cannot use this after a dialog show.
I will try to implement some kind of controller, and see if we can use this.
from flutter_slidable.
Oh I succeeded to do what you want by getting the state before showing the AlertDialog
.
The code below is what I put in the tap
callback of my slide action:
onTap: () async {
var state = Slidable
.of(context);
var dismiss = await showDialog<bool>(
context: context,
builder: (context) {
return new AlertDialog(
title: new Text('Delete'),
content: new Text('Item will be deleted'),
actions: <Widget>[
new FlatButton(
child: new Text('Cancel'),
onPressed: () => Navigator.of(context).pop(false),
),
new FlatButton(
child: new Text('Ok'),
onPressed: () => Navigator.of(context).pop(true),
),
],
);
},
);
if (dismiss) {
state.dismiss();
}
},
from flutter_slidable.
thank you for you reply, but unfortunately I didn't manage to reproduce your solution.
Error is: NoSuchMethodError: The method 'dismiss' was called on null. I manage to come up with workaround using streams, but I still wonder where is the problem :/
here is my code
SlideAction(
onTap: () async {
var state = Slidable
.of(context);
var dismiss = await showDialog<bool>(
context: context,
builder: (context) {
return AlertDialog(
title: Text(S.of(context).confirmDeletion),
content: Text(S.of(context).deletionDescription),
actions: <Widget>[
FlatButton(
child: Text(S.of(context).cancel),
onPressed: () => Navigator.of(context).pop(false),
),
FlatButton(
child: Text(S.of(context).ok),
onPressed: () => Navigator.of(context).pop(true),
)
],
);
},
);
if (dismiss) {
state.dismiss();
}
},
color: _tag.color,
child: Icon(Icons.delete, color: Colors.white,),
)
],
from flutter_slidable.
I forgot to mention you should use the
Slidable.builder
constructor andSlideActionBuilderDelegate
s, otherwise you will end up with the same context as theSlidable
. This is whySlidable.of(context)
isnull
.
there are no examples with SlideActionBuilderDelegates and Slidable.builder.
also in version 2 we dont have this builder method.
how to achive a working result with slidablecontroller dismiss method without A dismissed Slidable widget is still part of the tree.
from flutter_slidable.
Related Issues (20)
- 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 2
- 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? HOT 1
- Slidable widget not closing properly HOT 1
- If more than two SlidableAction, the lable disappear HOT 3
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.