Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter how to enter full screen mode

I use setEnabledSystemUIOverlays to hide status bar and virtual button bar.

But there are blanks on the top and bottom of the screen (as seen in the photo):

Screen Photo

Does anyone know how to solve it?

Here is my code:

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: "Test",
      home: new MyHomePage(title: "Test"),
    );
  }
}

class MyHomePage extends StatelessWidget {
  final String title;

  MyHomePage({Key key, this.title}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text(title),
      ),
      body: new Container(
        color: Colors.red,
      ),
    );
  }
}
like image 937
蔡旻袁 Avatar asked May 21 '18 07:05

蔡旻袁


People also ask

How do I put Flutter on full screen?

To enable fullscreen mode with Sticky emersive, pass the fullscreen mode (FullScreenMode. EMERSIVE_STICKY)as an argument the the enterFullScreen method of the FullScreen class.

How do I hide the taskbar in Flutter?

To Hide StatusBar user can try the below things: SystemChrome. setEnabledSystemUIOverlays([]) should do what you want.

What is splash screen in Flutter?

A splash screen is a launch screen, start screen, or boot screen, which is a graphical control element containing the image, logo, and current version of the software. It is the first screen of the app that displays whenever the application is loading.


2 Answers

set resizeToAvoidBottomPadding: false to Scaffold.

   return Scaffold(
      resizeToAvoidBottomPadding: false,
   );
like image 180
djungdlt3583 Avatar answered Sep 18 '22 11:09

djungdlt3583


this it work perfect for me:

  @override
  Widget build(BuildContext context) {

    // To make this screen full screen.
    // It will hide status bar and notch.
    SystemChrome.setEnabledSystemUIOverlays([]);

    // full screen image for splash screen.
    return Container(
            child: new Image.asset('assets/splash.png', fit: BoxFit.fill));
      }
    }

import this

import 'package:flutter/services.dart';
like image 36
zoha_sh Avatar answered Sep 20 '22 11:09

zoha_sh