Skip to content

When using extendBody and the card & input box appear at the same time, the screen will flash white #157316

@maxfrees

Description

@maxfrees

Steps to reproduce

When clicking on the input box to pop up the keyboard and then retract the keyboard, bottonNavigationBar will appear a white screen block flashing

Expected results

fix

Actual results

When clicking on the input box to pop up the keyboard and then retract the keyboard, bottonNavigationBar will appear a white screen block flashing

Code sample

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

void main() {
  runApp(const MyApp());
  SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
    statusBarColor: Colors.transparent,
    systemNavigationBarColor: Colors.transparent,
  ));
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: 'Flutter Demo',
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return AnnotatedRegion<SystemUiOverlayStyle>(
      value: SystemUiOverlayStyle(
        systemNavigationBarColor: Colors.black.withOpacity(0),
      ),
      child: Scaffold(
        extendBody: true,
        appBar: AppBar(
          backgroundColor: Theme.of(context).colorScheme.inversePrimary,
          title: Text(widget.title),
        ),
        bottomNavigationBar: SafeArea(
          child: Container(
            decoration: BoxDecoration(
              color: Theme.of(context).colorScheme.surface,
              borderRadius: BorderRadius.circular(12),
              boxShadow: [
                BoxShadow(color: Theme.of(context).colorScheme.outlineVariant.withOpacity(0.5), blurRadius: 12),
              ],
            ),
            margin: const EdgeInsets.only(left: 38, right: 38, bottom: 7),
            padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 4),
            child: Row(
              children: [
                FilledButton(onPressed: () {}, child: const Text('add')),
                FilledButton(onPressed: () {}, child: const Text('add')),
              ],
            ),
          ),
        ),
        body: CustomScrollView(
          slivers: [
            const SliverToBoxAdapter(
              child: Column(
                children: [
                  ListTile(title: Text('Item 1')),
                  ListTile(title: Text('Item 2')),
                  ListTile(title: Text('Item 3')),
                  ListTile(title: Text('Item 4')),
                  ListTile(title: Text('Item 5')),
                  ListTile(title: Text('Item 6')),
                  ListTile(title: Text('Item 6')),
                  ListTile(title: Text('Item 6')),
                  ListTile(title: Text('Item 7')),
                  ListTile(title: Text('Item 8')),
                  ListTile(title: Text('Item 8')),
                ],
              ),
            ),
            const SliverToBoxAdapter(
              child: TextField(),
            ),
            SliverList.builder(
                itemBuilder: (v, a) {
                  return Card(
                    child: ListTile(title: Text('Item $a')),
                  );
                },
                itemCount: 10),
          ],
        ),
      ),
    );
  }
}

Screenshots or Video

04ce16b97a0f1c0d3ffdbe508533bec7.mp4

Logs

Logs

android

Flutter Doctor output

Doctor output
[Paste your output here]

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listf: material designflutter/packages/flutter/material repository.found in release: 3.24Found to occur in 3.24found in release: 3.27Found to occur in 3.27frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages teamwaiting for PR to land (fixed)A fix is in flight

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions