• 13
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Make flutter application fullscreen

How can I make a flutter application fullscreen. I already found out how to hide the status bar Hide Android Status Bar On Flutter App. but I can't seem to find how to hide the android navigation bar.

It's exactly like for Android status bar.

Doing SystemChrome.setEnabledSystemUIOverlays([]) hides both the status bar and the navigation bar.

p/s : use this SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values); to disable full screen mode.

  • 67
Reply Report
      • 2
    • This does not work! When a text field got focus, the virtual keyboard appears, together with the mobile phone status bar, after the user enter something into the text field and lost focus, the status bar is still there, which means that the app is now not in full screen. It is said in the documentation that after the text field lost focus, we can only call the SystemChrome.setEnabledSystemUIOverlays again AFTER 1 SECOND, but I've tens of Text Fields in my app, how should I make my app always in Full Screen Mode?
    • I am having a problem. I want this behaviour on only one screen. In initState SystemChrome.setEnabledSystemUIOverlays([]) does the job to hide status bar and navigation bar, but in onDispose SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values) doesn't bring them back.
      • 2
    • Just for clarification: the SystemChrome.setEnabledSystemUIOverlays([]); has to be added inside the build method of the class, but before the 'return'.
// to hide only bottom bar:
SystemChrome.setEnabledSystemUIOverlays ([SystemUiOverlay.top]);

// to hide only status bar: 
SystemChrome.setEnabledSystemUIOverlays ([SystemUiOverlay.bottom]);

// to hide both:
SystemChrome.setEnabledSystemUIOverlays ([]);
  • 26
Reply Report
      • 2
    • @JideGuru - Yes, that is correct...there is a slight error in the code. I suggested the correct code in the edit I submitted. Hopefully the correction will be approved by the peer reviewers.
      • 2
    • Unfortunately, if you use: SystemChrome.setEnabledSystemUIOverlays ([SystemUiOverlay.bottom]); and swipe down the top bar - it shows up and stays permanently...

Below code is working perfect for fullscreen

SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
import 'package:flutter/services.dart'; 
////

@override
Widget build(BuildContext context) {
///Set color status bar
 SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
   return Scaffold(
   backgroundColor: Colors.white,
   body: Center(
    child: Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        Image.asset(
          'images/ic_splash_logo.png',
          width: 97.0,
          height: 115.0,
          fit: BoxFit.contain,
        ),
        SizedBox(
          height: 10.0,
        ),
        Text(
          'iComplain',
          style: TextStyle(fontSize: 24,
              color: Color(0xFF174D73),
            fontFamily: 'Helvetica'
          ),
        ),
      ],
     ),
    ),
  );
}
  • 6
Reply Report

Finally i found a way to set in one class for fullscreen. and disable on other classes.

To set full screen put this code in initState()

SystemChrome.setEnabledSystemUIOverlays([]);

and to set back to normal. In dispose()

SystemChrome.setEnabledSystemUIOverlays([]);

in the same class.

@override
  void dispose() {
        SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
    super.dispose();
  }

  @override
  initState() {
      SystemChrome.setEnabledSystemUIOverlays([]);
    super.initState();
  }

you can't set the

SystemChrome.restoreSystemUIOverlays();

in dispose(). because its already saying

**Restores the system overlays to the last settings provided via [setEnabledSystemUIOverlays].**
May be used when the platform force enables/disables UI elements.

For example, when the Android keyboard disables hidden status and navigation bars,
this can be called to re-disable the bars when the keyboard is closed.

On Android, the system UI cannot be changed until 1 second after the previous
change. This is to prevent malware from permanently hiding navigation buttons.`
  • 0
Reply Report

this is my experience if i add SystemChrome.setEnabledSystemUIOverlays([]); in init or dispose , status bar and navigation bar will back when you use keyboard , but if you use it like this it work perfect:

  @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));
      }
    }

inside of your widget

  • 0
Reply Report

The AppBar is your Navigation bar so just remove it from your Code as illustrate below

//New This Code it should work , the AppBar is navigation bar

import 'package:flutter/material.dart';

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {      
   @override
   Widget build(BuildContext context) {
      return new MaterialApp(
         home: new Scaffold(
           body: new Center(
              child: new Text('Hello World'),
           ),
         ),
      );
   }
}
  • -13
Reply Report