TolyUI Documentation

repository·main·Indexed 19 days ago

https://github.com/tolyfx/toly_ui

A modern, responsive UI component library for Flutter supporting mobile, desktop, and web. TolyUI is organized into 26 independent packages across categories such as Core, Basic, Form, Navigation, Data, Feedback, Advanced, and Media. It features a core aggregate package for all-in-one access, a responsive grid system via tolyui_rx_layout, advanced data components like tolyui_table and tolyui_tree, and specialized tools such as tolyui_anchor for index-level scroll control and tolyui_debug for mobile simulation on web.

Tokens
51.6K
Snippets
170
Records
240
Agent score
65%

What's inside TolyUI

  1. Overview of TolyUI Responsive Layout

    main

    The tolyui_rx_layout module provides responsive layout capabilities for Flutter. It extends standard layout widgets with reactive properties and responsive design features, including:

    • Enhanced Row Support: Includes properties for gutter, verticalGutter, padding, align, and justify.
    • Cell Manipulation: Supports offset, push, and pull for fine-grained positioning.
    • Responsive Sizing and Padding: Provides Size$ and Padding$ abstractions for reactive dimension management.
    • Window-based Responsiveness: Includes WindowRespondBuilder to build UIs that react to window/screen size changes.
    • Theme Integration: Supports setting RxParserStrategy via ThemeData to control how reactive values are parsed and applied.
  2. Overview of TolyUI Package Structure

    main

    TolyUI is organized into several specialized packages categorized by their functional role (Core, Basic, Form, Navigation, Data, Feedback, Advanced, and Media).

    For most users, the tolyui package serves as a core aggregate package, allowing you to import all basic components at once instead of managing dozens of individual dependencies.

    Package Categories:

    • Core: tolyui (aggregate), tolyui_meta (menu data models).
    • Basic: tolyui_rx_layout (responsive grid), tolyui_text (regex text highlighting).
    • Form: toly_check_box (tri-state), tolyui_rich_input (rich text based on flutter_quill).
    • Navigation: tolyui_anchor (anchor navigation), tolyui_navigation (breadcrumbs, menus, tabs).
    • Data: tolyui_carousel, tolyui_collapse, tolyui_default (empty states), tolyui_skeleton, tolyui_statistic, tolyui_table, tolyui_tag, tolyui_timeline, tolyui_tree, tolyui_watermark.
    • Feedback: tolyui_feedback (tooltips, popovers), tolyui_feedback_modal, tolyui_message (toasts/notifications).
    • Advanced/Media: tolyui_color, tolyui_debug, tolyui_refresh, tolyui_image.
  3. Overview of TolyUI Color Components

    main

    TolyUI provides a comprehensive suite of color selection components categorized by their use case: advanced (low-level building blocks) and form (high-level integrated pickers).

    Component Hierarchy

    • tolyui_color (Advanced): Contains foundational components for building custom color interfaces.
      • TolyHuePanel: HSV-based square S-V panel with a hue bar.
      • TolyRGBPanel: RGB three-channel sliders.
      • TolyAlphaSlider: Alpha transparency slider with a checkerboard background.
      • TolyHexInput: Hexadecimal text input.
      • TolyColorGrid: Material-style color block grid.
      • TolyColorPicker: A vertical layout integrated picker.
    • tolyui_color_picker (Form): A high-level component designed for form integration, following an Ant Design style (horizontal sliders with a bottom input bar). It depends on tolyui_color and tolyui_feedback (for Popover support).
    tolyui (Main App)
    ├── tolyui_color (advanced)     ← Basic color components
    │   ├── TolyHuePanel
    │   ├── TolyRGBPanel
    │   ├── TolyAlphaSlider
    │   ├── TolyHexInput
    │   ├── TolyColorGrid
    │   └── TolyColorPicker (Vertical layout)
    └── tolyui_color_picker (form)  ← Form field component
        ├── Depends on: tolyui_color
        ├── Depends on: tolyui_feedback (Popover)
        └── TolyColorPicker (Ant Design horizontal layout)
  4. Overview of TolyUI

    main

    TolyUI is a modern responsive UI component library for Flutter, designed for multi-platform use. It follows a Monorepo + Modular architecture, meaning UI components are split into independent Flutter Packages that can be published to pub.dev and imported individually. This allows for on-demand inclusion to keep application sizes small.

    Key Characteristics:

    • Modular: Components are organized into independent packages (e.g., tolyui_text, tolyui_table).
    • Responsive: Built with a 5-level breakpoint system to support everything from mobile phones to large desktop screens.
    • Type-Safe: Designed with Flutter/Dart best practices for reliability.
    • Showcase App: Includes an interactive application for online previews and documentation.
  5. Understand TolyUI's modular architecture

    main

    TolyUI is designed with a modular architecture where components are organized into independent Flutter packages. This allows for on-demand imports, meaning you only include the code for the components you actually use, which helps minimize the final application size.

    Modules are categorized as follows:

    • Basic: Core components like Buttons, Icons, and Layouts.
    • Form: Input fields, Selectors, Checkboxes, etc.
    • Navigation: Tabs, Steps, Breadcrumbs, and Menus.
    • Data: Complex data displays like Trees (supporting virtual scrolling and drag-and-drop), Tables, Cards, and Pagination.
    • Feedback: Messages, Notifications, Loading indicators, and Tooltips.
    • Advanced: Specialized components like Color pickers and Device frames.
  6. How data flows in TolySheet

    main

    TolySheet uses a reactive data stream design. Data changes automatically trigger UI updates through the following flow:

    SheetDataProvider $\rightarrow$ Stream<SheetDataSnapshot> $\rightarrow$ TolySheet $\rightarrow$ UI

    This design natively supports asynchronous data loading and real-time updates because the component listens to the stream emitted by the provider.

  7. Understand the TolySheet architecture and terminology

    main

    TolySheet uses a unique naming convention and a layered architecture to manage data-heavy tables. Instead of traditional 'Grid' or 'Table' terms, it uses a 'Sheet' concept.

    Core Terminology

    • Sheet: The data table itself.
    • Field: A data column.
    • Pick: Data selection (e.g., single/multiple selection).
    • Pin: Pinning a field (freezing columns).
    • Provider: The data source (local, remote, or stream).
    • Strategy: Behavioral configurations (e.g., how scrolling or editing works).
    • Capability: Field-specific features (e.g., sorting or filtering).
    • Spec: The definition of a field.

    Layered Architecture

    1. TolySheet (View): The presentation layer.
    2. SheetController (Control): The control layer.
    3. SheetDataProvider (Data): The data layer.
    4. Strategy/Capability (Behavior): The behavior layer.
  8. Core Differences between TolyTable and TolySheet

    main

    The transition from TolyTable to TolySheet represents a shift toward a more decoupled architecture using the Provider pattern.

    • Data Management: TolyTable uses a direct dataSource property. TolySheet uses a provider property (typically LocalSheetProvider) to manage data flow.
    • Column Definition: TableColumn is replaced by FieldSpec.
    • Rendering Logic: Instead of dataIndex or render, TolySheet uses a builder function that provides a context (ctx) to access the current row's data (ctx.data).
    • Separation of Concerns: Visual styling (like borders) is moved to appearance, and interactive logic (like selection) is moved to behavior.
  9. Customize table behavior with Strategies

    main

    Instead of deep inheritance, TolySheet uses the Strategy Pattern to define how the table interacts with users. You can compose different strategies to achieve complex requirements.

    Available strategies include:

    • PickStrategy: Defines selection modes (e.g., single, multiple, or range selection).
    • ScrollStrategy: Defines scrolling behavior (e.g., virtualization/buffering).
    • ExpandStrategy: Defines how rows expand (e.g., master-detail or nested tables).
    • EditStrategy: Defines editing modes (e.g., cell-level or row-level editing).
    • GroupStrategy: Defines data grouping and folding logic.
  10. How routing is managed in TolyUI

    main

    TolyUI uses go_router for declarative routing. Routes are managed centrally, typically within the lib/navigation directory. This allows for structured navigation patterns such as:

    • Path-based routing (e.g., /home)
    • Parameterized routes (e.g., /details/:id)
    • Settings or configuration routes (e.g., /settings)
  11. How Anchor and TolyPositionedList work

    main

    TolyUI provides two distinct modes for handling list scrolling and jumping to specific indices, depending on your precision requirements:

    1. Standard Mode: Designed for use with existing native ListView widgets. It uses a "blind jump + correction" approach. It performs an approximate jump based on estimated heights and then performs a secondary alignment once the actual components are loaded and their real heights are reported.
    2. Enhanced Mode (Strict Mode / TolyPositionedList): Designed for professional, massive long lists where 100% jump precision is required without visual jitter. It implements a "Logical Anchor Layout" using a two-way Sliver architecture (one Sliver for items after the target index and one for items before it) and maintains a logical coordinate system of (Index, Offset) rather than relying solely on physical pixels.
  12. Use the tolyui core aggregate package

    main
    If you want access to a broad set of TolyUI components without managing individual dependencies, use the tolyui aggregate package. This package acts as a central hub for 8 major sub-packages, simplifying the setup for projects requiring multiple component types.