搜索分类、插件与代码仓

插件详情v1.2.1

fullscreen_window

一个 Flutter 插件可使您的窗口全屏显示。

AndroidiOSWebWindowsLinux
近 30 天下载
2.5万
喜欢数
30
Pub 分数
140

安装插件

flutter pub add fullscreen_window

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

fullscreen_window 包是一个 Flutter 插件,可让开发者在多个平台上(包括 Windows、Linux 和 macOS)控制窗口的全屏模式。它提供了简单的 API 来切换全屏状态、管理窗口大小以及处理显示模式。虽然该插件主要针对桌面环境设计,但也支持 Android、iOS 和 Web,不过各平台的功能可能有所不同。该插件对于需要沉浸式体验的应用程序非常有用,例如媒体播放器、游戏或 kiosk 风格的应用。它与 Flutter 现有的 UI 框架无缝集成,并由社区维护。

适合场景

  • 沉浸式媒体播放
  • Kiosk 应用程序
  • 游戏开发
  • 全屏演示
  • 桌面应用优化

主要特点

  • 切换全屏模式
  • 跨平台支持
  • 窗口大小管理
  • 平台特定行为处理
  • 简单的 API 集成

适合对象

  • 桌面应用程序开发者
  • 媒体和游戏应用
  • 交互式自助服务终端
  • 演示文稿软件
  • 需要全屏控制的应用

使用建议

  • 移动和网页端功能有限
  • 平台特定的特殊处理
  • 需要桌面环境
  • 可能与系统 UI 冲突
  • 不适用于所有应用类型

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

fullscreen_window

This plugin makes your window fullscreen.

Platform Support

Windows Linux Web Android iOS
✔️ ✔️ ✔️ ✔️ ✔️
  • Web is tested on Chrome / Edge (in Windows)
  • Not tested on iOS, but I think it should work because just use the pure Flutter API and works on Android.

Quick Start

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  fullscreen_window: ^1.2.0

Or

dependencies:
  fullscreen_window:
    git:
      url: https://github.com/jakky1/fullscreen_window.git
      ref: master
Functions
import 'package:fullscreen_window/fullscreen_window.dart';

FullScreenWindow.setFullScreen(true);    // enter fullscreen
FullScreenWindow.setFullScreen(false);   // exit fullscreen
Size screen_logical_size = await FullScreenWindow.getScreenSize(context);
Size screen_physical_size = await FullScreenWindow.getScreenSize(null);
Example
import 'package:flutter/material.dart';
import 'package:fullscreen_window/fullscreen_window.dart';

void main() {
  runApp(const MyApp());
}

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  String screenSizeText = "";

  void setFullScreen(bool isFullScreen) {
    FullScreenWindow.setFullScreen(isFullScreen);
  }

  void showScreenSize(BuildContext context) async {
    Size logicalSize = await FullScreenWindow.getScreenSize(context);
    Size physicalSize = await FullScreenWindow.getScreenSize(null);
    setState(() {
      screenSizeText = "Screen size (logical pixel): ${logicalSize.width} x ${logicalSize.height}\n";
      screenSizeText += "Screen size (physical pixel): ${physicalSize.width} x ${physicalSize.height}\n";
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('FullScreen example app'),
        ),
        body: Center(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              ElevatedButton(
                onPressed: () => setFullScreen(true), 
                child: const Text("Enter FullScreen"),
              ),

              const SizedBox(height: 10),
              ElevatedButton(
                onPressed: () => setFullScreen(false), 
                child: const Text("Exit FullScreen"),
              ),

              const SizedBox(height: 10),
              Builder(builder: (context) => ElevatedButton(
                onPressed: () => showScreenSize(context), 
                child: const Text("Show screen size"),
              )),

              const SizedBox(height: 10),
              if (screenSizeText.isNotEmpty) Text(screenSizeText),
            ]),
          ),
      ),
    );
  }
}

所属分类

依赖

依赖清单 2 项

  • plugin_platform_interface^2.0.2
  • web^1.0.0

源码仓库

使用此插件的项目