flutterflutter-layoutandroid-scrollview

"androidOverscrollIndicator" is deprecated and shouldn't be used


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


Solution

  • 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"),
          );
        },
      ),
    ),