搜索插件、代码仓与 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.

所属分类

源码仓库

使用此插件的项目

暂无相关数据。