Comments (6)
Should be fixed in version 0.4.3
from flutter_slidable.
Thank you!
from flutter_slidable.
Hi @keremkayabay,
Have you a code sample to reproduce this?
from flutter_slidable.
Hello @letsar
I've found out, when there are two actions on the left and one action on the right (secondaryActions), it would throw this exception. If the number of actions on the left and right are equal, it works fine.
Btw thanks for the cool package!
Here is a sample code:
import 'package:flutter/material.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
String _name = "Flutter";
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: "Flutter Slidable Animation Test",
theme: new ThemeData(
primarySwatch: Colors.blue,
//primaryColor: Colors.grey[200],
accentColor: Colors.blueAccent[400],
),
home: new ChatScreen(),
);
}
}
class ChatScreen extends StatefulWidget {
@override
State createState() => new ChatScreenState();
}
class ChatScreenState extends State<ChatScreen> {
final TextEditingController _textController = new TextEditingController();
bool _isComposing = false;
List<ChatMessage> _messages = <ChatMessage>[];
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text("Chat"),
elevation: 0.0,
),
body: new Column(
children: <Widget>[
new Flexible(
child: new ListView.builder(
padding: new EdgeInsets.all(0.0),
reverse: true,
itemBuilder: (_, int index) => _messages[index],
itemCount: _messages.length,
),
),
new Divider(height: 0.0),
new Container(
decoration: new BoxDecoration(
color: Theme.of(context).cardColor),
child: _buildTextComposer(),
),
],
),
);
}
Widget _buildTextComposer() {
return new IconTheme(
data: new IconThemeData(color: Theme.of(context).accentColor),
child: new Container(
margin: const EdgeInsets.symmetric(horizontal: 8.0),
child: new Row(
children: <Widget>[
new Flexible(
child: new TextField(
controller: _textController,
onChanged: (String text) {
setState(() {
_isComposing = text.length > 0;
});
},
onSubmitted: _handleSubmitted,
decoration: new InputDecoration.collapsed(
hintText: "What's in your mind"),
),
),
new Container(
margin: new EdgeInsets.symmetric(horizontal: 4.0),
child: new IconButton(
icon: new Icon(Icons.send),
onPressed: _isComposing
? () => _handleSubmitted(_textController.text)
: null,
),
),
],
),
),
);
}
void _handleSubmitted(String text) {
_textController.clear();
setState(() {
_isComposing = false;
});
ChatMessage message = new ChatMessage(
text: text,
parent: this,
);
setState(() {
_messages.insert(0, message);
});
}
void _removeMessage(ChatMessage message) {
setState(() {
_messages.remove(message);
});
}
}
class ChatMessage extends StatelessWidget {
ChatMessage({this.text, this.parent});
final String text;
final ChatScreenState parent;
@override
Widget build(BuildContext context) {
return new Container(
margin: const EdgeInsets.symmetric(vertical: 2.0),
child: new Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new Expanded(
child: Slidable(
//controller: slidableController,
delegate: new SlidableDrawerDelegate(),
actionExtentRatio: 0.25,
child: new Container(
color: Colors.white,
child: new ListTile(
leading: new CircleAvatar(
backgroundColor: Colors.blueAccent,
child: new Text(_name[0]),
foregroundColor: Colors.white,
),
title: new Text(_name),
subtitle: new Text(text),
),
),
actions: <Widget>[
new IconSlideAction(
caption: 'Action 1',
color: Colors.black38,
icon: Icons.assignment,
),
new IconSlideAction(
caption: 'Action 2',
color: Colors.indigo,
icon: Icons.forward,
),
],
secondaryActions: <Widget>[
new IconSlideAction(
caption: 'Delete',
color: Colors.red,
icon: Icons.delete,
onTap: () => parent._removeMessage(this),
),
],
),
),
],
),
);
}
}
from flutter_slidable.
And it doesn't happen at all with SlidableScrollDelegate
from flutter_slidable.
Thanks for the feedback @keremkayabay 😃.
I found why this issue was happening. Now I have to fix this :-).
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. HOT 1
- 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.