adaptive_kit library

adaptive_kit - The Tailwind CSS of Flutter

A zero-config, declarative adaptive UI toolkit for responsive, platform-aware Flutter apps.

Features

  • Responsive breakpoint system - 5 breakpoints with cascading values
  • Adaptive widgets - Material/Cupertino auto-switching
  • Design tokens - Spacing, typography, radius, and themes
  • Animated transitions - Smooth breakpoint changes
  • Sliver support - Responsive slivers for CustomScrollView
  • Golden test helpers - Test across all breakpoints
  • Convenient extensions - BuildContext, Widget, and num extensions

Quick Start

import 'package:adaptive_kit/adaptive_kit.dart';

// Use SmartApp for zero-config setup
SmartApp(
  title: 'My App',
  home: HomeScreen(),
)

// Or wrap with SmartUi for custom config
SmartUi(
  breakpoints: SmartBreakpoints.custom(
    mobile: 320,
    tablet: 768,
    desktop: 1024,
  ),
  child: MaterialApp(...),
)

// Use responsive values
final columns = context.bp<int>(
  mobile: 1,
  tablet: 2,
  desktop: 4,
);

// Check breakpoints
if (context.isMobile) {
  return MobileLayout();
}

// Animated layout switching
SmartLayout(
  transition: SmartTransition.fadeSlide,
  mobile: MobileView(),
  desktop: DesktopView(),
)

// Use adaptive widgets
SmartButton(onPressed: () {}, child: Text('Save'));
SmartSwitch(value: isDark, onChanged: (v) => ...);

// Use design tokens
SmartPadding.all(SpacingSize.md, child: ...);
SmartGap.lg();
SmartText('Hello', style: TypographyStyle.headlineLarge);

Classes

BodyText
A body text widget.
A breadcrumb item.
BreakpointBuilder
A widget that provides the current breakpoint to its builder.
BreakpointCapture
A test wrapper that captures the current breakpoint.
BreakpointDebugOverlay
A test widget that displays the current breakpoint name.
BreakpointObserver
A widget that rebuilds when the breakpoint changes.
BreakpointTestConfig
Configuration for a breakpoint test.
CenteredContent
A centered content container with max-width and padding.
DesktopOnly
A widget that shows its child only on desktop and TV breakpoints.
DisplayText
A display text widget.
HeadlineText
A headline text widget.
HGap
A horizontal gap widget.
HideOnDesktop
A widget that hides its child on desktop and TV breakpoints.
HideOnMobile
A widget that hides its child on mobile and watch breakpoints.
LabelText
A label text widget.
MobileOnly
A widget that shows its child only on mobile and watch breakpoints.
ResponsiveBuilder
A builder widget that provides responsive information.
ResponsiveInfo
Information about the current responsive context.
ResponsivePaddedContainer
A container that automatically applies responsive padding.
ResponsiveValue<T>
A value that can vary based on breakpoint.
SliverSmartList
A sliver list that builds different items based on breakpoints.
SliverSmartPadding
A sliver that applies responsive padding.
SliverSmartSafeArea
A sliver version of SmartSafeArea.
SliverSmartVisible
A sliver that conditionally shows its child based on breakpoints.
SmartApp
A wrapper widget that auto-configures SmartUi with your MaterialApp.
SmartAppScaffold
A simpler adaptive scaffold without navigation.
SmartBottomSheet
An adaptive modal bottom sheet.
SmartBreadcrumbs
A breadcrumb navigation widget.
SmartBreakpoints
Configuration class for breakpoint values.
SmartButton
An adaptive button that uses Material or Cupertino styling.
SmartCheckbox
An adaptive checkbox.
SmartChipWrap
A responsive chip wrap that displays chips with breakpoint-aware layout.
SmartCol
A column within a SmartGrid.
SmartContainer
A container with responsive max-width constraints.
SmartCupertinoApp
A wrapper widget that auto-configures SmartUi with your CupertinoApp.
SmartDecorationImage
A widget that displays different decoration images based on breakpoint.
SmartDestination
A destination for the adaptive scaffold navigation.
SmartDialogAction
Represents an action in a SmartDialog.
SmartForm
A responsive form layout that automatically adjusts columns per breakpoint.
SmartFormField
A form field wrapper for use with SmartForm.
SmartFormRow
A responsive form row that groups fields together.
SmartFormSection
A responsive form section with an optional title.
SmartGap
A gap widget that creates empty space using spacing tokens.
SmartGrid
A responsive 12-column grid container.
SmartHorizontalPadding
A horizontal padding widget using spacing tokens.
SmartIconButton
An adaptive icon button.
SmartImage
A widget that displays different images based on the current breakpoint.
SmartIndicator
An adaptive circular progress indicator.
SmartLayout
A widget that displays different children based on the current breakpoint.
SmartLinearIndicator
An adaptive linear progress indicator.
SmartLoadingOverlay
A loading overlay with an adaptive progress indicator.
SmartNavigation
An adaptive navigation component that switches between patterns.
SmartNavItem
A navigation item for SmartNavigation.
SmartPadding
A padding widget that uses spacing tokens.
SmartPlatformInfo
Provides information about the current platform.
SmartRadio<T>
An adaptive radio button.
SmartRadius
Provides border radius constants for consistent rounding.
SmartRefreshIndicator
A refresh indicator that adapts to the platform.
SmartRow
A responsive row that contains columns.
SmartSafeArea
A responsive safe area wrapper.
SmartScaffold
An adaptive scaffold that switches navigation patterns by screen size.
SmartSheetAction
Represents an action in an action sheet.
SmartSize
A utility class for responsive number calculations.
SmartSizeInit
A widget that initializes SmartSize for its descendants.
SmartSliverGrid
A responsive sliver grid that adjusts column count based on breakpoints.
SmartSliverGridExtent
A responsive sliver grid with adaptive extent.
SmartSpacing
Provides spacing constants for consistent spacing throughout the app.
SmartSpacingTokens
Customizable spacing token configuration.
SmartSwitch
An adaptive switch that uses Material or Cupertino styling.
SmartTabBar
A tab bar that adapts its appearance based on screen size.
SmartTestConfigs
Default breakpoint test configurations.
SmartText
A text widget that uses typography tokens.
SmartTheme
Breakpoint-aware theme configuration.
SmartThemeData
Theme data containing breakpoint-specific design tokens.
SmartTypography
Provides typography constants and text styles.
SmartUi
Global configuration widget for smartui.
SmartUiData
Data class containing smartui configuration.
SmartVerticalPadding
A vertical padding widget using spacing tokens.
SmartVisible
A widget that conditionally shows its child based on breakpoints.
SmartWrap
A responsive Wrap widget that limits items per row based on breakpoints.
TabletOnly
A widget that shows its child only on tablet breakpoint.
VGap
A vertical gap widget.

Enums

BodySize
Body text sizes.
DisplaySize
Display text sizes.
HeadlineSize
Headline text sizes.
LabelSize
Label text sizes.
RadiusSize
Enum representing radius sizes.
SmartBreakpoint
Represents the different screen size breakpoints.
SmartPlatform
Represents the different platforms supported by Flutter.
SmartTransition
Transition types for animated breakpoint changes.
SpacingSize
Enum representing spacing sizes.
TypographyStyle
Enum representing typography styles.

Extensions

ResponsiveValueExtension on BuildContext
Extension on BuildContext for responsive value selection.
SmartContextExtension on BuildContext
Extension on BuildContext for responsive UI utilities.
SmartNumExtension on num
Extension on num for responsive sizing.
SmartThemeExtension on BuildContext
Extension on BuildContext for accessing SmartThemeData.
SmartWidgetExtension on Widget
Extension on Widget for responsive utilities.

Functions

createSmartTestWidget({required Widget child, required double width, double height = 800, SmartBreakpoints breakpoints = SmartBreakpoints.defaults, EdgeInsets padding = EdgeInsets.zero, EdgeInsets viewInsets = EdgeInsets.zero, double devicePixelRatio = 1.0, double textScaleFactor = 1.0, Brightness platformBrightness = Brightness.light}) Widget
Creates a test widget wrapped with SmartUi and custom MediaQuery.
createSmartTestWidgetForConfig({required BreakpointTestConfig config, required Widget child, SmartBreakpoints breakpoints = SmartBreakpoints.defaults, EdgeInsets padding = EdgeInsets.zero}) Widget
Creates a test widget for a specific breakpoint configuration.
showSmartActionSheet<T>({required BuildContext context, String? title, String? message, required List<SmartSheetAction> actions, SmartSheetAction? cancelAction, bool forceMaterial = false, bool forceCupertino = false}) Future<T?>
Shows an adaptive action sheet.
showSmartBottomSheet<T>({required BuildContext context, required Widget child, String? title, bool forceMaterial = false, bool forceCupertino = false, bool isDismissible = true, bool enableDrag = true}) Future<T?>
Shows an adaptive modal bottom sheet.
showSmartConfirmDialog({required BuildContext context, String? title, String? content, Widget? contentWidget, String confirmLabel = 'OK', String cancelLabel = 'Cancel', bool isDestructive = false, bool forceMaterial = false, bool forceCupertino = false}) Future<bool>
Shows an adaptive confirmation dialog.
showSmartDialog<T>({required BuildContext context, String? title, String? content, Widget? contentWidget, List<SmartDialogAction>? actions, bool forceMaterial = false, bool forceCupertino = false, bool barrierDismissible = true}) Future<T?>
Shows an adaptive alert dialog.
testSmartBreakpoints(String description, {required List<BreakpointTestConfig> configs, required Widget build(BreakpointTestConfig config), required Future<void> test(dynamic tester, BreakpointTestConfig config), SmartBreakpoints breakpoints = SmartBreakpoints.defaults, bool skip = false}) → void
Runs a test callback for each breakpoint configuration.