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

套件詳情v0.0.5

spider_web_control

一個用於建立可自訂節點與連接的互動式蛛網狀控制元件的 Flutter 套件。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
14
喜歡數
2
Pub 分數
160

安裝套件

flutter pub add spider_web_control

套件介紹

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

一個 Flutter 套件,讓開發者能夠建立互動式、蜘蛛網風格的控制元件。它允許自訂節點以及它們之間的動態連接,非常適合用於視覺化關係或建立具有徑向佈局的遊戲使用者介面。此套件支援多個平台,包括行動裝置、網頁與桌面,使其適用於跨平台應用。透過直覺的 API,簡化複雜、動畫網路類介面的實作。

適用情境

  • 帶有徑向佈局的互動式 UI
  • 基於網路機制的遊戲開發
  • 視覺數據關係顯示
  • 可自定義的節點和連接介面
  • 圖論的教育工具
  • 動態介面原型設計

主要特色

  • 可自定義的節點和連接
  • 動畫網路狀互動
  • 跨平台支援
  • 可擴展的控件設計
  • 響應式佈局處理
  • 即時用戶互動

適合對象

  • 遊戲開發者
  • UI/UX 設計師
  • 教育類應用程式開發者
  • 數據可視化項目
  • 互動式原型建構工具

使用建議

  • 性能可能隨著節點數量增加而變化
  • 在小螢幕上需要仔細的版面管理
  • 除了基本範例外,文件有限
  • 最適合靜態或變化緩慢的網路
  • 可能需要為生產應用添加額外的樣式
  • 未針對即時多人遊戲場景進行優化

原始 README

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

Spider Web Control

Static Badge Static Badge Static Badge

Demo

A customizable spider web control widget for Flutter that detects touch directions with interactive visual effects.

Features

  • Customizable appearance: Change colors, size, and web structure
  • Direction detection: Get callbacks for 8-directional touch input (R, L, F, B, FR, FL, BR, BL)
  • Interactive effects: Web threads warp and bend around touch points
  • Flexible integration: Works with any connection type (Bluetooth, HTTP, WebSocket, etc.)
  • Theme support: Built-in dark and light theme configurations

Installation

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

dependencies:
  spider_web_control: ^0.0.2

Usage

Basic Usage
import 'package:spider_web_control/spider_web_control.dart';

SpiderWebControl(
  onDirectionChanged: (direction) {
    print('Direction: $direction');
    // Handle direction change (e.g., send to device)
  },
)
Custom Configuration
SpiderWebControl(
  config: SpiderWebConfig(
    size: 400.0,
    threadColor: Colors.cyan,
    dewDropColor: Colors.lightBlue,
    centerThreshold: 100.0,
    sendInterval: Duration(milliseconds: 500),
  ),
  onDirectionChanged: (direction) {
    // Your custom logic here
  },
  onTouchStart: () => print('Touch started'),
  onTouchEnd: () => print('Touch ended'),
)
Using with Bluetooth
class MyBluetoothController extends StatelessWidget {
  final BluetoothConnection connection;

  MyBluetoothController({required this.connection});

  @override
  Widget build(BuildContext context) {
    return SpiderWebControl(
      config: SpiderWebConfig.darkTheme(size: 350.0),
      onDirectionChanged: (direction) {
        // Send direction to Bluetooth device
        connection.output.add(Uint8List.fromList(direction.codeUnits));
      },
    );
  }
}
Theme Examples
// Dark theme
SpiderWebControl(
  config: SpiderWebConfig.darkTheme(size: 300.0),
  onDirectionChanged: (direction) => handleDirection(direction),
)

// Light theme
SpiderWebControl(
  config: SpiderWebConfig.lightTheme(size: 300.0),
  onDirectionChanged: (direction) => handleDirection(direction),
)

// Custom theme
SpiderWebControl(
  config: SpiderWebConfig(
    size: 320.0,
    threadColor: Colors.purple,
    minorThreadColor: Colors.purpleAccent,
    dewDropColor: Colors.pink,
    radialDivisions: 48,
    circleDivisions: 30,
  ),
  onDirectionChanged: (direction) => handleDirection(direction),
)

Configuration Options

Property Type Default Description
size double 300.0 Size of the spider web widget
threadColor Color Colors.blue Main thread color
minorThreadColor Color Colors.blueGrey Minor thread color
dewDropColor Color Colors.lightBlue Dew drop accent color
centerThreshold double 80.0 Dead zone radius in center
sendInterval Duration Duration(seconds: 1) Minimum time between direction callbacks
radialDivisions int 36 Number of radial web divisions
circleDivisions int 25 Number of circular web divisions

Direction Values

The widget returns these direction strings:

  • 'R' - Right
  • 'L' - Left
  • 'F' - Forward/Up
  • 'B' - Back/Down
  • 'FR' - Forward-Right
  • 'FL' - Forward-Left
  • 'BR' - Back-Right
  • 'BL' - Back-Left
  • 'Disabled Zone' - Center area (not sent to callback)

License

MIT License - see LICENSE file for details.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。