Flutter Shadow flickering in CustomScrollView above Keyboard

Viewed 238

I am using a CustomScrollView and some of my children have shadows. The problem is that if the Keyboard appears and I scroll, a slight flickering of the shadow becomes visible. Here is a ScreenVideo for a better understanding.

Here is a simple reproducible example:

return Scaffold(
        resizeToAvoidBottomInset: true,
        body: Stack(
          children: [
            Padding(
              padding: EdgeInsets.zero,
              child: CustomScrollView(
                cacheExtent: double.maxFinite,
                slivers: [
                  SliverToBoxAdapter(
                    child: SizedBox(
                      height: 300,
                    ),
                  ),
                  SliverToBoxAdapter(
                    child: Container(
                      height: 100,
                      width: 200,
                      decoration: BoxDecoration(
                        color: Colors.red,
                        borderRadius: BorderRadius.circular(
                          10.scaled,
                        ),
                        boxShadow: [
                          BoxShadow(
                           color: Colors.black,
                           blurRadius: 15.0,
                           ),
                        ],
                      ),
                    ),
                  ),
                  SliverToBoxAdapter(
                    child: SizedBox(
                      height: 300,
                    ),
                  ),
                  SliverToBoxAdapter(
                    child: Container(
                      height: 100,
                      color: Colors.red,
                      child: TextField(
                        textCapitalization: TextCapitalization.sentences,
                        maxLines: null,
                        style: h3.copyWith(fontSize: 18.scaled),
                        decoration: null,
                        maxLength: 500,
                      ),
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      );

I have no idea why this happens and find absolutely nothing on this issue. Any help is appreciated. Let me know if you need any more info!

0 Answers
Related