### Complex Responsive Layout Example Source: https://pub.dev/documentation/universal_breakpoints/latest/index.html Demonstrates how to build a complex responsive layout using Universal Breakpoints. ```APIDOC ## Complex Responsive Layout Example ### Description This example showcases how to create a responsive layout that adapts its padding, text size, grid count, and item height based on the screen size. ### Code ```dart class ComplexResponsiveLayout extends StatelessWidget { @override Widget build(BuildContext context) { return SingleChildScrollView( child: Padding( padding: EdgeInsets.all(context.isMobile ? 16.0 : 32.0), // Responsive padding child: Column( children: [ Text( 'Welcome', style: TextStyle( fontSize: context.isMobile ? 24.sF : 32.sF, // Responsive font size fontWeight: FontWeight.bold, ), ), SizedBox(height: 20.sH), // Scaled vertical spacing GridView.count( crossAxisCount: context.responsiveValue( mobile: 1, tablet: 2, desktop: 3, ), // Responsive grid columns mainAxisSpacing: 16.sH, // Scaled spacing crossAxisSpacing: 16.sW, // Scaled spacing children: List.generate(9, (index) { return Container( width: double.infinity, height: context.isMobile ? 150.sH : 200.sH, // Responsive item height decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), color: Colors.blue[100], ), ); }), ), ], ), ), ); } } ``` ``` -------------------------------- ### Usage of responsiveValue Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/responsiveValue.html Example showing how to provide different values for mobile, tablet, and desktop breakpoints. ```dart int columns = context.responsiveValue( mobile: 1, tablet: 2, desktop: 4, ); ``` -------------------------------- ### GridColumnConfig Example Source: https://pub.dev/documentation/universal_breakpoints/latest/index.html Defines the number of columns for various device sizes, from ultra-compact to ultra-wide. ```dart GridColumnConfig( ultraCompact: 1, compact: 1, standard: 2, largePhone: 2, phablet: 2, smallTablet: 3, largeTablet: 3, smallDesktop: 4, standardDesktop: 5, largeDesktop: 6, ultraWide: 8, ) ``` -------------------------------- ### Adaptive Navigation Example Source: https://pub.dev/packages/universal_breakpoints Shows how to implement adaptive navigation patterns for mobile (BottomNavigationBar), tablet (NavigationRail), and desktop (SideNavigation). ```dart class AdaptiveNavigation extends StatelessWidget { @override Widget build(BuildContext context) { if (context.isMobile) { return BottomNavigationBar( items: const [ BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'), BottomNavigationBarItem(icon: Icon(Icons.search), label: 'Search'), BottomNavigationBarItem(icon: Icon(Icons.person), label: 'Profile'), ], ); } else if (context.isTablet) { return Row( children: [ NavigationRail(destinations: [...]), Expanded(child: Content()), ], ); } else { return Row( children: [ SideNavigation(), Expanded(child: Content()), ], ); } } } ``` -------------------------------- ### GET isDesktop Property Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/UniversalBreakpoints/isDesktop.html Retrieves the desktop status of the current device based on screen width. ```APIDOC ## GET isDesktop ### Description Returns a boolean value indicating whether the current device is classified as a desktop. A desktop is defined as having a screen width of 1280px or greater. ### Method GET ### Endpoint isDesktop ### Response #### Success Response (200) - **isDesktop** (bool) - Returns true if the device width is 1280px or greater, otherwise false. ``` -------------------------------- ### Real-World ProductGrid Example Source: https://pub.dev/packages/universal_breakpoints A practical implementation of DynamicGrid within a StatelessWidget to display a list of products. Demonstrates custom column and spacing configurations, item aspect ratio, and animations. ```dart class ProductGrid extends StatelessWidget { @override Widget build(BuildContext context) { return DynamicGrid( items: products, itemBuilder: (context, product, index) { return ProductCard(product: product); }, columnConfig: GridColumnConfig( mobile: 1, largeMobile: 2, tablet: 3, desktop: 4, largeDesktop: 6, ), spacingConfig: GridSpacingConfig( mobile: 8, tablet: 12, desktop: 16, defaultSpacing: 12, ), itemAspectRatio: 0.75, padding: EdgeInsets.all(16.0), enableAnimations: true, ); } } ``` -------------------------------- ### GET isTallAspect Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/UniversalBreakpoints/isTallAspect.html Retrieves the aspect ratio status of the screen. ```APIDOC ## GET isTallAspect ### Description Returns a boolean value indicating if the screen has a tall aspect ratio, defined as less than 1.3. ### Method GET ### Endpoint isTallAspect ### Response #### Success Response (200) - **isTallAspect** (bool) - Returns true if the screen aspect ratio is less than 1.3, otherwise false. ``` -------------------------------- ### MasonryDynamicGrid Widget Example Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/MasonryDynamicGrid-class.html Use this widget to create a masonry-style responsive grid. Configure the number of columns for different screen sizes and provide a builder for individual items. ```dart MasonryDynamicGrid( items: List.generate(20, (i) => i), columnConfig: GridColumnConfig( mobile: 2, tablet: 3, desktop: 4, ), itemBuilder: (context, item, index) { return Card(child: Center(child: Text('$item'))); }, ) ``` -------------------------------- ### Complex Responsive Layout Example Source: https://pub.dev/packages/universal_breakpoints Demonstrates a responsive layout that adjusts padding, font sizes, and grid columns based on screen size (mobile, tablet, desktop). ```dart class ComplexResponsiveLayout extends StatelessWidget { @override Widget build(BuildContext context) { return SingleChildScrollView( child: Padding( padding: EdgeInsets.all(context.isMobile ? 16.0 : 32.0), child: Column( children: [ Text( 'Welcome', style: TextStyle( fontSize: context.isMobile ? 24.sF : 32.sF, fontWeight: FontWeight.bold, ), ), SizedBox(height: 20.sH), GridView.count( crossAxisCount: context.responsiveValue( mobile: 1, tablet: 2, desktop: 3, ), mainAxisSpacing: 16.sH, crossAxisSpacing: 16.sW, children: List.generate(9, (index) { return Container( width: double.infinity, height: context.isMobile ? 150.sH : 200.sH, decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), color: Colors.blue[100], ), ); }), ), ], ), ), ); } } ``` -------------------------------- ### GET isDesktop property Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/isDesktop.html Retrieves the boolean status indicating if the current viewport is considered a desktop size. ```APIDOC ## GET isDesktop ### Description A getter property that returns a boolean value indicating whether the current device environment is classified as a desktop based on UniversalBreakpoints. ### Method GET ### Endpoint isDesktop ### Response #### Success Response (200) - **isDesktop** (bool) - Returns true if the current viewport matches desktop breakpoints, otherwise false. ``` -------------------------------- ### GET isFullHD Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/isFullHD.html Retrieves the current screen size category to determine if it matches full HD. ```APIDOC ## GET isFullHD ### Description Returns a boolean value indicating whether the current screen size category is classified as fullHD. ### Method GET ### Endpoint isFullHD ### Response #### Success Response (200) - **isFullHD** (bool) - Returns true if the screen size category is fullHD, otherwise false. ``` -------------------------------- ### GET screenCategory Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/screenCategory.html Retrieves the current main screen size category based on the device's MediaQuery. ```APIDOC ## GET screenCategory ### Description Returns the current main screen size category for the application. ### Method GET ### Endpoint screenCategory ### Response - **ScreenSizeCategory** (enum) - The current category representing the screen size. ``` -------------------------------- ### Initialize UniversalBreakpoints in main app Source: https://pub.dev/packages/universal_breakpoints Initialize UniversalBreakpoints in your main application widget. This setup is required for the package to function correctly. ```dart import 'package:universal_breakpoints/universal_breakpoints.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { UniversalBreakpoints().init(context); return MaterialApp( title: 'My App', home: const MyHome(), ); } } ``` -------------------------------- ### GET isLargeDesktop Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/isLargeDesktop.html Retrieves the boolean status indicating if the current screen size is classified as a large desktop. ```APIDOC ## GET isLargeDesktop ### Description Returns a boolean value indicating whether the current screen size category is 'largeDesktop' based on the UniversalBreakpoints configuration. ### Method GET ### Endpoint isLargeDesktop ### Response #### Success Response (200) - **isLargeDesktop** (bool) - Returns true if the screen size sub-category is largeDesktop, otherwise false. ``` -------------------------------- ### GET isSmallDesktop Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/isSmallDesktop.html Retrieves a boolean value indicating whether the current device screen size is classified as a small desktop. ```APIDOC ## GET isSmallDesktop ### Description Returns a boolean value indicating if the current screen size category is smallDesktop. ### Method GET ### Endpoint isSmallDesktop ### Response #### Success Response (200) - **isSmallDesktop** (bool) - Returns true if the screen size category is smallDesktop, otherwise false. ``` -------------------------------- ### Basic AnimatedDynamicGrid Usage Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/AnimatedDynamicGrid-class.html Demonstrates how to use the AnimatedDynamicGrid widget to display a list of items with a custom container as the item builder. This is a basic setup for a responsive grid. ```dart AnimatedDynamicGrid( items: List.generate(12, (i) => i), itemBuilder: (context, item, index) { return Container(color: Colors.blue); }, ) ``` -------------------------------- ### Screen Type Property Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/UniversalBreakpoints/screenType.html Details about the screenType property, including its type, getter/setter availability, and example values. ```APIDOC ## Screen Type Property ### Description Represents the current screen type as a string. This property is a getter/setter pair. ### Type String ### Example Values 'mobile', 'tablet', 'desktop' ### Implementation ```dart late String screenType; ``` ``` -------------------------------- ### Get isXXXL Property Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/isXXXL.html Use this getter to determine if the screen size is considered XXXL. It requires a `BuildContext` to access `MediaQuery`. ```dart bool get isXXXL { MediaQuery.of(this); return UniversalBreakpoints().isXXXL; } ``` -------------------------------- ### Get Singleton Instance of UniversalBreakpoints Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/UniversalBreakpoints/UniversalBreakpoints.html Use this factory constructor to retrieve the single instance of UniversalBreakpoints. No setup is required. ```dart factory UniversalBreakpoints() => _instance; ``` -------------------------------- ### void init(BuildContext context) Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/UniversalBreakpoints/init.html Initializes screen configuration based on current device metrics. This method must be called once in the main app widget, typically within the build method or main function. ```APIDOC ## void init(BuildContext context) ### Description Initializes screen configuration based on current device metrics. Must be called once in your main app widget, typically in the build method of your root widget or in main(). ### Parameters #### Path Parameters - **context** (BuildContext) - Required - The current build context used to retrieve MediaQuery data. ### Request Example ```dart @override Widget build(BuildContext context) { UniversalBreakpoints().init(context); // Rest of your build } ``` ``` -------------------------------- ### Get isLargeDesktop Property Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/isLargeDesktop.html This getter checks the current screen size against the large desktop category. It requires MediaQuery to be available in the context. ```dart bool get isLargeDesktop { MediaQuery.of(this); return UniversalBreakpoints().screenSizeSubCategory == ScreenSizeSubCategory.largeDesktop; } ``` -------------------------------- ### Get Screen Size Sub-Category Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/screenSubCategory.html This snippet shows how to get the current ultra-granular screen size sub-category. ```APIDOC ## Get screenSubCategory ### Description Returns the current ultra-granular screen size sub-category. ### Method GET ### Endpoint `/screenSubCategory` ### Parameters #### Query Parameters - **context** (BuildContext) - Required - The build context to query the screen size from. ### Response #### Success Response (200) - **screenSubCategory** (ScreenSizeSubCategory) - The current ultra-granular screen size sub-category. ### Request Example ```dart // Assuming you have a BuildContext available ScreenSizeSubCategory subCategory = UniversalBreakpoints().screenSizeSubCategory; ``` ### Response Example ```json { "screenSubCategory": "tablet" } ``` ``` -------------------------------- ### GET isStandardDesktop Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/isStandardDesktop.html Retrieves a boolean value indicating whether the current device screen size is classified as a standard desktop. ```APIDOC ## GET isStandardDesktop ### Description Returns a boolean value indicating if the current screen size sub-category is identified as 'standardDesktop'. ### Method GET ### Endpoint isStandardDesktop ### Response #### Success Response (200) - **isStandardDesktop** (bool) - Returns true if the screen size is standard desktop, otherwise false. ``` -------------------------------- ### Get isPortrait Property Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/isPortrait.html Use this getter to determine if the current screen orientation is portrait. It relies on MediaQuery to get the context. ```dart bool get isPortrait { MediaQuery.of(this); return UniversalBreakpoints().isPortrait; } ``` -------------------------------- ### Get UniversalBreakpoints Size Configuration Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/sizeConfig.html Retrieves the singleton instance of UniversalBreakpoints. This instance is used to access and manage size configurations. ```APIDOC ## GET /sizeConfig ### Description Returns the singleton instance of UniversalBreakpoints. ### Method GET ### Endpoint /sizeConfig ### Parameters None ### Request Body None ### Request Example None ### Response #### Success Response (200) - **UniversalBreakpoints** (object) - The singleton instance of UniversalBreakpoints. #### Response Example ```json { "instance": "UniversalBreakpoints" } ``` ``` -------------------------------- ### Product Grid with Responsive Layout Source: https://pub.dev/documentation/universal_breakpoints/latest/index.html Demonstrates creating a responsive product grid using DynamicGrid, configuring columns and spacing for different screen sizes. Ensure products are defined and ProductCard widget is available. ```dart class ProductGrid extends StatelessWidget { @override Widget build(BuildContext context) { return DynamicGrid( items: products, itemBuilder: (context, product, index) { return ProductCard(product: product); }, columnConfig: GridColumnConfig( mobile: 1, largeMobile: 2, tablet: 3, desktop: 4, largeDesktop: 6, ), spacingConfig: GridSpacingConfig( mobile: 8, tablet: 12, desktop: 16, defaultSpacing: 12, ), itemAspectRatio: 0.75, padding: EdgeInsets.all(16.0), enableAnimations: true, ); } } ``` -------------------------------- ### Get isUltraWideAspect Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/UniversalBreakpoints/isUltraWideAspect.html Returns true if the screen has an ultra-wide aspect ratio (> 2.0). ```dart bool get isUltraWideAspect => aspectRatio > 2.0; ``` -------------------------------- ### GET isMobile Property Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/isMobile.html Retrieves the mobile status of the current device environment. ```APIDOC ## GET isMobile ### Description Returns a boolean value indicating whether the current device environment is considered mobile based on the UniversalBreakpoints configuration. ### Method GET ### Endpoint isMobile ### Response #### Success Response (200) - **isMobile** (bool) - Returns true if the device is mobile, false otherwise. ``` -------------------------------- ### ResponsiveExtensions Configuration Getters Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions.html Getters on BuildContext that return detailed screen category, type, and configuration information. ```APIDOC ## ResponsiveExtensions Configuration Getters ### Description These getters provide detailed information about the current screen environment. ### Properties - **screenCategory** (ScreenSizeCategory) - Returns the current main screen size category. - **screenSubCategory** (ScreenSizeSubCategory) - Returns the current ultra-granular screen size sub-category. - **screenType** (String) - Returns the current screen type as a string. - **sizeConfig** (UniversalBreakpoints) - Returns the singleton instance of UniversalBreakpoints. ``` -------------------------------- ### GET isLandscape Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/isLandscape.html Retrieves the current landscape orientation status as a boolean value. ```APIDOC ## GET isLandscape ### Description Returns a boolean indicating whether the current device orientation is in landscape mode. ### Method GET ### Endpoint isLandscape ### Response #### Success Response (200) - **isLandscape** (bool) - Returns true if the device is in landscape orientation, false otherwise. ``` -------------------------------- ### Basic Dynamic Grid Configuration Source: https://pub.dev/documentation/universal_breakpoints/latest/index.html Sets up a responsive grid that automatically adjusts columns and spacing based on breakpoints. ```dart DynamicGrid( items: List.generate(12, (index) => index), itemBuilder: (context, item, index) { return Card( child: Center(child: Text('Item ${index + 1}')), ); }, columnConfig: GridColumnConfig( smallMobile: 1, mobile: 1, largeMobile: 2, tablet: 3, desktop: 4, largeDesktop: 6, ), spacingConfig: GridSpacingConfig( smallMobile: 8, mobile: 12, tablet: 16, desktop: 24, ), enableAnimations: true, ) ``` -------------------------------- ### Get isTallAspect Property Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/UniversalBreakpoints/isTallAspect.html Returns true if the screen has a tall aspect ratio (< 1.3). ```dart bool get isTallAspect => aspectRatio < 1.3; ``` -------------------------------- ### Get isTablet Property Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/isTablet.html Use this getter to check if the current screen size corresponds to a tablet breakpoint. Ensure UniversalBreakpoints is initialized. ```dart bool get isTablet { MediaQuery.of(this); return UniversalBreakpoints().isTablet; } ``` -------------------------------- ### Universal Breakpoints Init Method Implementation Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/UniversalBreakpoints/init.html This method calculates and sets various screen metrics including width, height, screen type, size categories, and scaling factors based on the provided BuildContext. ```dart void init(BuildContext context) { final mediaQuery = MediaQuery.of(context); screenWidth = mediaQuery.size.width > 3840 ? 3840 : mediaQuery.size.width; screenHeight = mediaQuery.size.height; screenType = _getScreenType(screenWidth); screenSizeCategory = _getScreenSizeCategory(screenWidth); screenSizeSubCategory = _getScreenSizeSubCategory(screenWidth); double baseWidth = _getBaseWidth(screenSizeCategory); textScaleFactor = screenWidth / (baseWidth * 1.5); widthScaleFactor = screenWidth / (baseWidth * 1.5); heightScaleFactor = screenHeight / (baseWidth * 1.5); } ``` -------------------------------- ### Get isMobile Property Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/UniversalBreakpoints/isMobile.html Returns true if the device is a mobile device (< 768px width). ```dart bool get isMobile => screenSizeCategory.index <= ScreenSizeCategory.sm.index; ``` -------------------------------- ### Implement isDesktop property Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/isDesktop.html Uses MediaQuery to trigger a rebuild and returns the desktop status from UniversalBreakpoints. ```dart bool get isDesktop { MediaQuery.of(this); return UniversalBreakpoints().isDesktop; } ``` -------------------------------- ### Get isMD Property Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/UniversalBreakpoints/isMD.html Returns true if the screen is medium (768-1023px). This property is derived from the screenSizeCategory. ```dart bool get isMD => screenSizeCategory == ScreenSizeCategory.md; ``` -------------------------------- ### Use BuildContext Extensions for Responsiveness Source: https://pub.dev/packages/universal_breakpoints Utilize BuildContext extensions to easily determine the current screen size (e.g., mobile, tablet, desktop) and render appropriate layouts. ```dart class MyHome extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('Responsive App')), body: context.isMobile ? const MobileLayout() : context.isTablet ? const TabletLayout() : const DesktopLayout(), ); } } ``` -------------------------------- ### Implement Build Method for Responsive Wrapper Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveWrapper/build.html This method is called by the framework when the widget is inserted into the tree or its dependencies change. It initializes Universal Breakpoints if autoInitialize is true and optionally prints debug information about the screen size and orientation. ```dart @override Widget build(BuildContext context) { if (config.autoInitialize) { UniversalBreakpoints().init(context); if (config.debugPrint) { final size = MediaQuery.of(context).size; final orientation = MediaQuery.of(context).orientation; debugPrint( '[ResponsiveWrapper] Build - Size: ${size.width.toStringAsFixed(0)}' 'x${size.height.toStringAsFixed(0)}, ' 'Orientation: $orientation', ); } } return child; } ``` -------------------------------- ### Get isLG Property Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/UniversalBreakpoints/isLG.html Returns true if the screen is large (1024-1279px). This property is derived from the screenSizeCategory. ```dart bool get isLG => screenSizeCategory == ScreenSizeCategory.lg; ``` -------------------------------- ### GET isUltraWide Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/isUltraWide.html Retrieves a boolean value indicating if the current screen size is classified as ultra-wide. ```APIDOC ## GET isUltraWide ### Description Returns a boolean value indicating whether the current screen size sub-category is ultra-wide based on the UniversalBreakpoints configuration. ### Method GET ### Endpoint isUltraWide ### Response #### Success Response (200) - **isUltraWide** (bool) - Returns true if the screen size is ultra-wide, otherwise false. ``` -------------------------------- ### GridSpacingConfig Constructor Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/GridSpacingConfig/GridSpacingConfig.html Initializes a GridSpacingConfig object with optional spacing values for different screen sizes. If a specific spacing is not provided, it will not be set. ```APIDOC ## GridSpacingConfig Constructor ### Description Constructs a GridSpacingConfig object, allowing for the definition of spacing values tailored to various screen resolutions, from ultra-compact to ultra-HD and beyond. A default spacing value is provided. ### Method Constructor ### Endpoint N/A (Class Constructor) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body - **ultraCompactSpacing** (double?) - Optional - Spacing for ultra-compact screen sizes. - **compactSpacing** (double?) - Optional - Spacing for compact screen sizes. - **standardSpacing** (double?) - Optional - Standard spacing value. - **largePhoneSpacing** (double?) - Optional - Spacing for large phone screen sizes. - **phabletSpacing** (double?) - Optional - Spacing for phablet screen sizes. - **smallTabletSpacing** (double?) - Optional - Spacing for small tablet screen sizes. - **standardTabletSpacing** (double?) - Optional - Spacing for standard tablet screen sizes. - **largeTabletSpacing** (double?) - Optional - Spacing for large tablet screen sizes. - **extraLargeTabletSpacing** (double?) - Optional - Spacing for extra-large tablet screen sizes. - **smallDesktopSpacing** (double?) - Optional - Spacing for small desktop screen sizes. - **standardDesktopSpacing** (double?) - Optional - Spacing for standard desktop screen sizes. - **largeDesktopSpacing** (double?) - Optional - Spacing for large desktop screen sizes. - **extraLargeDesktopSpacing** (double?) - Optional - Spacing for extra-large desktop screen sizes. - **widescreenSpacing** (double?) - Optional - Spacing for widescreen screen sizes. - **fullHDSpacing** (double?) - Optional - Spacing for Full HD screen sizes. - **qhdSpacing** (double?) - Optional - Spacing for QHD screen sizes. - **ultraWideSpacing** (double?) - Optional - Spacing for ultra-wide screen sizes. - **ultraHDSpacing** (double?) - Optional - Spacing for Ultra HD screen sizes. - **superUltraWideSpacing** (double?) - Optional - Spacing for super ultra-wide screen sizes. - **defaultSpacing** (double) - Optional - The default spacing value, defaults to 12.0. ### Request Example ```dart GridSpacingConfig( standardSpacing: 16.0, largePhoneSpacing: 20.0, defaultSpacing: 12.0, ); ``` ### Response #### Success Response (200) N/A (Constructor does not return a value in the traditional sense, it initializes an object.) #### Response Example N/A ``` -------------------------------- ### Initialize DynamicGrid Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/DynamicGrid-class.html Basic implementation of the DynamicGrid widget using a list of items and an item builder. ```dart DynamicGrid( items: List.generate(12, (index) => index), itemBuilder: (context, item, index) { return Card( child: Center(child: Text('Item $index')), ); }, ) ``` -------------------------------- ### ResponsiveWrapperConfig Class Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveWrapperConfig-class.html Configuration for responsive wrapper behavior. ```APIDOC ## ResponsiveWrapperConfig Class ### Description Configuration for responsive wrapper behavior. ### Constructors #### ResponsiveWrapperConfig ```dart ResponsiveWrapperConfig({bool autoInitialize = true, bool debugPrint = false}) ``` ### Properties - **autoInitialize** (bool) - Whether to initialize UniversalBreakpoints on each build. (final) - **debugPrint** (bool) - Debug logging for resize events. (final) - **hashCode** (int) - The hash code for this object. (no setter, inherited) - **runtimeType** (Type) - A representation of the runtime type of the object. (no setter, inherited) ### Methods - **noSuchMethod**(Invocation invocation) → dynamic - Invoked when a nonexistent method or property is accessed. (inherited) - **toString**() → String - A string representation of this object. (inherited) ### Operators - **operator ==**(Object other) → bool - The equality operator. (inherited) ``` -------------------------------- ### GET isUltraWideAspect Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/UniversalBreakpoints/isUltraWideAspect.html Retrieves the boolean status indicating if the current screen aspect ratio exceeds 2.0. ```APIDOC ## GET isUltraWideAspect ### Description Returns true if the screen has an ultra-wide aspect ratio (greater than 2.0). ### Method GET ### Endpoint isUltraWideAspect ### Response #### Success Response (200) - **isUltraWideAspect** (bool) - Returns true if the screen aspect ratio is > 2.0, otherwise false. ``` -------------------------------- ### ResponsiveWrapper Implementation Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveWrapper/ResponsiveWrapper.html The implementation details of the ResponsiveWrapper widget. ```APIDOC ## ResponsiveWrapper Implementation ### Description This section shows the actual implementation of the ResponsiveWrapper widget's constructor. ### Method Constructor ### Endpoint None ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```dart const ResponsiveWrapper({ super.key, required this.child, this.config = const ResponsiveWrapperConfig(), }); ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### GET isStandardAspect Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/UniversalBreakpoints/isStandardAspect.html Retrieves the boolean status indicating if the current screen aspect ratio is considered standard. ```APIDOC ## GET isStandardAspect ### Description Returns true if the screen has a standard aspect ratio (1.3-1.8). ### Implementation ```dart bool get isStandardAspect => aspectRatio >= 1.3 && aspectRatio <= 1.8; ``` ``` -------------------------------- ### MasonryDynamicGrid Constructor Implementation Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/MasonryDynamicGrid/MasonryDynamicGrid.html Provides the implementation for the MasonryDynamicGrid constructor, initializing its properties with the provided arguments. ```dart const MasonryDynamicGrid({ super.key, required this.items, required this.itemBuilder, this.columnConfig, this.spacingConfig, this.mainAxisSpacing, this.crossAxisSpacing, this.enableAnimations = true, this.animationDuration = const Duration(milliseconds: 300), this.padding = const EdgeInsets.all(16), }); ``` -------------------------------- ### GET screenType Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/screenType.html Retrieves the current screen type as a string based on the current media query context. ```APIDOC ## GET screenType ### Description Returns the current screen type as a string based on the application's media query context. ### Method GET ### Endpoint screenType ### Response #### Success Response (200) - **screenType** (String) - The current screen type identifier. ``` -------------------------------- ### Responsive Values and Layouts Source: https://pub.dev/packages/universal_breakpoints Methods for adapting UI components based on screen size and orientation. ```APIDOC ## Responsive Value Selection ### Description Use `context.responsiveValue` to return different values based on the current screen size category. ### Usage ```dart int columns = context.responsiveValue( mobile: 1, smallTablet: 2, largeTablet: 3, desktop: 4, ); ``` ## Orientation Awareness ### Description Use `context.isPortrait` or `context.isLandscape` to toggle layouts based on device orientation. ### Usage ```dart return context.isPortrait ? PortraitLayout() : LandscapeLayout(); ``` ``` -------------------------------- ### GET isXXL Property Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/isXXL.html Retrieves the boolean status indicating if the current screen size is classified as XXL. ```APIDOC ## GET isXXL ### Description Returns a boolean value indicating whether the current viewport width corresponds to the XXL breakpoint defined in the Universal Breakpoints configuration. ### Method GET ### Endpoint isXXL ### Response #### Success Response (200) - **isXXL** (bool) - Returns true if the screen width is within the XXL range, otherwise false. ``` -------------------------------- ### Initialize ResponsiveWrapper Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveWrapper-class.html Wraps a MaterialApp to enable automatic responsive rebuilding and debugging. ```dart ResponsiveWrapper( config: ResponsiveWrapperConfig( autoInitialize: true, debugPrint: true, ), child: MaterialApp( home: MyApp(), ), ) ``` -------------------------------- ### Basic Dynamic Grid Configuration Source: https://pub.dev/packages/universal_breakpoints Configures a DynamicGrid with items, a custom itemBuilder, and responsive column and spacing configurations for various screen sizes. ```dart DynamicGrid( items: List.generate(12, (index) => index), itemBuilder: (context, item, index) { return Card( child: Center(child: Text('Item ${index + 1}')), ); }, columnConfig: GridColumnConfig( smallMobile: 1, mobile: 1, largeMobile: 2, tablet: 3, desktop: 4, largeDesktop: 6, ), spacingConfig: GridSpacingConfig( smallMobile: 8, mobile: 12, tablet: 16, desktop: 24, ), enableAnimations: true, ) ``` -------------------------------- ### GET isExtraLargeTablet Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/isExtraLargeTablet.html Retrieves a boolean value indicating if the current screen size is classified as an extra-large tablet. ```APIDOC ## GET isExtraLargeTablet ### Description Returns a boolean value indicating whether the current device screen size is categorized as an extra-large tablet based on the UniversalBreakpoints configuration. ### Method GET ### Endpoint isExtraLargeTablet ### Response #### Success Response (200) - **isExtraLargeTablet** (bool) - Returns true if the screen size sub-category is extraLargeTablet, otherwise false. ``` -------------------------------- ### ResponsiveWrapperConfig Constructor Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveWrapperConfig/ResponsiveWrapperConfig.html Initializes ResponsiveWrapperConfig with optional autoInitialize and debugPrint settings. Set autoInitialize to false to manually manage initialization. ```dart const ResponsiveWrapperConfig({ this.autoInitialize = true, this.debugPrint = false, }); ``` -------------------------------- ### Responsive Layout with BuildContext Extension Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions.html Use this extension to conditionally render different layouts based on the device type. Ensure the widget tree is built within a context where these extensions are available. ```dart Widget build(BuildContext context) { return context.isMobile ? MobileLayout() : context.isDesktop ? DesktopLayout() : TabletLayout(); } ``` -------------------------------- ### Get isStandardAspect Property Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/isStandardAspect.html Retrieves the isStandardAspect property from MediaQuery. Ensure MediaQuery is accessible in the widget tree. ```dart bool get isStandardAspect { MediaQuery.of(this); return UniversalBreakpoints().isStandardAspect; } ``` -------------------------------- ### Get isSM Property Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/isSM.html Access the isSM property to check if the screen size is small. Requires MediaQuery. ```dart bool get isSM { MediaQuery.of(this); return UniversalBreakpoints().isSM; } ``` -------------------------------- ### UniversalBreakpoints Initialization and Usage Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/UniversalBreakpoints-class.html Demonstrates how to initialize UniversalBreakpoints in your Flutter app and use its extensions for responsive UI. ```APIDOC ## Initialization and Usage ### Description Initialize UniversalBreakpoints in your main app and use its extensions within widgets to create responsive layouts. ### Usage Example ```dart // Initialize in your main app void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { UniversalBreakpoints().init(context); return MaterialApp( home: MyHome(), ); } } // Use in widgets with extensions class MyHome extends StatelessWidget { @override Widget build(BuildContext context) { return Container( child: context.isMobile ? MobileLayout() : context.isDesktop ? DesktopLayout() : TabletLayout(), ); } } ``` ``` -------------------------------- ### SizeConfigExtension Properties Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/SizeConfigExtension.html Provides shorthand methods for scaling numeric values based on screen size. These extensions work with both int and double values. ```APIDOC ## SizeConfigExtension Properties Extension on `num` for convenient responsive scaling. Provides shorthand methods for scaling numeric values based on screen size. These extensions work with both `int` and `double` values. ### Properties - **sF** → `double` Available on `num`, provided by the `SizeConfigExtension` extension. Returns a scaled font size based on screen width. no setter - **sFh** → `double` Available on `num`, provided by the `SizeConfigExtension` extension. Returns a calculated line height multiplier based on scaled font size. no setter - **sH** → `double` Available on `num`, provided by the `SizeConfigExtension` extension. Returns a scaled height value based on screen height. no setter - **sW** → `double` Available on `num`, provided by the `SizeConfigExtension` extension. Returns a scaled width value based on screen width. no setter ### Example ```dart Text( 'Hello', style: TextStyle(fontSize: 16.sF), // Scaled font size ) Container( width: 100.sW, // Scaled width height: 50.sH, // Scaled height child: SizedBox(), ) ``` ``` -------------------------------- ### GET isMD Property Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/isMD.html Retrieves the boolean status of the medium breakpoint based on the current MediaQuery context. ```APIDOC ## GET isMD ### Description Returns a boolean value indicating if the current screen size is within the medium (MD) breakpoint range. ### Method GET ### Endpoint isMD ### Response - **isMD** (bool) - Returns true if the current viewport is at the medium breakpoint, otherwise false. ``` -------------------------------- ### Masonry Dynamic Grid Configuration Source: https://pub.dev/packages/universal_breakpoints Sets up a MasonryDynamicGrid for Pinterest-style layouts, specifying items, itemBuilder, and responsive column configurations. ```dart MasonryDynamicGrid( items: List.generate(20, (index) => index), itemBuilder: (context, item, index) { return Card(child: Center(child: Text('$item'))); }, columnConfig: GridColumnConfig( mobile: 2, tablet: 3, desktop: 4, ), spacingConfig: GridSpacingConfig(defaultSpacing: 12), ) ``` -------------------------------- ### ResponsiveWrapperConfig Constructor Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveWrapperConfig/ResponsiveWrapperConfig.html The ResponsiveWrapperConfig constructor allows for the configuration of the responsive wrapper behavior, specifically regarding initialization and debugging. ```APIDOC ## ResponsiveWrapperConfig Constructor ### Description Creates a new instance of ResponsiveWrapperConfig to define how the responsive wrapper behaves. ### Parameters #### Request Body - **autoInitialize** (bool) - Optional - Whether to automatically initialize the wrapper. Defaults to true. - **debugPrint** (bool) - Optional - Whether to enable debug printing. Defaults to false. ### Request Example { "autoInitialize": true, "debugPrint": false } ``` -------------------------------- ### ResponsiveExtensions Properties Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions.html A collection of boolean properties available on BuildContext to detect specific screen sizes, orientations, and aspect ratios. ```APIDOC ## ResponsiveExtensions Properties ### Description These properties are available on BuildContext via the ResponsiveExtensions extension. They return a boolean indicating if the current screen matches the specific breakpoint or state. ### Properties - **isCompactPhone** (bool) - True if the screen is a compact phone. - **isDesktop** (bool) - True if the screen is a desktop. - **isExtraLargeDesktop** (bool) - True if the screen is an extra large desktop. - **isExtraLargeTablet** (bool) - True if the screen is an extra large tablet. - **isFullHD** (bool) - True if the screen is Full HD. - **isLandscape** (bool) - True if the orientation is landscape. - **isLargeDesktop** (bool) - True if the screen is a large desktop. - **isLargePhone** (bool) - True if the screen is a large phone. - **isLargeScreen** (bool) - True if the screen is a large screen. - **isLargeTablet** (bool) - True if the screen is a large tablet. - **isLG** (bool) - True if the screen is LG size. - **isMD** (bool) - True if the screen is MD size. - **isMobile** (bool) - True if the screen is mobile. - **isPhablet** (bool) - True if the screen is a phablet. - **isPortrait** (bool) - True if the orientation is portrait. - **isQHD** (bool) - True if the screen is QHD. - **isSM** (bool) - True if the screen is SM size. - **isSmallDesktop** (bool) - True if the screen is a small desktop. - **isSmallTablet** (bool) - True if the screen is a small tablet. - **isStandardAspect** (bool) - True if the aspect ratio is standard. - **isStandardDesktop** (bool) - True if the screen is a standard desktop. - **isStandardPhone** (bool) - True if the screen is a standard phone. - **isStandardTablet** (bool) - True if the screen is a standard tablet. - **isSuperUltraWide** (bool) - True if the screen is super ultra wide. - **isTablet** (bool) - True if the screen is a tablet. - **isTallAspect** (bool) - True if the aspect ratio is tall. - **isUltraCompact** (bool) - True if the screen is ultra compact. - **isUltraHD** (bool) - True if the screen is Ultra HD. - **isUltraWide** (bool) - True if the screen is ultra wide. - **isUltraWideAspect** (bool) - True if the aspect ratio is ultra wide. - **isWidescreen** (bool) - True if the screen is widescreen. - **isXL** (bool) - True if the screen is XL size. - **isXS** (bool) - True if the screen is XS size. - **isXXL** (bool) - True if the screen is XXL size. - **isXXS** (bool) - True if the screen is XXS size. - **isXXXL** (bool) - True if the screen is XXXL size. ``` -------------------------------- ### Get UniversalBreakpoints Singleton Instance Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/sizeConfig.html Use this getter to retrieve the singleton instance of UniversalBreakpoints. It requires a BuildContext to be available. ```dart UniversalBreakpoints get sizeConfig { MediaQuery.of(this); return UniversalBreakpoints(); } ``` -------------------------------- ### Implement isStandardDesktop property Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/isStandardDesktop.html Uses MediaQuery to trigger a rebuild and checks the screen size sub-category via UniversalBreakpoints. ```dart bool get isStandardDesktop { MediaQuery.of(this); return UniversalBreakpoints().screenSizeSubCategory == ScreenSizeSubCategory.standardDesktop; } ``` -------------------------------- ### Get Screen Size Category Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/screenCategory.html Returns the current main screen size category. Ensure UniversalBreakpoints is initialized. ```dart ScreenSizeCategory get screenCategory { MediaQuery.of(this); return UniversalBreakpoints().screenSizeCategory; } ``` -------------------------------- ### Get isXL Property Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/isXL.html Use this getter to check if the current screen size is extra-large. It requires a MediaQuery context. ```dart bool get isXL { MediaQuery.of(this); return UniversalBreakpoints().isXL; } ``` -------------------------------- ### DynamicGrid Constructor Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/DynamicGrid/DynamicGrid.html Initializes a new DynamicGrid widget with specified items, builder, and layout configurations. ```APIDOC ## DynamicGrid Constructor ### Description Creates a grid layout that supports dynamic items, custom item builders, and responsive column configurations. ### Parameters - **key** (Key?) - Optional - The widget key. - **items** (List) - Required - The list of items to display in the grid. - **itemBuilder** (Widget Function(BuildContext, dynamic, int)) - Required - Builder function to create widgets for each item. - **columnConfig** (GridColumnConfig?) - Optional - Configuration for grid columns. - **spacingConfig** (GridSpacingConfig?) - Optional - Configuration for grid spacing. - **itemAspectRatio** (double) - Optional - The aspect ratio of grid items (default: 1.0). - **enableAnimations** (bool) - Optional - Whether to enable grid animations (default: true). - **animationDuration** (Duration) - Optional - Duration of the grid animations (default: 300ms). - **animationCurve** (Curve) - Optional - Curve used for animations (default: Curves.easeInOut). - **useSliverGrid** (bool) - Optional - Whether to use a sliver grid implementation (default: false). - **scrollPhysics** (ScrollPhysics?) - Optional - Physics for the scrollable area. - **padding** (EdgeInsetsGeometry) - Optional - Padding around the grid (default: 16). - **mainAxisSpacing** (double?) - Optional - Spacing along the main axis. - **crossAxisSpacing** (double?) - Optional - Spacing along the cross axis. ``` -------------------------------- ### GET isTallAspect Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/isTallAspect.html Retrieves the boolean value representing whether the current device screen has a tall aspect ratio. ```APIDOC ## GET isTallAspect ### Description Returns a boolean indicating if the current display aspect ratio is tall. This property relies on the MediaQuery context. ### Method GET ### Endpoint isTallAspect ### Response #### Success Response (200) - **isTallAspect** (bool) - Returns true if the aspect ratio is tall, false otherwise. ``` -------------------------------- ### Masonry Grid Layout Source: https://pub.dev/documentation/universal_breakpoints/latest/index.html Creates a Pinterest-style masonry layout with responsive columns and flexible item heights. ```dart MasonryDynamicGrid( items: List.generate(20, (index) => index), itemBuilder: (context, item, index) { return Card(child: Center(child: Text('$item'))); }, columnConfig: GridColumnConfig( mobile: 2, tablet: 3, desktop: 4, ), spacingConfig: GridSpacingConfig(defaultSpacing: 12), ) ``` -------------------------------- ### GET isSM Property Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/isSM.html Retrieves the boolean value indicating if the current screen size is classified as small (SM). ```APIDOC ## GET isSM ### Description Returns a boolean value indicating whether the current device screen size falls within the 'small' (SM) breakpoint range. ### Method GET ### Endpoint isSM ### Response #### Success Response (200) - **isSM** (bool) - Returns true if the screen width is within the small breakpoint range, otherwise false. ``` -------------------------------- ### Initialize GridSpacingConfig Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/GridSpacingConfig/GridSpacingConfig.html Defines spacing configurations for multiple screen breakpoints. The defaultSpacing parameter defaults to 12.0 if not specified. ```dart GridSpacingConfig({ this.ultraCompactSpacing, this.compactSpacing, this.standardSpacing, this.largePhoneSpacing, this.phabletSpacing, this.smallTabletSpacing, this.standardTabletSpacing, this.largeTabletSpacing, this.extraLargeTabletSpacing, this.smallDesktopSpacing, this.standardDesktopSpacing, this.largeDesktopSpacing, this.extraLargeDesktopSpacing, this.widescreenSpacing, this.fullHDSpacing, this.qhdSpacing, this.ultraWideSpacing, this.ultraHDSpacing, this.superUltraWideSpacing, this.defaultSpacing = 12.0, }); ``` -------------------------------- ### GET isXXS Property Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/UniversalBreakpoints/isXXS.html Retrieves the boolean status indicating if the current screen size is classified as extra extra small. ```APIDOC ## GET isXXS ### Description Returns true if the screen width is extra extra small (< 360px). ### Method GET ### Response - **isXXS** (bool) - Returns true if the screen size category is xxs, otherwise false. ``` -------------------------------- ### Get isPortrait Property Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/UniversalBreakpoints/isPortrait.html Returns true if the device is in portrait orientation. This implementation compares screen height to screen width. ```dart bool get isPortrait => screenHeight > screenWidth; ``` -------------------------------- ### Implement isSmallDesktop property Source: https://pub.dev/documentation/universal_breakpoints/latest/universal_breakpoints/ResponsiveExtensions/isSmallDesktop.html This getter uses MediaQuery to trigger a rebuild and checks the screen size category against the smallDesktop constant. ```dart bool get isSmallDesktop { MediaQuery.of(this); return UniversalBreakpoints().screenSizeSubCategory == ScreenSizeSubCategory.smallDesktop; } ```