Flutter: ListWheelScrollView magnifier not working
488
- You can use
Container
instead ofCard
and set horizontalpadding
for it:
ListWheelScrollView(
itemExtent: 60,
magnification: 1.5,
useMagnifier: true,
squeeze: 0.7,
children: List.generate(
100,
(index) => Container(
key: ValueKey(index),
padding: EdgeInsets.symmetric(horizontal: 100),
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(8),
),
child: ListTile(
title: Text(index.toString()),
),
)).toList(),
),
Result:
- Instead of using
ListTile
and horizontalpadding
, you can put the text inside aCenter
widget that is placed directly inside theContainer
:
ListWheelScrollView(
itemExtent: 60,
magnification: 1.5,
useMagnifier: true,
squeeze: 0.7,
children: List.generate(
100,
(index) => Container(
key: ValueKey(index),
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(8),
),
child: Center(
child: Text(index.toString()),
),
)).toList(),
),
Result:
Author by
JakesMD
Updated on December 23, 2022Comments
-
JakesMD over 1 year
The magnifier of the ListWheelScrollView is empty (just a white container)
ListWheelScrollView( itemExtent: 60, magnification: 2, useMagnifier: true, children: List.generate( 100, (index) => Card( key: ValueKey(index), color: Colors.blue, child: ListTile( title: Text(index.toString()), ))).toList(), ),
What am I doing wrong? (No errors are shown when running
flutter run -v
andflutter doctor -v
finds no issues)