base library
base_plus
An adaptive UI library for Flutter that provides one codebase with two design modes:
- Cupertino Design for iOS with iOS 16+ native component integration
- Material 3 Design for Android and Fuchsia with dynamic colors and modern aesthetics
Key Features
- 🎨 Adaptive Design: Automatically uses Cupertino on iOS, Material on Android/Fuchsia
- 🚀 Material 3 Support: Full Material You design system with semantic colors
- 📱 Native iOS Components: Direct UIKit integration (UISheetPresentationController, UIButton, UISearchBar, UIToolbar, UINavigationBar)
- ⚡ GetX Integration: Optional reactive state management and routing
- 🎯 Modern Design: iOS 16+ design patterns with Liquid Glass effects
- 🔧 Backward Compatible: Progressive upgrade path for existing projects
- 🌐 Cross-Platform: Flutter 3.10+, Dart 3.0+, iOS 12+, Android API 21+
Getting Started
Import the main library:
import 'package:base_plus/base_plus.dart';
Use BaseApp as your root widget, BaseScaffold for layouts, and adaptive widgets like BaseButton, BaseNavigationBar, BaseAppBar, and more.
Platform Modes
Control platform behavior with BaseConfig:
BaseConfig.instance
..cupertino = const BaseCupertinoConfig(forceUseMaterial: true) // Use Material on iOS
..material = const BaseMaterialConfig(forceUseCupertino: true); // Use Cupertino on Android
Documentation
See individual component documentation for detailed API references and examples. Visit https://github.com/pastordee/base_plus for more information.
Classes
- Navigation service for accessing context when needed
- BaseActionSheet
- Base wrapper for ActionSheet with native iOS support and cross-platform compatibility
- BaseActionSheetAction
- Represents a single action in an action sheet (cross-platform data model)
- BaseActionSheetWidget
- BaseActionSheetWidget (Deprecated - Old Widget-based Implementation)
- BaseAlert
- BaseAlert - Cross-platform native alert dialogs
- BaseAlertAction
- Represents an action button in an alert (cross-platform data model)
- BaseAlertDialog
- BaseAlertDialog with iOS 26 Liquid Glass Dynamic Material and Material 3 support
- BaseApp
- BaseApp theme, use cupertinoTheme by cupertino,use materialTheme by material. use CupertinoApp by cupertino not support CupertinoApp.router yet. *** use cupertino = { forceUseMaterial: true } force use MaterialApp/GetMaterialApp on cupertino. use MaterialApp or GetMaterialApp by material (controlled by useGetX parameter) not support MaterialApp.router yet. *** use material = { forceUseCupertino: true } force use CupertinoApp on material.
- BaseAppBar
- BaseAppBar
- BaseBarItem
- BaseBarItem use BottomNavigationBarItem by cupertino *** use cupertino = { forceUseMaterial: true } force use BottomNavigationBarItem on cuperitno. use BottomNavigationBarItem by material *** use material = { forceUseCupertino: true } force use BottomNavigationBarItem on material.
- BaseBottomNavigationBar with iOS 26 Liquid Glass Dynamic Material and Material 3 support
- BaseBottomToolbar
- BaseBottomToolbar - Cross-platform bottom toolbar with expandable search
- BaseButton
- BaseButton
- BaseClass
- Base class Cupertino mode uses buildByCupertino method, Material mode uses buildByMaterial method *** Parameters
- BaseCNActionSheet
- Legacy alias for backward compatibility
- BaseCNAlert
- @Deprecated - Use BaseAlert instead
- BaseCNBottomToolbar
- @deprecated Use BaseBottomToolbar instead.
- BaseCNIcon
- BaseCNIcon - Native iOS icon using SF Symbols via CNIcon
- BaseCNPullDownButton
- @Deprecated - Use BasePullDownButton instead
- BaseCNToolbar
- @Deprecated - Use BaseToolbar instead
- BaseColor
- Use different colors for Brightness.light and Brightness.dark
- BaseCrossPlatformTabScaffold
- A cross-platform tab scaffold that provides bottom navigation for both platforms
- BaseCupertinoInteractiveKeyboard
- Base wrapper for CupertinoInteractiveKeyboard with cross-platform support
- BaseCustomImageKey
- Metadata for custom image-based tab bar items
- BaseDialogAction
- BaseDialogAction with iOS 26 Liquid Glass Dynamic Material and Material 3 support
- BaseDrawer
- BaseDrawer with iOS 26 Liquid Glass Dynamic Material support
- BaseDrawerState
- BaseExpansion
- BaseExpansion with iOS 26 Liquid Glass Dynamic Material and Material 3 support
- BaseExpansionM3
- Material 3 optimized expansion panel factory
- BaseExpansionState
- BaseIcon
- use Icon by cupertino *** use cupertino = { forceUseMaterial: true } force use Icon on cuperitno. use Icon by material *** use material = { forceUseCupertino: true } force use Icon on material.
- BaseIconButton
- BaseIconButton
- BaseIndicator
- BaseIndicator use CupertinoActivityIndicator by cupertino *** use cupertino = { forceUseMaterial: true } force use CircularProgressIndicator on cuperitno. use CircularProgressIndicator by material *** use material = { forceUseCupertino: true } force use CupertinoActivityIndicator on material.
- BaseMaterialWidget
- Enhanced Material widget with iOS 26 Liquid Glass Dynamic Material support
- BaseNativeSheet
- BaseNativeSheet - Cross-platform native sheet with iOS UISheetPresentationController support
- BaseNativeTabBarItemKey
- Metadata for converting BottomNavigationBarItem to CNTabBarItem
- Internal: CNNavigationBarAction from cupertino_native package Used only for iOS platform channel communication Public API should use BaseNavigationBarAction instead BaseNavigationBar - Cross-platform navigation bar with native iOS support
- Cross-platform navigation bar action
- BaseNavigationDrawer - Cross-platform drawer that automatically uses Material design
- BaseNoSplash
- No-operation splash for minimal visual impact
- BaseParam
- Personalization parameters specific to Base components
- BasePlatformMode
- Runtime platform mode By default iOS, macOS use cupertino mode, others use material mode
- BasePopupButton
- BasePopupButton - Cross-platform popup button with native iOS support
- BasePopupMenuButton
- A cross-platform popup menu button that adapts to the platform
- BasePopupMenuItem
- Data class representing a popup menu item
- BasePullDownButton
- Internal: CN* classes from cupertino_native package Used only for iOS platform channel communication Public API should use Base* classes instead BasePullDownButton - Cross-platform pull-down button with native iOS support
- BasePullDownButtonAnchor
- BasePullDownButtonAnchor - Cross-platform pull-down button with menu anchoring
- BasePullDownInlineAction
- Inline action for horizontal button row at top of menu
- BasePullDownMenuDivider
- Menu divider for visual separation
- BasePullDownMenuEntry
- Abstract base class for all pull-down menu entries Used for type safety in menu construction
- BasePullDownMenuInlineActions
- Container for inline actions (horizontal row of buttons)
- BasePullDownMenuItem
- Regular menu item with icon, label, and optional callback
- Submenu with nested menu items
- BaseRandomColor
- Random color, does not support custom ranges
- BaseRefresh
- BaseIndicator use CustomScrollView + CupertinoSliverRefreshControl by cupertino *** use cupertino = { forceUseMaterial: true } force use RefreshIndicator on cuperitno. use RefreshIndicator by material *** use material = { forceUseCupertino: true } force use CupertinoSliverRefreshControl on material.
-
BaseRoute<
T> - BaseRoute use CupertinoPageRoute or CupertinoButton.filled by cupertino *** use cupertino = { forceUseMaterial: true } force use MaterialPageRoute on cuperitno. use MaterialPageRoute *** use material = { forceUseCupertino: true } force use CupertinoPageRoute on material.
- BaseScaffold
- BaseScaffold use CupertinoPageScaffold by cupertino, tab's scaffold use CupertinoTabScaffold *** use cupertino = { forceUseMaterial: true } force use Scaffold on cuperitno. use Scaffold by material *** use material = { forceUseCupertino: true } force use CupertinoPageScaffold/CupertinoTabScaffold on material.
- BaseScrollBar
- BaseScrollBar use CupertinoScrollbar by cupertino *** use cupertino = { forceUseMaterial: true } force use Scrollbar on cuperitno. use Scrollbar by material *** use material = { forceUseCupertino: true } force use CupertinoScrollbar on material.
- BaseSearchBar
- BaseSearchBar - Cross-platform search bar with native iOS support
- BaseSection
- BaseSection use custom Container by cupertino or material
- BaseSectionDivider
- BaseSegmentedControl
- BaseSegmentedControl - Cross-platform segmented control with native iOS support
- BaseSlider
- BaseSlider - Cross-platform slider with native iOS support
-
BaseState<
T extends BaseStatefulWidget> - BaseStatefulWidget
- Base stateful widget Cupertino mode uses buildByCupertino method, Material mode uses buildByMaterial method *** Parameters
- BaseStatelessWidget
- Base stateless widget Cupertino mode uses buildByCupertino method, Material mode uses buildByMaterial method *** Parameters
- BaseSwitch
- BaseSwitch - Cross-platform switch with native iOS support
- BaseTabBar
- BaseTabBar with iOS 26 Liquid Glass Dynamic Material and Material 3 support
- BaseTabScaffold
- BaseTabScaffold use CupertinoTabScaffold by cupertino *** use cupertino = { forceUseMaterial: true } to force use Scaffold material,use Scaffold by material *** use material = { forceUseCupertino: true } to force use CupertinoTabScaffold
- BaseTextField
- use CupertinoTextField by cupertino *** use cupertino = { forceUseMaterial: true } force use TextField on cuperitno. use TextField by material *** use material = { forceUseCupertino: true } force use CupertinoTextField on material.
- BaseTheme
- Reference Theme Reference from Theme
- BaseThemeData
- BaseThemeData Special properties values global setting Reference ThemeData
- BaseTile
- BaseTile use custom InkWell by cupertino *** use cupertino = { forceUseMaterial: true } force use ListTile on cuperitno. use ListTile by material *** use material = { forceUseCupertino: true } force use custom InkWell on material.
- BaseToolbar
- Internal: CNToolbarAction from cupertino_native package Used only for iOS platform channel communication Public API should use BaseToolbarAction instead BaseToolbar - Cross-platform toolbar with native iOS support
- BaseToolbarAction
- Cross-platform toolbar action
- CNActionSheet
- Legacy CNActionSheet class for backward compatibility
- CNActionSheetAction
- iOS-specific action sheet action (internal use only)
- CNAlert
- Legacy CNAlert class for backward compatibility
- CNAlertAction
- iOS-specific alert action (internal use only)
- CNBottomToolbar
- Legacy CNBottomToolbar class for backward compatibility
- CNPullDownButtonAnchor
- A Cupertino-native pull-down button with automatic menu anchoring.
- CNPullDownMenuDivider
- A visual divider between pull-down menu items.
- CNPullDownMenuEntry
-
Base type for entries in a
CNPullDownButtonmenu. - CNPullDownMenuItem
- A selectable item in a pull-down menu.
- CNSearchBar
- Legacy CNSearchBar class for backward compatibility
- CNSearchConfig
- Configuration for search integration in native components.
- CNSheetDetent
- Detent heights for resizable sheets (iOS only)
- CNSheetInlineAction
- An individual inline action button for sheets.
- CNSheetInlineActions
- A horizontal row of inline action buttons in a native sheet.
- CNSheetItem
- An item to display in a native sheet
- CNSheetItemRow
- A horizontal row of vertical-style items displayed side-by-side.
- CNSymbol
- Describes an SF Symbol to render natively.
- CupertinoInputAccessory
- Input Accessory for keyboard toolbars
- CupertinoInteractiveKeyboard
- Legacy CupertinoInteractiveKeyboard class for backward compatibility
- HeightObserver
- A widget that observes and reports changes to its child's height.
- HeightObserverRenderObject
- Render object that tracks height changes for a widget.
- LiquidGlassSplashFactory
- iOS 26 Liquid Glass Splash Factory Provides enhanced ripple effects with environmental awareness
- Material3SplashFactory
- Material 3 Enhanced Splash Factory
- Navigation service for accessing context when needed
- SFSymbols
- Common SF Symbol mappings for standard navigation icons
- WithoutSplashFactory
- Remove ripple effects, but still has 200ms delay highlighting Enhanced with iOS 26 Liquid Glass compatibility
Enums
- BaseActionSheetActionStyle
- Action style for action sheet actions (cross-platform)
- BaseAlertActionStyle
- Action style for alert actions (cross-platform)
- BaseDialogActionType
- Material 3 button type for dialog actions
- BaseMode
- Platform build mode
- BaseToolbarAlignment
- Toolbar middle alignment options
- CNActionSheetButtonStyle
- iOS-specific action sheet button style (internal use only)
- CNAlertActionStyle
- iOS-specific alert action style (internal use only)
- CNAutocapitalizationType
- Auto-capitalization type
- CNAutocorrectionType
- Auto-correction type
- CNButtonStyle
-
Visual styles for
CNButtonand related controls. - CNKeyboardAppearance
- Keyboard appearance
- CNKeyboardType
- Keyboard type
- CNReturnKeyType
- Return key type
- CNSearchBarStyle
- Search bar visual style
- CNSpellCheckingType
- Spell checking type
- WidgetBuildMode
- Widget actual build mode
Extensions
- Extension to make it easier to add SF Symbol metadata to BottomNavigationBarItem
Properties
- currentBaseMode → BaseMode
-
no setter
- defaultBaseMode ↔ BaseMode?
-
Default runtime mode
getter/setter pair
- isCupertinoMode → bool
-
build by Cupertino
no setter
- isMaterialMode → bool
-
build by Material
no setter
- withoutSplashOnCupertino ↔ bool
-
在cupertino模式下是否禁用水波纹
getter/setter pair
Functions
-
argbToColor(
String argb) → Color - argb转成Color
-
closeBaseDrawer(
GlobalObjectKey< BaseDrawerState> drawerKey) → void -
closeBaseExpansion(
GlobalKey< BaseExpansionState> key) → void - Close expansion panel with enhanced state management
-
colorToArgb(
Color color) → String - 颜色转成argb格式
-
colorToRgb(
Color color) → String - Color转成rgb格式
-
colorToRgba(
Color color) → String - 颜色转成rgba格式
-
isDark(
Color color) → bool - 是否暗颜色
-
isLight(
Color color) → bool - 是否亮颜色
-
openBaseDrawer<
T> (BuildContext context, BaseDrawer drawer, {}) → Future< T?> -
openBaseExpansion<
T> (BuildContext context, BaseExpansion baseExpansion, {Duration? transitionDuration, bool enableBarrierBlur = true}) → Future< T?> - Enhanced BaseExpansion helper functions with Material 3 and Liquid Glass support Open expansion panel with modern page route and enhanced transitions
-
pushBaseRoute<
T extends Object?> (BaseRoute< T> baseRoute, BuildContext context, {}) → Future<T?> - Navigator.push
-
pushBaseRouteAndRemoveUntil<
T extends Object?> (BaseRoute< T> baseRoute, BuildContext context, RoutePredicate predicate, {}) → Future<T?> - Navigator.pushAndRemoveUntil
-
rgbaToColor(
String rgba) → Color - rgba转成Color
-
rgbToColor(
String rgb) → Color - rgb转成Color
-
setBasePlatformMode(
{BasePlatformMode? basePlatformMode = const BasePlatformMode()}) → void - Must call this method before building baseApp set the platform
-
showBaseAlertDialog<
T> (BaseAlertDialog alertDialog, BuildContext context, {bool barrierDismissible = true, Color? barrierColor = Colors.black54, String? barrierLabel, bool useSafeArea = true, RouteSettings? routeSettings}) → Future< T?> - showDialog
Typedefs
- OnWidgetHeightChange = void Function(double height)
- Callback function type for widget height changes.