Flutter Tutorials

Flutter app development tutorials


flutter – How to show hide status bar

main.dart


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

void main(){
  runApp(
      MaterialApp(
        home: Scaffold(
          appBar: AppBar(
            title: const Text("Flutter - Show Hide Status Bar"),
          ),
          body: Row(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              ElevatedButton(
                  onPressed: ()=> {
                    SystemChrome.setEnabledSystemUIMode(
                        SystemUiMode.immersive
                    )
                  },
                  child: const Text("Hide")
              ),
              const SizedBox(width: 25),
              ElevatedButton(
                  onPressed: ()=> {
                    SystemChrome.setEnabledSystemUIMode(
                        SystemUiMode.manual,
                        overlays: SystemUiOverlay.values
                    )
                  },
                  child: const Text("Show")
              ),
            ],
          ),
        ),
      )
  );
}

More flutter tutorials



About Me

Flutter Developer

Design a site like this with WordPress.com
Get started