I have a problem with the shadow of the children of a Wrap.
I have managed to recreate it quickly.
Apparently, the more you scroll, the shadow at the bottom disappears and begins to come out at the top of each item, making a somewhat strange effect.
How could the shadow of the child items remain in the correct position?
At the bottom of the list, I have added several more buttons (but always outside the Wrap), and the shadow is cast correctly.
Edit: I add the sample code to recreate the error
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Hello World',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatelessWidget {
final String title;
const MyHomePage({@required this.title});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(title),
),
body: Container(
height: double.infinity,
width: double.infinity,
alignment: Alignment.center,
child: ListView(
children:[
new LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
List<Widget> _list = List();
int _number_items = 30;
for(int a = 0; a < _number_items; a++){
_list.add(
Card(
elevation: 4,
child: Container(
margin: EdgeInsets.all(10),
width: 200,
height: 200,
),
)
);
}
for(int a = 0; a < _number_items; a++){
_list.add(
Container(
width: 400,
child: RaisedButton(
onPressed: () {},
child: Text(
"Button in the Wrap ",
style: TextStyle(color: colors.white),
),
color: Colors.red,
),
)
);
}
return Wrap(
children: _list,
);
}
),
RaisedButton(
onPressed: () {},
child: Text(
"Button outside the Wrap",
style: TextStyle(color: Colors.white),
),
color: Colors.red,
),
RaisedButton(
onPressed: () {},
child: Text(
"Button outside the Wrap",
style: TextStyle(color: Colors.white),
),
color: Colors.red,
),
RaisedButton(
onPressed: () {},
child: Text(
"Button outside the Wrap",
style: TextStyle(color: Colors.white),
),
color: Colors.red,
)
],
)
),
);
}
}
Example:

Add this to the ListView:
addRepaintBoundaries: false
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With