パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.2.0

snap_layouts

プラグインは、ネイティブな Windows 11 スナップレイアウト機能を実装できるシンプルなウィンドウレイアウトボタンを提供します。

Windows
30日間ダウンロード
5.2万
いいね数
1
Pub ポイント
160

パッケージをインストール

flutter pub add snap_layouts

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

snap_layouts パッケージは、Windows 上の Flutter アプリケーションがネイティブな Windows 11 のスナップレイアウト機能を実装できるようにし、ユーザーに馴染みやすく効率的なウィンドウ管理体験を提供します。このパッケージは、スナップレイアウトをトリガーするシンプルなボタンインターフェースを提供しており、ウィンドウを事前に定義された構成に迅速に配置できます。これにより、複雑なコードを必要とせずにウィンドウの位置決めを簡素化し、生産性を向上させます。このパッケージは Windows デスクトップアプリ専用に設計されており、Flutter のデスクトッププラットフォームとシームレスに統合されています。

用途

  • Windows 11スタイルのウィンドウスナッピングの実装
  • 迅速なウィンドウ配置によるユーザー生産性の向上
  • Windows 上のデスクトップアプリケーションの使いやすさの向上
  • Flutter アプリでの応答性のあるウィンドウレイアウトの作成
  • ネイティブに似たウィンドウ管理機能を有効にする

主な機能

  • シンプルなレイアウトボタンの統合
  • Windows 11 スナップレイアウトをサポート
  • ネイティブ Windows ウィンドウ管理
  • 必要な最小限のセットアップ
  • デスクトップ中心のデザイン

適している対象

  • Windows デスクトップ用 Flutter 開発者
  • 高度なウィンドウ管理が必要なアプリ
  • Windows 11 ユーザーをターゲットとする開発者
  • 生産性を重視したデスクトップアプリケーション
  • ネイティブなWindows UXを求めるユーザー

注意事項

  • Windows プラットフォームに限定
  • Windows 11 以降が必要です
  • Linux または macOS はサポートされていません
  • ネイティブな Windows API に依存しています
  • 完全な機能を実現するには追加の構成が必要になる場合があります

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

snap_layouts

pub version

This plugin provides a simple window layout button, SnapLayoutsButton, which can implement the native Windows 11 Snap Layouts feature.


English | 简体中文


Supported Platforms

Linux macOS Windows iOS Android
❌ ❌ ✔️ ❌ ❌

Features

  • Native Windows 11-style Snap Layouts button
  • Default Windows 11-style window title bar
  • Integration with the window_manager plugin
  • Full customization support

Quick Start

Installation
flutter pub add snap_layouts
flutter pub add window_manager

Or add the following to your pubspec.yaml:

dependencies:
  snap_layouts: ^0.2.0
  window_manager: ^0.5.0
Usage

You can directly check the example.

SnapLayoutsButton

Place the button on your page.

import 'package:flutter/material.dart';
import 'package:snap_layouts/snap_layouts.dart';
import 'package:window_manager/window_manager.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await windowManager.ensureInitialized();
  WindowOptions windowOptions = WindowOptions(
    // Ensure this option
    titleBarStyle: TitleBarStyle.hidden,
  );
  windowManager.waitUntilReadyToShow(windowOptions, () async {
    await windowManager.show();
    await windowManager.focus();
  });

  runApp(const MyApp());
}

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

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

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: SizedBox(width: 46, height: 32, child: SnapLayoutsButton()),
        ),
      ),
    );
  }
}
SnapLayoutsCaption

Place the title bar on your page.

import 'package:flutter/material.dart';
import 'package:snap_layouts/snap_layouts.dart';
import 'package:window_manager/window_manager.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await windowManager.ensureInitialized();
  WindowOptions windowOptions = WindowOptions(
    // Ensure this option
    titleBarStyle: TitleBarStyle.hidden,
  );
  windowManager.waitUntilReadyToShow(windowOptions, () async {
    await windowManager.show();
    await windowManager.focus();
  });

  runApp(const MyApp());
}

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

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

class _MyAppState extends State<MyApp> with WindowListener {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        appBar: PreferredSize(
          preferredSize: const Size.fromHeight(kWindowCaptionHeight),
          child: SnapLayoutsCaption(
            title: Text('snap_layouts_example'),
            actions: [
              WindowCaptionAction(
                icon: Icon(Icons.favorite_outline),
                onPressed: () {},
              ),
            ],
          ),
        ),
        body: Center(child: Text('Snap Layouts Example')),
      ),
    );
  }

  @override
  void onWindowMaximize() {
    setState(() {});
  }

  @override
  void onWindowUnmaximize() {
    setState(() {});
  }
}

References

  • https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/ui/apply-snap-layout-menu
  • https://github.com/luoluoqixi/flutter_windows11_snap_layouts_examples.git
  • https://github.com/grassator/win32-window-custom-titlebar
  • https://github.com/leanflutter/window_manager

License

MIT

カテゴリー

依存関係

依存関係一覧 2 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。

ランキング