搜尋套件、儲存庫與 APP 分類

套件詳情v3.2.2

split_view

此小部件為 Flutter 提供水平或垂直拆分視圖。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
2.4萬
喜歡數
73
Pub 分數
160

安裝套件

flutter pub add split_view

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

split_view 套件提供了一種靈活的方式來建立 Flutter 應用程式中的水平或垂直分割檢視。它允許使用者將螢幕分成兩個可調整大小的區段,非常適合並排顯示內容,例如檔案瀏覽器、編輯器佈局或儀表板面板。此組件支援拖曳調整大小功能,並可在 Android、iOS、Web、macOS、Windows 和 Linux 等主要平台運作。它輕量且能與現有的 Flutter UI 完美整合。

適用情境

  • 雙面板配置
  • 檔案瀏覽器介面
  • 程式碼編輯器側邊欄
  • 儀表板面板排列
  • 可調整大小的 UI 組件

主要特色

  • 水平和垂直分割方向
  • 拖曳調整大小的把手
  • 跨平台相容性
  • 與 Flutter widget 的簡單整合
  • 響應式版面支援

適合對象

  • 開發複雜 UI 的開發者
  • 需要雙面板導航的應用
  • 需要分割畫面檢視的編輯器或工具
  • 跨平台桌面與網頁應用

使用建議

  • 可能需要額外的邏輯來管理狀態
  • 不適用於簡單的單面板螢幕
  • 性能取決於子組件的複雜性
  • 超出基本調整大小之外的自訂功能有限

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Splitter view plugin

A splitter view for flutter.

Usage

To use this plugin, add split_view as a dependency in your pubspec.yaml file.

Example

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

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title!),
      ),
      body: SplitView(
        children: [
          SplitView(
            viewMode: SplitViewMode.Horizontal,
            indicator: SplitIndicator(viewMode: SplitViewMode.Horizontal),
            activeIndicator: SplitIndicator(
              viewMode: SplitViewMode.Horizontal,
              isActive: true,
            ),
            children: [
              Container(
                child: Center(child: Text("View1")),
                color: Colors.red,
              ),
              Container(
                child: Center(child: Text("View2")),
                color: Colors.blue,
              ),
              Container(
                child: Center(child: Text("View3")),
                color: Colors.green,
              ),
            ],
            onWeightChanged: (w) => print("Horizon: $w"),
          ),
          Container(
            child: Center(child: Text("View4")),
            color: Colors.purple,
          ),
          Container(
            child: Center(child: Text("View5")),
            color: Colors.yellow,
          ),
        ],
        viewMode: SplitViewMode.Vertical,
        indicator: SplitIndicator(viewMode: SplitViewMode.Vertical),
        activeIndicator: SplitIndicator(
          viewMode: SplitViewMode.Vertical,
          isActive: true,
        ),
        controller: SplitViewController(limits: [null, WeightLimit(max: 0.5)]),
        onWeightChanged: (w) => print("Vertical $w"),
      ),
    );
  }
}

Support

If you find this package useful, please consider supporting the development:

Buy Me A Coffee

ToDo

  • Add tests.
  • Aim to enhance documents.
  • and more...

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案