=============== LIBRARY RULES =============== From library maintainers: - Use the PlatformXxx widgets instead of branching on Theme.of(context).platform or Platform.isIOS; each PlatformXxx renders its Material equivalent on Android and its Cupertino equivalent on iOS automatically. - Import only the barrel entry point 'package:platform_adaptive_widgets/platform_adaptive_widgets.dart'; never import from lib/src/ paths directly. - Configure a PlatformXxx widget through its paired *Data classes (e.g. MaterialAppBarData / CupertinoNavigationBarData for PlatformAppBar) to set platform-specific options without per-platform branching in app code. - Supports Android and iOS only; requires Flutter >=3.44.0 and Dart SDK >=3.12.0 <4.0.0. ### Quick Start: Basic App Structure Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/README.md Demonstrates the basic setup of a Flutter application using PlatformApp, PlatformScaffold, and PlatformButton for cross-platform rendering. ```dart import 'package:flutter/widgets.dart'; import 'package:platform_adaptive_widgets/platform_adaptive_widgets.dart'; void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) => PlatformApp( title: 'My App', home: PlatformScaffold( appBarData: const PlatformAppBar(title: Text('Home')), body: Center( child: PlatformButton( onPressed: () {}, child: const Text('Tap me'), ), ), ), ); } ``` -------------------------------- ### Run Example App Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/README.md Navigate to the example directory and run the Flutter application to interact with the widgets and their property editors. ```sh cd example flutter run ``` -------------------------------- ### App Setup with Declarative Router (go_router) Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/EXAMPLES.md Illustrates integrating a declarative router like go_router with PlatformApp. This example requires the go_router package to be added to your project dependencies. ```dart final _router = GoRouter( routes: [ GoRoute( path: '/', builder: (context, state) => const HomePage(), ), GoRoute( path: '/details/:id', builder: (context, state) => DetailsPage(id: state.pathParameters['id']!), ), ], ); class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) => PlatformApp.router( title: 'My App', routerConfig: _router, materialAppData: MaterialAppData(theme: ThemeData(...)), cupertinoAppData: const CupertinoAppData(...), ); } ``` -------------------------------- ### PlatformAppBar Example Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/layout-widgets.md Example of how to use the PlatformAppBar with a title, leading icon, and actions. ```dart PlatformAppBar( title: const Text('My App'), leading: const BackButton(), actions: [ IconButton(icon: const Icon(Icons.settings), onPressed: () {}), ], ) ``` -------------------------------- ### Date Example Usage Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/types.md Demonstrates creating a Date instance, getting the current date, adding days, checking if a date is in the past, and calculating the difference between dates. ```dart final date = Date(year: 2024, month: 6, day: 10); final today = Date.now(); final nextYear = date.add(const Duration(days: 365)); if (date.isBefore(today)) { print('Date is in the past'); } final duration = date.difference(today); print('Days difference: ${duration.inDays}'); ``` -------------------------------- ### Minimal App Setup with Navigator Routing Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/EXAMPLES.md Demonstrates the most basic setup for a Flutter application using PlatformApp and PlatformScaffold with standard Navigator routing. Ensure you have the necessary imports for Flutter widgets and platform_adaptive_widgets. ```dart import 'package:flutter/widgets.dart'; import 'package:platform_adaptive_widgets/platform_adaptive_widgets.dart'; void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) => PlatformApp( title: 'My App', home: const HomePage(), ); } class HomePage extends StatelessWidget { const HomePage({super.key}); @override Widget build(BuildContext context) => PlatformScaffold( appBarData: const PlatformAppBar(title: Text('Home')), body: const Center(child: Text('Welcome')), ); } ``` -------------------------------- ### PlatformScaffold Example Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/layout-widgets.md Example demonstrating the usage of PlatformScaffold with a PlatformAppBar and a centered body content. ```dart PlatformScaffold( appBarData: const PlatformAppBar(title: Text('My App')), body: const Center(child: Text('Hello World')), ) ``` -------------------------------- ### PlatformApp Example Usage Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/layout-widgets.md Demonstrates how to use the PlatformApp widget with custom themes for both Material and Cupertino platforms. ```dart PlatformApp( title: 'My App', home: const MyHomePage(), materialAppData: MaterialAppData( theme: myLightTheme, darkTheme: myDarkTheme, ), cupertinoAppData: const CupertinoAppData( theme: myCupertinoTheme, ), ) ``` -------------------------------- ### Platform-Specific Code Example Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/utilities.md Example demonstrating how to use platform detection utilities to execute Android-specific code. ```dart if (isAndroid) { // Android-specific code } ``` -------------------------------- ### PlatformWidgetBuilder Example Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/platform-widgets.md Shows how to use PlatformWidgetBuilder to wrap a Text widget with a Card on Android and a CupertinoListTile on iOS. ```dart PlatformWidgetBuilder( materialWidgetBuilder: (context, child) => Card( child: child, ), cupertinoWidgetBuilder: (context, child) => CupertinoListTile( child: child, ), child: const Text('Content'), ) ``` -------------------------------- ### App Setup with Theme Configuration Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/EXAMPLES.md Shows how to configure Material Design and Cupertino themes for your application using PlatformApp. This allows for platform-specific styling and theme modes. ```dart class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) => PlatformApp( title: 'My App', home: const HomePage(), materialAppData: MaterialAppData( theme: ThemeData( colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue), useMaterial3: true, ), darkTheme: ThemeData( brightness: Brightness.dark, colorScheme: ColorScheme.fromSeed( seedColor: Colors.blue, brightness: Brightness.dark, ), ), themeMode: ThemeMode.system, ), cupertinoAppData: const CupertinoAppData( theme: CupertinoThemeData( primaryColor: CupertinoColors.systemBlue, ), ), ); } ``` -------------------------------- ### Show Platform Date Picker Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/EXAMPLES.md Example of how to present a platform-adaptive date picker. It allows selecting a date within a specified range and logs the selected date. ```dart Future _selectDate(BuildContext context) async { final picked = await showPlatformDatePicker( context: context, firstDate: const Date(year: 2020), lastDate: Date.now().add(const Duration(days: 365)), initialDate: Date.now(), ); if (picked != null) { print('Selected date: $picked'); } } ``` -------------------------------- ### PlatformWidget Example Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/platform-widgets.md Demonstrates how to use PlatformWidget to provide different UI elements for Android (ElevatedButton) and iOS (CupertinoButton). ```dart PlatformWidget( materialBuilder: (context) => ElevatedButton( onPressed: () {}, child: const Text('Android Button'), ), cupertinoBuilder: (context) => CupertinoButton( onPressed: () {}, child: const Text('iOS Button'), ), ) ``` -------------------------------- ### Importing the Package Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/START_HERE.md Shows the basic import statement required to use the platform_adaptive_widgets package in your project. No additional setup is needed. ```dart import 'package:platform_adaptive_widgets/platform_adaptive_widgets.dart'; ``` -------------------------------- ### Platform Button with Icon Customization Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/README.md Example of creating a platform-adaptive button with an icon and label. Demonstrates how to specify Material and Cupertino specific variants and data. ```dart PlatformButton.icon( onPressed: _add, icon: const Icon(Icons.add), label: const Text('Add'), materialButtonVariant: .filled, // Android: FilledButton.icon cupertinoButtonVariant: .filled, // iOS: CupertinoButton.filled cupertinoButtonData: const CupertinoButtonData(pressedOpacity: 0.6), // iOS-only tuning ) ``` -------------------------------- ### Platform Widget with Data Classes Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/README.md Example of a PlatformButton widget configured with both Material and Cupertino specific data classes for platform-tuned behavior. ```dart PlatformButton( onPressed: () {}, child: const Text('Press me'), materialButtonData: MaterialButtonData( style: ButtonStyle(...), ), cupertinoButtonData: CupertinoButtonData( pressedOpacity: 0.6, ), ) ``` -------------------------------- ### Add Adaptive Widgets Package to Flutter Project Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/README.md Install the `platform_adaptive_widgets` package using Flutter's package manager. This is the first step to using adaptive widgets in your application. ```sh flutter pub add platform_adaptive_widgets ``` -------------------------------- ### PlatformListTile Example Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/painting-widgets.md Use PlatformListTile to create a list item that adapts its appearance between Material Design and Cupertino styles. It supports leading, title, subtitle, trailing widgets, and tap callbacks. ```dart PlatformListTile( leading: const Icon(Icons.person), title: const Text('John Doe'), subtitle: const Text('john@example.com'), trailing: const Icon(Icons.arrow_forward), onTap: () { // Handle tile tap }, ) ``` -------------------------------- ### Get Platform-Appropriate IconData via BuildContext Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/utilities.md Selects a platform-appropriate IconData using a build context extension. Uses inline switch for const-folding and tree-shaking. ```dart extension PlatformAdaptiveContextExtensions on BuildContext { IconData platformIcon({ required IconData material, required IconData cupertino, }) } ``` ```dart Icon(context.platformIcon( material: Icons.menu, cupertino: CupertinoIcons.bars, )) ``` -------------------------------- ### Basic Adaptive App Structure Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/README.md Demonstrates setting up a Flutter app with `PlatformApp` and using adaptive widgets like `PlatformScaffold`, `PlatformAppBar`, and `PlatformButton`. This structure ensures widgets adapt to the target platform (Android/iOS). ```dart import "package:flutter/widgets.dart"; import "package:platform_adaptive_widgets/platform_adaptive_widgets.dart"; void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) => PlatformApp( title: 'Adaptive Demo', home: PlatformScaffold( appBarData: const PlatformAppBar(title: Text('Adaptive Demo')), body: Center( child: PlatformButton( onPressed: () {}, child: const Text('Tap me'), ), ), ), ); } ``` -------------------------------- ### Create AI-Agent Discovery Symlinks Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/README.md Set up gitignored symlinks for AI coding agents to discover canonical guidance files. This step is optional and only required if you use a coding agent. ```bash ln -s .ai/AGENTS.md AGENTS.md ln -s .ai/CLAUDE.md CLAUDE.md ln -s .ai/AGENTS.md example/AGENTS.md ``` -------------------------------- ### Get PlatformAdaptiveIcons Instance via BuildContext Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/utilities.md Returns a PlatformAdaptiveIcons instance for the current build context, providing access to platform-adaptive icon utilities. ```dart extension PlatformAdaptiveContextExtensions on BuildContext { PlatformAdaptiveIcons get platformAdaptiveIcons => PlatformAdaptiveIcons(this); } ``` -------------------------------- ### Show Platform Time Picker Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/EXAMPLES.md Demonstrates how to use the platform-adaptive time picker. It allows the user to select a time and logs the selected hour and minute. ```dart Future _selectTime(BuildContext context) async { final picked = await showPlatformTimePicker( context: context, initialTime: TimeOfDay.now(), ); if (picked != null) { print('Selected time: ${picked.hour}:${picked.minute}'); } } ``` -------------------------------- ### CupertinoScaffoldData Configuration Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/data-classes.md Configure Cupertino-only settings for PlatformScaffold. Includes background color and resize behavior. ```dart final class CupertinoScaffoldData { final Color? backgroundColor; final bool resizeToAvoidBottomInset; } ``` -------------------------------- ### Show Platform Time Picker Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/dialog-widgets.md Initiates a platform-adaptive time picker dialog. It requires a BuildContext and an initial time. ```dart final picked = await showPlatformTimePicker( context: context, initialTime: TimeOfDay.now(), ); ``` -------------------------------- ### Show Custom Platform Dialog with Builders Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/EXAMPLES.md Demonstrates creating a custom dialog that adapts to Material or Cupertino platforms using materialBuilder and cupertinoBuilder. Returns a String value upon confirmation. ```dart Future _showCustomDialog(BuildContext context) async { return showPlatformDialog( context: context, materialBuilder: (context) => Padding( padding: const EdgeInsets.all(16), child: Column(mainAxisSize: MainAxisSize.min, children: [ const Text('Material Dialog'), const SizedBox(height: 16), PlatformButton( onPressed: () => Navigator.pop(context, 'confirmed'), child: const Text('OK'), ), ]), ), cupertinoBuilder: (context) => Padding( padding: const EdgeInsets.all(16), child: Column(mainAxisSize: MainAxisSize.min, children: [ const Text('Cupertino Dialog'), const SizedBox(height: 16), PlatformButton( onPressed: () => Navigator.pop(context, 'confirmed'), child: const Text('OK'), ), ]), ), ); } ``` -------------------------------- ### PlatformButton Examples Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/interaction-widgets.md Illustrates the usage of PlatformButton for different scenarios, including text-only buttons, icon and label buttons, and disabled buttons. The materialButtonVariant and cupertinoButtonVariant parameters can be used to customize the appearance on each platform. ```dart // Text-only button PlatformButton( onPressed: () => Navigator.maybeOf(context)?.pop(), child: const Text('Dismiss'), ) // Icon + label button PlatformButton.icon( onPressed: _onAdd, icon: const Icon(Icons.add), label: const Text('Add'), materialButtonVariant: .filled, cupertinoButtonVariant: .filled, ) // Disabled button PlatformButton( onPressed: () {}, isEnabled: false, child: const Text('Disabled'), ) ``` -------------------------------- ### Show Platform Time Picker Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/dialog-widgets.md Presents a time picker dialog that adapts to the platform. It requires a BuildContext and can optionally take an initialTime. Customization is possible via builder and platform-specific data objects. ```dart final selectedTime = await showPlatformTimePicker( context: context, initialTime: TimeOfDay.now(), ); ``` -------------------------------- ### CupertinoScaffoldData Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/data-classes.md Cupertino-only configuration for PlatformScaffold. Provides basic settings for background color and layout adjustment. ```APIDOC ## CupertinoScaffoldData ### Description Cupertino-only configuration for `PlatformScaffold`. Provides basic settings for background color and layout adjustment. ### Fields - **backgroundColor** (Color?) - **resizeToAvoidBottomInset** (bool) ``` -------------------------------- ### PlatformScaffold Constructor Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/configuration.md This constructor creates a basic scaffold layout. It requires a body widget and allows customization of the app bar, background color, and resizing behavior to avoid bottom inset. Platform-specific data for Material and Cupertino scaffolds can also be provided. ```dart const PlatformScaffold({ required Widget body, PlatformAppBarData? appBarData, Color? backgroundColor, bool resizeToAvoidBottomInset = kDefaultResizeToAvoidBottomInset, MaterialScaffoldData? materialScaffoldData, CupertinoScaffoldData? cupertinoScaffoldData, Key? widgetKey, Key? key, }) ``` -------------------------------- ### Platform-Independent Button Implementation Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/README.md Compares manual platform checking with the package's adaptive widget for building buttons. Use `PlatformButton` for a unified approach. ```dart import "package:flutter/foundation.dart"; import "package:flutter/material.dart"; // The usual way: branch by hand, and remember to do it everywhere. Widget build(BuildContext context) { if (defaultTargetPlatform == TargetPlatform.iOS) { return CupertinoButton(onPressed: _save, child: const Text('Save')); } return ElevatedButton(onPressed: _save, child: const Text('Save')); } // With this package: one widget, the right look on each platform. PlatformButton(onPressed: _save, child: const Text('Save')); ``` -------------------------------- ### Constants Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/MANIFEST.md This section references the availability of over 40 default constants, which can be used for configuration and customization within the Platform Adaptive Widgets library. ```APIDOC ## Constants The library provides over 40 default constants that can be used for various configuration and customization purposes. These constants are documented within the relevant API reference files or a dedicated constants file. ``` -------------------------------- ### showPlatformAcknowledge Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/dialog-widgets.md Shows an alert dialog with a single OK button. This is a convenience function that wraps `showPlatformAlertDialog`. ```APIDOC ## showPlatformAcknowledge ### Description A convenience function that shows an alert dialog with a single OK button. Wraps `showPlatformAlertDialog` with a pre-configured OK action. ### Signature ```dart Future showPlatformAcknowledge({ required BuildContext context, required String title, String? content, String? okText, bool barrierDismissible = false, Color? barrierColor, String? barrierLabel, RouteSettings? routeSettings, bool useRootNavigator = true, MaterialAlertDialogData? materialAlertDialogData, CupertinoAlertDialogData? cupertinoAlertDialogData, }); ``` ### Parameters #### Path Parameters - **context** (BuildContext) - Required - The build context - **title** (String) - Required - Title of the alert #### Query Parameters - **content** (String?) - Optional - Optional content text - **okText** (String?) - Optional - Text for the OK button - **barrierDismissible** (bool) - Optional - Whether tapping barrier dismisses (Default: false) - **barrierColor** (Color?) - Optional - Color of the modal barrier - **barrierLabel** (String?) - Optional - Label for the barrier - **routeSettings** (RouteSettings?) - Optional - Route settings for the dialog - **useRootNavigator** (bool) - Optional - Whether to use the root navigator (Default: true) - **materialAlertDialogData** (MaterialAlertDialogData?) - Optional - Material-specific configuration - **cupertinoAlertDialogData** (CupertinoAlertDialogData?) - Optional - Cupertino-specific configuration ### Returns A `Future` that completes when the dialog is dismissed. ### Example ```dart await showPlatformAcknowledge( context: context, title: 'Success', content: 'Operation completed successfully', okText: 'OK', ); ``` ``` -------------------------------- ### Show Platform Acknowledge Dialog Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/dialog-widgets.md Use this function to display a simple alert dialog with an OK button. It wraps a more general dialog function with pre-configured OK action. Ensure a BuildContext is available. ```dart await showPlatformAcknowledge( context: context, title: 'Success', content: 'Operation completed successfully', okText: 'OK', ); ``` -------------------------------- ### CupertinoNavigationBarData Configuration Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/data-classes.md Configure Cupertino-only settings for PlatformAppBar. Includes background color, border, and text styles. ```dart final class CupertinoNavigationBarData { final Color? backgroundColor; final Color? border; final bool transitionBetweenRoutes; final TextStyle? middleTextStyle; final bool noMiddle; } ``` -------------------------------- ### CupertinoAppData Configuration Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/types.md Defines Cupertino-specific configuration for PlatformApp. Includes Cupertino theme data. ```dart final class CupertinoAppData { final CupertinoThemeData? theme; const CupertinoAppData({this.theme}); } ``` -------------------------------- ### Platform Switches and Checkboxes Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/EXAMPLES.md Demonstrates how to use PlatformSwitch for boolean toggles in a settings interface. The state is managed using StatefulWidget and setState. ```dart class SettingsToggle extends StatefulWidget { @override State createState() => _SettingsToggleState(); } class _SettingsToggleState extends State { bool _notificationsEnabled = true; bool _darkModeEnabled = false; @override Widget build(BuildContext context) => Column( children: [ PlatformListTile( title: const Text('Enable Notifications'), trailing: PlatformSwitch( value: _notificationsEnabled, onChanged: (value) { setState(() => _notificationsEnabled = value); }, ), ), PlatformListTile( title: const Text('Dark Mode'), trailing: PlatformSwitch( value: _darkModeEnabled, onChanged: (value) { setState(() => _darkModeEnabled = value); }, ), ), ], ); } ``` -------------------------------- ### MaterialAppData Configuration Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/types.md Provides Material Design specific configurations for PlatformApp. Includes keys for scaffold messenger, theme data for various modes, and animation settings. ```dart final class MaterialAppData { final GlobalKey? scaffoldMessengerKey; final ThemeData? theme; final ThemeData? darkTheme; final ThemeData? highContrastTheme; final ThemeData? highContrastDarkTheme; final ThemeMode? themeMode; final Duration themeAnimationDuration; final Curve themeAnimationCurve; final bool debugShowMaterialGrid; final AnimationStyle? themeAnimationStyle; const MaterialAppData({ this.scaffoldMessengerKey, this.theme, this.darkTheme, this.highContrastTheme, this.highContrastDarkTheme, this.themeMode, this.themeAnimationDuration = kMaterialDefaultThemeAnimationDuration, this.themeAnimationCurve = kMaterialDefaultThemeAnimationCurve, this.debugShowMaterialGrid = false, this.themeAnimationStyle, }); } ``` -------------------------------- ### PlatformApp Default Constructor Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/configuration.md Configure a standard application with this constructor. It allows setting the title, locale, supported locales, performance overlays, and debugging flags. It also supports custom builders and navigation observers. ```dart const PlatformApp({ String? title, GenerateAppTitle? onGenerateTitle, Color? color, Locale? locale, Iterable>? localizationsDelegates, LocaleListResolutionCallback? localeListResolutionCallback, LocaleResolutionCallback? localeResolutionCallback, Iterable supportedLocales = kDefaultSupportedLocales, bool showPerformanceOverlay = kDefaultShowPerformanceOverlay, bool checkerboardRasterCacheImages = kDefaultCheckerboardRasterCacheImages, bool checkerboardOffscreenLayers = kDefaultCheckerboardOffscreenLayers, bool showSemanticsDebugger = kDefaultShowSemanticsDebugger, bool debugShowCheckedModeBanner = kDefaultDebugShowCheckedModeBanner, Map? shortcuts, Map>? actions, String? restorationScopeId, ScrollBehavior? scrollBehavior, TransitionBuilder? builder, bool Function(NavigationNotification)? onNavigationNotification, GlobalKey? navigatorKey, Widget? home, Map routes = const {}, String? initialRoute, RouteFactory? onGenerateRoute, List> Function(String)? onGenerateInitialRoutes, RouteFactory? onUnknownRoute, List navigatorObservers = const [], MaterialAppData? materialAppData, CupertinoAppData? cupertinoAppData, Key? widgetKey, Key? key, }) ``` -------------------------------- ### Show Platform Date Picker Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/dialog-widgets.md Displays a date picker dialog that adapts to the platform (Material on Android, Cupertino on iOS). Requires context, firstDate, and lastDate. The initialDate and selectableDayPredicate can be used for customization. ```dart final picked = await showPlatformDatePicker( context: context, firstDate: const Date(year: 2020), lastDate: Date.now().add(const Duration(days: 365)), initialDate: Date.now(), ); ``` -------------------------------- ### CupertinoAppData Configuration Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/data-classes.md Configure Cupertino-only settings for PlatformApp and PlatformApp.router. Primarily used for theme data. ```dart final class CupertinoAppData { final CupertinoThemeData? theme; const CupertinoAppData({this.theme}); } ``` -------------------------------- ### MaterialCheckboxData Configuration Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/types.md Provides Material Design specific configurations for PlatformCheckbox. Includes mouse cursor, fill color, tap target size, and visual density. ```dart final class MaterialCheckboxData { final MouseCursor? mouseCursor; final Color? fillColor; final MaterialTapTargetSize? materialTapTargetSize; final VisualDensity? visualDensity; // ... additional fields } ``` -------------------------------- ### Simple List Widget Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/EXAMPLES.md A basic list view using PlatformListTile. Suitable for displaying a static list of items. ```dart class ItemList extends StatelessWidget { final List items = ['Item 1', 'Item 2', 'Item 3']; @override Widget build(BuildContext context) => PlatformScaffold( appBarData: const PlatformAppBar(title: Text('Items')), body: ListView.builder( itemCount: items.length, itemBuilder: (context, index) => PlatformListTile( title: Text(items[index]), trailing: const Icon(Icons.arrow_forward), onTap: () { // Handle item tap }, ), ), ); } ``` -------------------------------- ### MaterialScaffoldData Configuration Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/data-classes.md Configure Material-only settings for PlatformScaffold. Covers visual, content, drawer, and bottom sheet configurations. ```dart final class MaterialScaffoldData { // Visual final Color? backgroundColor; final ShapeBorder? shape; // Content final PreferredSizeWidget? appBar; final Widget? floatingActionButton; final FloatingActionButtonLocation? floatingActionButtonLocation; final FloatingActionButtonAnimator? floatingActionButtonAnimator; final List? persistentFooterButtons; final AlignmentGeometry persistentFooterAlignment; final Widget? persistentFooterDecoration; // Drawers final Widget? drawer; final VoidCallback? onDrawerChanged; final Widget? endDrawer; final VoidCallback? onEndDrawerChanged; final DragStartBehavior drawerDragStartBehavior; final bool drawerBarrierDismissible; final bool drawerEnableOpenDragGesture; final bool endDrawerEnableOpenDragGesture; // Bottom sheets final Widget? bottomSheet; final WidgetBuilder? bottomSheetScrimBuilder; final Widget? bottomNavigationBar; final bool primary; final bool extendBody; final bool extendBodyBehindAppBar; } ``` -------------------------------- ### Material Date Picker Configuration Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/types.md Provides Material Design specific settings for date pickers, including initial entry mode and text for help, cancel, and confirm actions. ```dart final class MaterialDatePickerData { final DateTime? currentDate; final DatePickerEntryMode initialEntryMode; final String? helpText; final String? cancelText; final String? confirmText; // ... additional fields } ``` -------------------------------- ### Platform-Specific Button Rendering Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/START_HERE.md Demonstrates how a single widget declaration renders as Material on Android and Cupertino on iOS without explicit platform checks. ```dart PlatformButton(onPressed: () {}, child: const Text('Tap')) ``` -------------------------------- ### showPlatformTimePicker Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/dialog-widgets.md Shows a platform-adaptive time picker dialog, rendering Material's time picker on Android and Cupertino's time picker on iOS. ```APIDOC ## showPlatformTimePicker ### Description Shows a time picker dialog. On Android, renders Material's [showTimePicker]. On iOS, renders [CupertinoDatePicker] in time mode within a [showCupertinoModalPopup]. ### Signature ```dart Future showPlatformTimePicker({ required BuildContext context, TimeOfDay? initialTime, Offset? anchorPoint, Color? barrierColor, bool? barrierDismissible, RouteSettings? routeSettings, bool useRootNavigator = true, bool? requestFocus, TransitionBuilder? builder, MaterialTimePickerData? materialTimePickerData, CupertinoDatePickerData? cupertinoDatePickerData, }); ``` ### Parameters #### Path Parameters - **context** (BuildContext) - Required - The build context #### Query Parameters - **initialTime** (TimeOfDay?) - Optional - The initially selected time - **anchorPoint** (Offset?) - Optional - The anchor point for the picker - **barrierColor** (Color?) - Optional - Color of the modal barrier - **barrierDismissible** (bool?) - Optional - Whether tapping barrier dismisses - **routeSettings** (RouteSettings?) - Optional - Route settings for the dialog - **useRootNavigator** (bool) - Optional - Whether to use the root navigator (Default: true) - **requestFocus** (bool?) - Optional - Whether to request focus - **builder** (TransitionBuilder?) - Optional - Builder for the Material picker - **materialTimePickerData** (MaterialTimePickerData?) - Optional - Material-specific configuration - **cupertinoDatePickerData** (CupertinoDatePickerData?) - Optional - Cupertino-specific configuration ### Returns A `Future` that resolves to the selected time or null if cancelled. ``` -------------------------------- ### PlatformExpansionTile Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/interaction-widgets.md A platform-adaptive expansion tile widget. It allows content to be expanded or collapsed, rendering Material Design ExpansionTile on Android and Cupertino ExpansionTile on iOS. ```APIDOC ## PlatformExpansionTile ### Description A platform-adaptive expansion tile that renders Material [ExpansionTile] on Android and Cupertino [CupertinoExpansionTile] on iOS. ### Signature ```dart class PlatformExpansionTile extends PlatformWidgetBase { final Widget title; final List children; // ... additional parameters } ``` ``` -------------------------------- ### MaterialProgressIndicatorData Configuration Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/data-classes.md Defines Material-specific settings for PlatformProgressIndicator. Use this for Material Design progress indicators. ```dart final class MaterialProgressIndicatorData { final Color? valueColor; final Color? backgroundColor; final AlwaysStoppedAnimation? valueColorAnimation; final double minHeight; final String? semanticsLabel; final String? semanticsValue; final Animation? valueColorTween; final bool isIndeterminate; final Color? trackColor; } ``` -------------------------------- ### MaterialAppData Configuration Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/data-classes.md Configure Material-only settings for PlatformApp and PlatformApp.router. Includes theme, animation, and debugging options. ```dart final class MaterialAppData { final GlobalKey? scaffoldMessengerKey; final ThemeData? theme; final ThemeData? darkTheme; final ThemeData? highContrastTheme; final ThemeData? highContrastDarkTheme; final ThemeMode? themeMode; final Duration themeAnimationDuration; final Curve themeAnimationCurve; final bool debugShowMaterialGrid; final AnimationStyle? themeAnimationStyle; const MaterialAppData({ this.scaffoldMessengerKey, this.theme, this.darkTheme, this.highContrastTheme, this.highContrastDarkTheme, this.themeMode, this.themeAnimationDuration = kMaterialDefaultThemeAnimationDuration, this.themeAnimationCurve = kMaterialDefaultThemeAnimationCurve, this.debugShowMaterialGrid = false, this.themeAnimationStyle, }); } ``` -------------------------------- ### Specific Widget Imports Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/INDEX.md Illustrates importing specific widgets and utilities from the platform_adaptive_widgets package. All listed items are explicitly exported from the main package file. ```dart // All explicitly exported in platform_adaptive_widgets.dart import 'package:platform_adaptive_widgets/platform_adaptive_widgets.dart'; // Then use: // - PlatformApp, PlatformAppBar, PlatformScaffold // - PlatformButton, PlatformSwitch, PlatformRadio, etc. // - showPlatformDialog, showPlatformDatePicker, etc. // - platformValue, platformLazyValue, etc. // - Date, PlatformTheme, etc. ``` -------------------------------- ### CupertinoProgressIndicatorData Configuration Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/data-classes.md Defines Cupertino-specific settings for PlatformProgressIndicator. Use this for iOS-style progress indicators. ```dart final class CupertinoProgressIndicatorData { final double radius; final Color? color; final bool animating; } ``` -------------------------------- ### showPlatformDatePicker Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/dialog-widgets.md Shows a platform-adaptive date picker dialog, rendering Material's date picker on Android and Cupertino's date picker on iOS. ```APIDOC ## showPlatformDatePicker ### Description Shows a date picker dialog. On Android, renders Material's [showDatePicker]. On iOS, renders [CupertinoDatePicker] in date mode within a [showCupertinoModalPopup]. ### Signature ```dart Future showPlatformDatePicker({ required BuildContext context, required Date firstDate, required Date lastDate, Date? initialDate, Offset? anchorPoint, Color? barrierColor, bool? barrierDismissible, RouteSettings? routeSettings, bool useRootNavigator = true, bool? requestFocus, SelectableDayPredicate? selectableDayPredicate, TransitionBuilder? builder, MaterialDatePickerData? materialDatePickerData, CupertinoDatePickerData? cupertinoDatePickerData, }); ``` ### Parameters #### Path Parameters - **context** (BuildContext) - Required - The build context - **firstDate** (Date) - Required - The earliest selectable date - **lastDate** (Date) - Required - The latest selectable date #### Query Parameters - **initialDate** (Date?) - Optional - The initially selected date - **anchorPoint** (Offset?) - Optional - The anchor point for the picker - **barrierColor** (Color?) - Optional - Color of the modal barrier - **barrierDismissible** (bool?) - Optional - Whether tapping barrier dismisses - **routeSettings** (RouteSettings?) - Optional - Route settings for the dialog - **useRootNavigator** (bool) - Optional - Whether to use the root navigator (Default: true) - **requestFocus** (bool?) - Optional - Whether to request focus - **selectableDayPredicate** (SelectableDayPredicate?) - Optional - Predicate to filter selectable days - **builder** (TransitionBuilder?) - Optional - Builder for the Material picker - **materialDatePickerData** (MaterialDatePickerData?) - Optional - Material-specific configuration - **cupertinoDatePickerData** (CupertinoDatePickerData?) - Optional - Cupertino-specific configuration ### Returns A `Future` that resolves to the selected date or null if cancelled. ### Example ```dart final picked = await showPlatformDatePicker( context: context, firstDate: const Date(year: 2020), lastDate: Date.now().add(const Duration(days: 365)), initialDate: Date.now(), ); ``` ``` -------------------------------- ### PlatformAppBar Constructor Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/configuration.md Use this constructor to define an app bar. It accepts a title widget, a list of action widgets, and a leading widget. Options for automatically implying leading, background color, and platform-specific data are available. ```dart const PlatformAppBar({ Widget? title, List? actions, Widget? leading, bool automaticallyImplyLeading = true, Color? backgroundColor, MaterialAppBarData? materialAppBarData, CupertinoNavigationBarData? cupertinoNavigationBarData, Key? key, }) ``` -------------------------------- ### showPlatformDialog Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/dialog-widgets.md Shows a centered modal dialog with platform-specific surface wrapping. It can be used for general-purpose dialogs and supports custom builders for Material and Cupertino. ```APIDOC ## showPlatformDialog ### Description Shows a centered modal dialog. On Android, the content is wrapped in Material's [Dialog] via [showDialog]. On iOS, the content is centered in a [CupertinoPopupSurface] via [showCupertinoDialog]. The barrier is not tap-to-dismiss by default on iOS (`barrierDismissible: false`), matching iOS HIG. Provide a button in the dialog content to dismiss, or set `barrierDismissible: true` to enable tap-outside dismissal. ### Method Future ### Parameters #### Path Parameters - **context** (BuildContext) - Required - The build context for showing the dialog #### Query Parameters - **builder** (WidgetBuilder?) - Optional - Shared content builder for both platforms - **materialBuilder** (WidgetBuilder?) - Optional - Material-specific content builder (used if builder is null) - **cupertinoBuilder** (WidgetBuilder?) - Optional - Cupertino-specific content builder (used if builder is null) - **anchorPoint** (Offset?) - Optional - - **barrierColor** (Color?) - Optional - Color of the modal barrier - **barrierDismissible** (bool?) - Optional - Whether tapping barrier dismisses dialog - **barrierLabel** (String?) - Optional - Semantic label for the barrier - **routeSettings** (RouteSettings?) - Optional - Route settings for the dialog - **useRootNavigator** (bool) - Required - Whether to use the root navigator - **requestFocus** (bool?) - Optional - Whether to request focus for the dialog - **materialDialogData** (MaterialDialogData?) - Optional - Material-specific configuration ### Response #### Success Response - **T?** - Resolves to the dialog's result value or null if dismissed. ### Request Example ```dart final result = await showPlatformDialog( context: context, builder: (context) => Padding( padding: const EdgeInsets.all(16), child: Column(mainAxisSize: MainAxisSize.min, children: [ const Text('Confirm action?'), const SizedBox(height: 16), Row(children: [ TextButton( onPressed: () => Navigator.maybeOf(context)?.pop(null), child: const Text('Cancel'), ), TextButton( onPressed: () => Navigator.maybeOf(context)?.pop('confirmed'), child: const Text('Confirm'), ), ]), ]), ), ); ``` ``` -------------------------------- ### Flat Parameters and Optional Data Classes Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/START_HERE.md Illustrates the use of flat parameters for shared properties and optional data classes for platform-specific customization in widgets. ```dart PlatformButton( onPressed: () {}, // ← flat (shared) child: const Text('Press'), materialButtonVariant: .filled, // ← flat (both platforms) cupertinoButtonData: CupertinoButtonData( pressedOpacity: 0.5, // ← optional (Cupertino only) ), ) ``` -------------------------------- ### PlatformAppBar Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/layout-widgets.md A platform-adaptive app bar that acts as the header of a PlatformScaffold. It supports common properties like title, actions, and leading widgets, with platform-specific overrides available. ```APIDOC ## PlatformAppBar ### Description A platform-adaptive app bar that acts as the header of a `PlatformScaffold`. The `backgroundColor` field is shared-visual (can be overridden per platform). Shared functional properties like `title`, `actions`, and `leading` live flat on the widget. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **title** (Widget?) - Optional - Title widget displayed in the app bar - **actions** (List?) - Optional - Actions displayed on the right side - **leading** (Widget?) - Optional - Leading widget on the left side - **automaticallyImplyLeading** (bool) - Optional - Default: true - Whether to imply a leading widget if none provided - **backgroundColor** (Color?) - Optional - Background color of the app bar - **materialAppBarData** (MaterialAppBarData?) - Optional - Material-specific overrides - **cupertinoNavigationBarData** (CupertinoNavigationBarData?) - Optional - Cupertino-specific overrides - **key** (Key?) - Optional - Widget key ### Request Example ```dart PlatformAppBar( title: const Text('My App'), leading: const BackButton(), actions: [ IconButton(icon: const Icon(Icons.settings), onPressed: () {}), ], ) ``` ### Response #### Success Response (200) Not applicable for widget documentation. #### Response Example Not applicable for widget documentation. ``` -------------------------------- ### Platform Button Usage Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/INDEX.md Demonstrates the basic usage of a PlatformButton without needing explicit platform checks. The widget handles native rendering on both Android and iOS. ```dart PlatformButton(onPressed: _doThing, child: const Text('Tap')) ``` -------------------------------- ### PlatformScaffold Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/layout-widgets.md A platform-adaptive scaffold that renders Material Scaffold on Android and CupertinoPageScaffold on iOS. It provides the basic layout structure for an application screen. ```APIDOC ## PlatformScaffold ### Description A platform-adaptive scaffold providing the basic layout structure. The `appBarData` field typically contains a `PlatformAppBar`. Shared properties like `body` and `resizeToAvoidBottomInset` live flat; platform-specific surfaces are provided via data classes. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **body** (Widget) - Required - Main content of the scaffold - **appBarData** (PlatformAppBarData?) - Optional - App bar configuration (typically PlatformAppBar) - **backgroundColor** (Color?) - Optional - Background color of the scaffold - **resizeToAvoidBottomInset** (bool) - Optional - Default: true - Whether scaffold resizes for bottom insets - **materialScaffoldData** (MaterialScaffoldData?) - Optional - Material-specific configuration - **cupertinoScaffoldData** (CupertinoScaffoldData?) - Optional - Cupertino-specific configuration - **widgetKey** (Key?) - Optional - Key for the underlying platform widget - **key** (Key?) - Optional - Widget key ### Request Example ```dart PlatformScaffold( appBarData: const PlatformAppBar(title: Text('My App')), body: const Center(child: Text('Hello World')), ) ``` ### Response #### Success Response (200) Not applicable for widget documentation. #### Response Example Not applicable for widget documentation. ``` -------------------------------- ### MaterialAppBarData Configuration Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/data-classes.md Configure Material-only settings for PlatformAppBar. Includes elevation, shape, colors, and title alignment. ```dart final class MaterialAppBarData { final PreferredSizeWidget? appBar; final PreferredSizeWidget? bottom; final double? elevation; final double? scrolledUnderElevation; final ShapeBorder? shape; final IconThemeData? iconTheme; final IconThemeData? actionsIconTheme; final bool primary; final bool forceMaterialTransparency; final Color? shadowColor; final Color? surfaceTintColor; final TextStyle? toolbarTextStyle; final TextStyle? titleTextStyle; final SystemUiOverlayStyle? systemOverlayStyle; final bool centerTitle; final double toolbarHeight; final double? leadingWidth; final bool excludeHeaderSemantics; final PreferredSizeWidget? flexibleSpace; } ``` -------------------------------- ### CupertinoAppData Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/data-classes.md Cupertino-only configuration for PlatformApp and PlatformApp.router. It allows customization of the theme specific to Cupertino Design. ```APIDOC ## CupertinoAppData ### Description Cupertino-only configuration for `PlatformApp` and `PlatformApp.router`. It allows customization of the theme specific to Cupertino Design. ### Fields - **theme** (CupertinoThemeData?) ``` -------------------------------- ### MaterialAppBarData Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/data-classes.md Material-only configuration for PlatformAppBar. This class allows detailed customization of the Material Design app bar. ```APIDOC ## MaterialAppBarData ### Description Material-only configuration for `PlatformAppBar`. This class allows detailed customization of the Material Design app bar. ### Fields - **appBar** (PreferredSizeWidget?) - **bottom** (PreferredSizeWidget?) - **elevation** (double?) - **scrolledUnderElevation** (double?) - **shape** (ShapeBorder?) - **iconTheme** (IconThemeData?) - **actionsIconTheme** (IconThemeData?) - **primary** (bool) - **forceMaterialTransparency** (bool) - **shadowColor** (Color?) - **surfaceTintColor** (Color?) - **toolbarTextStyle** (TextStyle?) - **titleTextStyle** (TextStyle?) - **systemOverlayStyle** (SystemUiOverlayStyle?) - **centerTitle** (bool) - **toolbarHeight** (double) - **leadingWidth** (double?) - **excludeHeaderSemantics** (bool) - **flexibleSpace** (PreferredSizeWidget?) ``` -------------------------------- ### CupertinoToastData Configuration Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/data-classes.md Defines Cupertino-specific settings for showPlatformToast. Use this for iOS-style toasts. ```dart final class CupertinoToastData { final Color? backgroundColor; final Color? textColor; final Alignment alignment; final EdgeInsetsGeometry margin; final Duration duration; } ``` -------------------------------- ### CupertinoSwitchData Configuration Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/types.md Defines Cupertino-specific styling for PlatformSwitch. Includes active color, track color, and thumb color. ```dart final class CupertinoSwitchData { final Color? activeColor; final Color? trackColor; final Color? thumbColor; // ... additional fields } ``` -------------------------------- ### PlatformAppBar Constructor Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/layout-widgets.md Defines the signature for the PlatformAppBar widget, used as a header in PlatformScaffold. It accepts properties for title, actions, leading widget, and platform-specific data. ```dart class PlatformAppBar extends PlatformWidgetBase { final Widget? title; final List? actions; final Widget? leading; final bool automaticallyImplyLeading; final Color? backgroundColor; final MaterialAppBarData? materialAppBarData; final CupertinoNavigationBarData? cupertinoNavigationBarData; const PlatformAppBar({ this.title, this.actions, this.leading, this.automaticallyImplyLeading = true, this.backgroundColor, this.materialAppBarData, this.cupertinoNavigationBarData, super.key, }); } ``` -------------------------------- ### PlatformRadioGroupBuilder Source: https://github.com/lahaluhem/platform_adaptive_widgets/blob/master/_autodocs/api-reference/interaction-widgets.md A convenience widget for building a radio group with platform-adaptive rendering. It simplifies the creation of a group of radio buttons that adapt to the platform's design. ```APIDOC ## PlatformRadioGroupBuilder ### Description A convenience widget that builds a radio group with platform-adaptive rendering. Renders a group of radio buttons wrapped in a `Wrap` on both platforms, with platform-specific styling applied. ### Signature ```dart class PlatformRadioGroupBuilder extends PlatformWidgetBase { final List items; final T? groupValue; final ValueChanged onChanged; final Widget Function(T) labelBuilder; // ... additional parameters } ``` ```