flutter_fullscreen 1.1.0 copy "flutter_fullscreen: ^1.1.0" to clipboard
flutter_fullscreen: ^1.1.0 copied to clipboard

Allow setting and listening to fullscreen state on all platforms.

A simple package which allows setting fullscreen mode on all platforms in flutter.

Features #

Allows setting full-screen mode on the following platforms:

  • Web
  • Linux
  • macOS
  • Windows
  • Android
  • IOS

Getting started #

Install #

Add to your pubspec.yaml file:

dependencies:
  flutter_fullscreen: ^1.1.0

Usage #

Initialization #

import 'package:flutter_fullscreen/flutter_fullscreen.dart';

void main() async {
    // ensure these two lines are added to main
    WidgetsFlutterBinding.ensureInitialized();
    await FullScreen.ensureInitialized();

    runApp(const MyApp());
}

Setting fullscreen #

// enable fullscreen
FullScreen.setFullScreen(true);

// exit fullscreen
FullScreen.setFullScreen(false);

Listening to fullscreen status #

import 'package:flutter/material.dart';
import 'package:flutter/src/services/system_chrome.dart';
import 'package:flutter_fullscreen/flutter_fullscreen.dart';

class Page extends StatefulWidget {
  const Page({super.key});

  @override
  State<Page> createState() => _PageState();
}

class _PageState extends State<Page> with FullScreenListener {
  bool isFullScreen = FullScreen.isFullScreen;

  @override
  void initState() {
    FullScreen.addListener(this);
    super.initState();
  }

  @override
  void dispose() {
    FullScreen.removeListener(this);
    super.dispose();
  }

  @override
  void onFullScreenChanged(bool enabled, SystemUiMode? systemUiMode) {
    setState(() {
      isFullScreen = enabled;
    });
  }
}

Please see the example for more detailed usage.

7
likes
150
pub points
84%
popularity

Publisher

verified publisherj7126.dev

Allow setting and listening to fullscreen state on all platforms.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, web, window_manager

More

Packages that depend on flutter_fullscreen