Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AnimatedList(
- key: animatedListKey,
- shrinkWrap: true,
- physics: NeverScrollableScrollPhysics(),
- initialItemCount: menu.details.length,
- itemBuilder: (context, index, animation){
- return SizeTransition(
- sizeFactor: animation.drive(Tween(begin: 0.3, end: 1)),
- axis: Axis.vertical,
- child: FadeTransition(
- opacity: animation.drive(Tween(begin: 0, end: 1)),
- child: Padding(
- padding: const EdgeInsets.symmetric(vertical: 10.0),
- child: Row(
- children: <Widget>[
- Flexible(
- fit: FlexFit.loose,
- child: TextFormField(
- initialValue: menu.details[index],
- onChanged: (value){
- menu.details[index] = value;
- },
- decoration: InputDecoration(
- fillColor: Colors.grey[300],
- filled: true,
- contentPadding: EdgeInsets.symmetric(horizontal: 30, vertical: 20),
- border: OutlineInputBorder(borderRadius: BorderRadius.circular(100)),
- disabledBorder: OutlineInputBorder(borderSide: BorderSide(color: Colors.amber)),
- hintText: "Pietanza",
- ),
- ),
- ),
- IconButton(
- icon: Icon(Icons.clear),
- onPressed: () {
- print("\n\ndel" + index.toString() + "\n\n");
- AnimatedList.of(context).removeItem(index, (context, animation){
- return SizeTransition(
- sizeFactor: animation.drive(Tween(begin: 0, end: 1)),
- axis: Axis.vertical,
- child: FadeTransition(
- opacity: animation.drive(Tween(begin: 0, end: 1)),
- child: Padding(
- padding: const EdgeInsets.symmetric(vertical: 10.0),
- child: Row(
- children: <Widget>[
- Flexible(
- fit: FlexFit.loose,
- child: TextFormField(
- decoration: InputDecoration(
- fillColor: Colors.grey[300],
- filled: true,
- contentPadding: EdgeInsets.symmetric(horizontal: 30, vertical: 20),
- border: OutlineInputBorder(borderRadius: BorderRadius.circular(100)),
- disabledBorder: OutlineInputBorder(borderSide: BorderSide(color: Colors.amber)),
- hintText: "Pietanza",
- ),
- ),
- ),
- IconButton(
- icon: Icon(Icons.clear),
- onPressed: (){
- },
- )
- ],
- ),
- ),
- ),
- );
- });
- menu.details.removeAt(index);
- },
- )
- ],
- ),
- ),
- ),
- );
- },
- ),
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement