Comments (6)
aweasome, thank you, all is good now
from flutter_slidable.
Hi @MrMagloire ,
Can you post the minimal code sample to reproduce this issue, please?
from flutter_slidable.
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:gbame_app/routes/my_navigator.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:gbame_app/services/type.dart';
import 'package:gbame_app/tools/loading.dart';
class Index extends StatefulWidget {
static const String routeName = "/type_index";
@OverRide
_IndexState createState() => _IndexState();
}
class _IndexState extends State {
final CollectionReference typeCollection = Firestore.instance.collection('Types');
final GlobalKey _scaffoldkey = new GlobalKey();
TypeStorage typeStorage = new TypeStorage();
final SlidableController slidableController = new SlidableController();
@override
Widget build(BuildContext context) {
return new Scaffold(
key: _scaffoldkey,
appBar: new AppBar(
title: new Text("Types de Gbamé"),
),
body: new StreamBuilder<QuerySnapshot>(
stream: typeCollection.snapshots(),
builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
if (!snapshot.hasData)
return Loading();
final int typeCount = snapshot.data.documents.length;
return new ListView.builder(
itemCount: typeCount,
itemBuilder: (_, int index) {
final DocumentSnapshot document = snapshot.data.documents[index];
return listType(document);
},
);
},
),
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.add),
elevation: 4.0,
onPressed: _goToAdd,
),
);
}
void _goToAdd() {
MyNavigator.goToTypeAdd(context);
}
_slideAction(String action, DocumentSnapshot document) {
switch (action) {
case 'delete':
typeStorage.delete(document['id'])
.then((_){
_showSucces(action);
})
.catchError((_) {
_showError(action);
});
break;
default:
}
}
Future _showSucces(String action) async {
Timer(Duration(seconds: 2), () {
final _snackbar = new SnackBar(
content: new Text(
"$action effectué avec succes"
),
duration: new Duration(seconds: 5),
backgroundColor: Colors.teal.shade900,
);
_scaffoldkey.currentState.showSnackBar(_snackbar);
});
}
Future _showError(String action) async {
Timer(Duration(seconds: 2), () {
final _snackbar = new SnackBar(
content: new Text(
"$action Erreur !!"
),
duration: new Duration(seconds: 5),
backgroundColor: Colors.red,
);
_scaffoldkey.currentState.showSnackBar(_snackbar);
});
}
Widget listType(DocumentSnapshot document) => Slidable(
// controller: slidableController,
delegate: new SlidableStrechDelegate(),
actionExtentRatio: 0.25,
secondaryActions: <Widget>[
new IconSlideAction(
caption: 'Modifier',
color: Colors.lightBlueAccent,
icon: Icons.mode_edit,
onTap: () {
_slideAction('edit',document);
},
),
new IconSlideAction(
caption: 'Supprimer',
color: Colors.red,
icon: Icons.delete_forever,
onTap: () {
_slideAction('delete',document);
},
)
],
child: new ListTile(
title: Container(
decoration: BoxDecoration(
border: new Border(
left: new BorderSide(width: 4.0, color: Colors.lightGreen)
),
),
padding: EdgeInsets.all(5.0),
child: Row(
children: <Widget>[
Icon(
FontAwesomeIcons.busAlt,
color: Colors.teal.shade900,
),
SizedBox(
width: 10.0,
),
new Text(document['name'] ?? '<No type retrieved>')
],
),
),
),
);
}
from flutter_slidable.
Should be fixed in version 0.4.2
from flutter_slidable.
Waiting for that, thank you for all
from flutter_slidable.
It is published :-). Can you test it?
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 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
- If more than two SlidableAction, the lable disappear 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.