Flutter app leaves blank space at the top of the screen when removing system overlays

Viewed 540

When removing system overlays with SystemChrome.setEnabledSystemUIOverlays([]) the app does not expand to fill the screen.

Complete main.dart file:

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

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  SystemChrome.setEnabledSystemUIOverlays([]);
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Container(
        color: Colors.red,
      ),
    );
  }
}

Without SystemChrome.setEnabledSystemUIOverlays([]): enter image description here

Flutter version: 1.22.2

1 Answers

I'm unable to reproduce with Flutter 1.22(stable) but in https://github.com/flutter/flutter/issues/14432 people seem to have had good results with setting Scaffold.resizeToAvoidBottomPadding to true.

You can also try to update Flutter and/or changing channels. Perhaps even trying on a physical device.

Related