dashboards_responsive_core

Core models and business logic for responsive dashboard layouts - pure Dart package.

This package contains the fundamental data structures and business logic for creating responsive dashboard layouts, without any Flutter dependencies. It's perfect for:

  • Pure Dart applications
  • Server-side applications
  • Shared business logic between Flutter and other platforms
  • Testing dashboard logic without Flutter

Features

  • Pure Dart models - No Flutter dependencies
  • JSON serialization - Full support for saving/loading layouts
  • Responsive breakpoints - Support for different screen sizes
  • Collision detection - Built-in overlap detection
  • Hierarchical layouts - Multi-breakpoint layout management

Getting started

Add the package to your pubspec.yaml:

dependencies:
  dashboards_responsive_core: ^1.0.0

Usage

import 'package:dashboards_responsive_core/dashboards_responsive_core.dart';

// Create a dashboard layout
final layout = DashboardLayout(
  breakpointLayouts: {
    Breakpoint.xs: BreakpointLayout(widgets: {
      'widget1': WidgetPosition(x: 0, y: 0, w: 4, h: 2),
    }),
    Breakpoint.md: BreakpointLayout(widgets: {
      'widget1': WidgetPosition(x: 0, y: 0, w: 6, h: 2),
    }),
  },
  widgetIds: {'widget1'},
);

// Serialize to JSON
final json = layout.toJson();

// Deserialize from JSON
final restoredLayout = DashboardLayout.fromJson(json);

Models

  • WidgetPosition - Position and size of a widget
  • BreakpointLayout - Layout for a specific breakpoint
  • DashboardLayout - Complete dashboard with multiple breakpoints
  • DashboardConfig - Configuration for dashboard behavior
  • Breakpoint - Screen size breakpoints (xs, sm, md, lg, xl)
  • CompactionMode - Layout compaction strategies
  • dashboards_responsive - Full Flutter package with UI components