In my TODO app, I created draggable and droppable ListaItem
elements using a ReorderableListView
. The problem is that my ListaItem
has rounded borders and a rectangular (and ugly) shadow appears when I try to drag them.
My aim is to remove this annoying shadow.
My ListaItem
should appear so:
Here the ListaItem
code :
@override
Widget build(BuildContext context) {
return
Container(
margin: EdgeInsets.only(left:10.0, right: 10.0, top: 7,bottom: 7),
decoration: BoxDecoration(
boxShadow: [BoxShadow(
color: Color.fromRGBO(50, 50, 50, 0.21),
offset: Offset(2, 2),
blurRadius: 10.0
)],
borderRadius: BorderRadius.all(Radius.circular(100.0))
),
child: ElevatedButton(
onPressed: () {
setState(() {
widget.checkValue = !widget.checkValue;
});
},
style: ElevatedButton.styleFrom(
primary: Colors.white,
onPrimary: Color.fromARGB(0, 59, 59, 59),
shape: StadiumBorder(),
),
child: AnimatedContainer(
duration: Duration(milliseconds: 100),
height: 55,
padding: EdgeInsets.only(left: 10, right: 2),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
widget.product,
style: TextStyle(
color: widget.checkValue ? Color.fromARGB(120, 37, 37, 37) : Color.fromARGB(200, 37, 37, 37),
fontSize: 20,
fontWeight: FontWeight.w300,
decoration: widget.checkValue ? TextDecoration.lineThrough : TextDecoration.none
),
),
newCheck(value: widget.checkValue)//it's a styled checkbox
],
),
)
),
);
}
}
But, as I said before, dragging an Item causes an ugly shadow, like this:
Here the ReorderableListView
code :
@override
Widget build(BuildContext context) {
var Items = new List<Item>.generate(10, (i) => Item(i, i.toString()));
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Container(
color: Colors.transparent,
child:
Expanded(
child: ReorderableListView(
padding: EdgeInsets.only(top:20),
onReorder: ((oldIndex, newIndex) {
}),
children: [
for(int i = 0; i < Items.length; i++)
ListaItem(checkValue: Items[i].state, product: Items[i].title,key: Key(i.toString()),)
],
)
)
),
),
// This trailing comma makes auto-formatting nicer for build methods.
);
}
}
Thanks in advance!!