1

I am applying stretch effect to Listview , I use androidOverscrollIndicator

ScrollBehavior(
   androidOverscrollIndicator: AndroidOverscrollIndicator.stretch
),

I work perfectly but i see a warning at androidOverscrollIndicator

'androidOverscrollIndicator' is deprecated and shouldn't be used. Use ThemeData.useMaterial3 or override ScrollBehavior.buildOverscrollIndicator. This feature was deprecated after v2.13.0-0.0.pre.. (Documentation) Try replacing the use of the deprecated member with the replacement.

How can i fix this?

This is my code:

ScrollConfiguration(
   behavior: const ScrollBehavior(
      androidOverscrollIndicator: AndroidOverscrollIndicator.stretch
   ),
   child: GlowingOverscrollIndicator(
       axisDirection: AxisDirection.down,
       color: Colors.white,
       child: ListView(
          physics: const ClampingScrollPhysics(),
          children: [ 
              //some widget
          ],
         ),
       ),
    ),

enter image description here

Xuuan Thuc
  • 2,340
  • 1
  • 5
  • 22

2 Answers2

1

I think you are looking from this

child: StretchingOverscrollIndicator(
  axisDirection: AxisDirection.down,
  child: ListView.builder(
    itemCount: 12,
    itemBuilder: (context, index) {
      return ListTile(
        title: Text("item $index"),
      );
    },
  ),
),
Md. Yeasin Sheikh
  • 54,221
  • 7
  • 29
  • 56
0

For future readers: Simplest solution is to use Material3

      MaterialApp(
        home: HomePage(),
        theme: ThemeData(
          useMaterial3: true,
        ),
      ),

This is the default behavior.

Ozan Taskiran
  • 2,922
  • 1
  • 13
  • 23