Responsive Widgets Prefix allows you to add the "Responsive" prefix to any widget that needs scaling or font size increases

Overview

Responsive Widgets Prefix allows you to add the "Responsive" prefix to any widget that needs scaling or font size increases (for varying device screen sizes).

Features

When not using Responsive widgets, you can run into issues with scaling like the following:

Non Responsive Text

          ...
          children: <Widget>[
            Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
          ],

Non Responsive Setup

Default ResponsiveText

          ...
          children: <Widget>[
            ResponsiveText(
              'You have pushed the button this many times:',
            ),
            ResponsiveText(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
          ],

Default Responsive Setup

Customized ResponsiveText (scaleMediumTablet)

          ...
          children: <Widget>[
            ResponsiveText(
              'You have pushed the button this many times:',
            ),
            ResponsiveText(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
              scaleMediumTablet: 4,
            ),
          ],

Custom Responsive Setup

Note: The following widgets are currently supported, but we welcome widget requests for new responsive widgets.

Visual Structural Interactive Platform
AssetImage Container IconButton MaterialApp
Text Padding FloatingActionButton CupertinoApp
Card ButtonTheme AppBar
Icon

Getting started

Install Responsive Widgets Prefix

  flutter pub get responsive_widgets_prefix

Or install Responsive Widgets Prefix (in pubspec.yaml)

    ...
    
dependencies:
  flutter:
    sdk: flutter

    ...

  responsive_widgets_prefix: 

Add Responsive Widgets Prefix import

import 'package:responsive_widgets_prefix/responsive_widgets_prefix.dart';

Finally, create a Responsive App

In the case of a MaterialApp, all you would need to do is add the Responsive prefix.

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return ResponsiveMaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

Note: Alternatively, if you are using a CupertinoApp the same Responsive prefix can be added.

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return ResponsiveCupertinoApp(
      title: 'Flutter Demo',
      theme: CupertinoThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primaryColor below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primaryColor: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

Usage

Our first example will be the Counter Sample project. With this project we can integrate the Responsive Widgets prefix to scale the UI, for the appropriate scren size (and preview the results).

Create platforms file (lib/platforms.dart)

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class PlatformApp extends PlatformWidget {

  PlatformApp({
    Key? key,
    required MaterialApp androidApp,
    required CupertinoApp iosApp,
    required TargetPlatform defaultPlatform,
  }) : super(key: key,
      androidBuilder: (BuildContext context) => androidApp,
      iosBuilder:  (BuildContext context) => iosApp
    ) {
      PlatformWidget.setPlatform(defaultPlatform);
  }

}

class PlatformWidget extends StatefulWidget {
  
  static TargetPlatform? _defaultPlatform;

  static get platform {
      if(_defaultPlatform == null) {
        return TargetPlatform.android;
      }
      return _defaultPlatform;
  }

  static get isAndroid {
      return _defaultPlatform == TargetPlatform.android;
  }

  static get isIOS {
      return _defaultPlatform == TargetPlatform.iOS;
  }

  static void setPlatform(TargetPlatform platform) {
      _defaultPlatform = platform;
  }

  static void reassembleApplication() {
      WidgetsBinding.instance!.reassembleApplication();
  }

  const PlatformWidget({
    Key? key,
    required this.androidBuilder,
    required this.iosBuilder,
  }) : super(key: key);

  final WidgetBuilder androidBuilder;
  final WidgetBuilder iosBuilder;

  @override
  State<PlatformWidget> createState() => _PlatformWidgetState();
}

class _PlatformWidgetState extends State<PlatformWidget> {
  @override
  Widget build(context) {
    switch (PlatformWidget._defaultPlatform) {
      case TargetPlatform.android:
        return widget.androidBuilder(context);
      case TargetPlatform.iOS:      
        return widget.iosBuilder(context);        
      default:
        assert(false, 'Unexpected platform ${PlatformWidget._defaultPlatform}');
        return Container();
    }
  }
}

Create main file (lib/main.dart)

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:responsive_widgets_prefix/responsive_widgets_prefix.dart';

import 'platforms.dart';

void main() => runApp(setupMainWidget());

Widget setupMainWidget() {
  WidgetsFlutterBinding.ensureInitialized();
  return const MyApp();
}
class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override Widget build(BuildContext context) {
    return PlatformApp(
        defaultPlatform: PlatformWidget.platform,
        androidApp: ResponsiveMaterialApp(
          theme: ThemeData(primarySwatch: Colors.blue),
          home: const MyHomePage(title: 'Counter Sample')
        ),
        iosApp: ResponsiveCupertinoApp(
            theme: const CupertinoThemeData(primaryColor: Colors.blue),
            home: const MyHomePage(title: 'Counter Sample'),
        )
    );
  }
}

class MyHomePage extends StatefulWidget {
  final String title;
  const MyHomePage({Key? key, required this.title}) : super(key: key);
  @override State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }
  @override Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text(widget.title)),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            ResponsiveText('You have pushed the button this many times:'),
            ResponsiveText('$_counter', style: Theme.of(context).textTheme.headline4, scaleMediumTablet: 4),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter, tooltip: 'Increment', child: const Icon(Icons.add),
      ),
    );
  }
}

The comparisons would look like the following:

Samsung A50

iPhone 12 Max Pro

iPad Pro 11 Inches

Additional information

Package Support

To support this repo, take a look at the SUPPORT.md file.

Package Documentation

To view the documentation on the package, follow this link

Comments
  • Icon

    Icon

    What is the "Type" of the Widget you'd like to have made responsive? Icon

    What category Is your widget request for? (mark with [x] for category)

    • [X] Visual
    • [ ] Structural
    • [ ] Interactive
    • [ ] Platform

    List the widget's attributes that can be scaled (size, width, height, radius, etc.)

    • size

    Paste the Constructor for your widget in the below code block

    
      const Icon(
        this.icon, {
        Key? key,
        this.size,
        this.color,
        this.semanticLabel,
        this.textDirection,
      }) : super(key: key);
    
    
    enhancement 
    opened by cdm2012 0
  • Responsive Container with height crashes

    Responsive Container with height crashes

    I created a ResponsiveContainer with a height only, and it gave the following exception.

    
              child: ResponsiveContainer(
                height: 40,
    
    EXCEPTION CAUGHT BY WIDGETS LIBRARY e
    The following _CastError was thrown building ResponsiveContainer(dirty):
    Null check operator used on a null value
    
    The relevant error-causing widget was:
      ResponsiveContainer
    
    When the exception was thrown, this was the stack:
    #0      ResponsiveContainer.getResponsiveWidget (package:responsive_widgets_prefix\/structural\/responsive_container.dart:79:67)
    #1      ResponsiveStatelessWidget.build (package:responsive_widgets_prefix\/responsive_widgets.dart:87:16)
    #2      StatelessElement.build (package:flutter\/src\/widgets\/framework.dart:4662:28)
    
    #3      ComponentElement.performRebuild (package:flutter\/src\/widgets\/framework.dart:4588:15)
    #4      Element.rebuild (package:flutter\/src\/widgets\/framework.dart:4311:5)
    #5      ComponentElement._firstBuild (package:flutter\/src\/widgets\/framework.dart:4566:5)
    #6      ComponentElement.mount (package:flutter\/src\/widgets\/framework.dart:4561:5)
    #7      Element.inflateWidget (package:flutter\/src\/widgets\/framework.dart:3631:14)
    #8      MultiChildRenderObjectElement.inflateWidget (package:flutter\/src\/widgets\/framework.dart:6261:36)
    #9      MultiChildRenderObjectElement.mount (package:flutter\/src\/widgets\/framework.dart:6272:32)
    ...     Normal element mounting (19 frames)
    #28     Element.inflateWidget (package:flutter\/src\/widgets\/framework.dart:3631:14)
    #29     MultiChildRenderObjectElement.inflateWidget (package:flutter\/src\/widgets\/framework.dart:6261:36)
    #30     MultiChildRenderObjectElement.mount (package:flutter\/src\/widgets\/framework.dart:6272:32)
    ...     Normal element mounting (91 frames)
    #121    Element.inflateWidget (package:flutter\/src\/widgets\/framework.dart:3631:14)
    #122    Element.updateChild (package:flutter\/src\/widgets\/framework.dart:3383:18)
    #123    _LayoutBuilderElement._layout.layoutCallback (package:flutter\/src\/widgets\/layout_builder.dart:137:18)
    #124    BuildOwner.buildScope (package:flutter\/src\/widgets\/framework.dart:2531:19)
    #125    _LayoutBuilderElement._layout (package:flutter\/src\/widgets\/layout_builder.dart:154:12)
    #126    RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter\/src\/rendering\/object.dart:1962:59)
    #127    PipelineOwner._enableMutationsToDirtySubtrees (package:flutter\/src\/rendering\/object.dart:910:15)
    #128    RenderObject.invokeLayoutCallback (package:flutter\/src\/rendering\/object.dart:1962:14)
    #129    RenderConstrainedLayoutBuilder.rebuildIfNecessary (package:flutter\/src\/widgets\/layout_builder.dart:228:7)
    #130    _RenderLayoutBuilder.performLayout (package:flutter\/src\/widgets\/layout_builder.dart:317:5)
    #131    RenderObject.layout (package:flutter\/src\/rendering\/object.dart:1852:7)
    #132    RenderProxyBoxMixin.performLayout (package:flutter\/src\/rendering\/proxy_box.dart:116:14)
    #133    RenderObject.layout (package:flutter\/src\/rendering\/object.dart:1852:7)
    #134    RenderProxyBoxMixin.performLayout (package:flutter\/src\/rendering\/proxy_box.dart:116:14)
    #135    RenderObject.layout (package:flutter\/src\/rendering\/object.dart:1852:7)
    #136    RenderProxyBoxMixin.performLayout (package:flutter\/src\/rendering\/proxy_box.dart:116:14)
    #137    RenderObject.layout (package:flutter\/src\/rendering\/object.dart:1852:7)
    #138    RenderProxyBoxMixin.performLayout (package:flutter\/src\/rendering\/proxy_box.dart:116:14)
    #139    RenderObject.layout (package:flutter\/src\/rendering\/object.dart:1852:7)
    #140    RenderProxyBoxMixin.performLayout (package:flutter\/src\/rendering\/proxy_box.dart:116:14)
    #141    RenderObject.layout (package:flutter\/src\/rendering\/object.dart:1852:7)
    #142    RenderProxyBoxMixin.performLayout (package:flutter\/src\/rendering\/proxy_box.dart:116:14)
    #143    RenderObject.layout (package:flutter\/src\/rendering\/object.dart:1852:7)
    #144    RenderProxyBoxMixin.performLayout (package:flutter\/src\/rendering\/proxy_box.dart:116:14)
    #145    RenderObject.layout (package:flutter\/src\/rendering\/object.dart:1852:7)
    #146    RenderProxyBoxMixin.performLayout (package:flutter\/src\/rendering\/proxy_box.dart:116:14)
    #147    RenderObject.layout (package:flutter\/src\/rendering\/object.dart:1852:7)
    #148    RenderProxyBoxMixin.performLayout (package:flutter\/src\/rendering\/proxy_box.dart:116:14)
    #149    RenderOffstage.performLayout (package:flutter\/src\/rendering\/proxy_box.dart:3428:13)
    #150    RenderObject.layout (package:flutter\/src\/rendering\/object.dart:1852:7)
    #151    RenderProxyBoxMixin.performLayout (package:flutter\/src\/rendering\/proxy_box.dart:116:14)
    #152    RenderObject.layout (package:flutter\/src\/rendering\/object.dart:1852:7)
    #153    _RenderTheatre.performLayout (package:flutter\/src\/widgets\/overlay.dart:751:15)
    #154    RenderObject.layout (package:flutter\/src\/rendering\/object.dart:1852:7)
    #155    RenderProxyBoxMixin.per
    formLayout (package:flutter\/src\/rendering\/proxy_box.dart:116:14)
    #156    RenderObject.layout (package:flutter\/src\/rendering\/object.dart:1852:7)
    #157    RenderProxyBoxMixin.performLayout (package:flutter\/src\/rendering\/proxy_box.dart:116:14)
    #158    RenderObject.layout (package:flutter\/src\/rendering\/object.dart:1852:7)
    #159    RenderProxyBoxMixin.performLayout (package:flutter\/src\/rendering\/proxy_box.dart:116:14)
    #160    RenderObject.layout (package:flutter\/src\/rendering\/object.dart:1852:7)
    #161    RenderProxyBoxMixin.performLayout (package:flutter\/src\/rendering\/proxy_box.dart:116:14)
    #162    RenderCustomPaint.performLayout (package:flutter\/src\/rendering\/custom_paint.dart:545:11)
    #163    RenderObject.layout (package:flutter\/src\/rendering\/object.dart:1852:7)
    #164    RenderProxyBoxMixin.performLayout (package:flutter\/src\/rendering\/proxy_box.dart:116:14)
    #165    RenderObject.layout (package:flutter\/src\/rendering\/object.dart:1852:7)
    #166    RenderProxyBoxMixin.performLayout (package:flutter\/src\/rendering\/proxy_box.dart:116:14)
    #167    RenderObject.layout (package:flutter\/src\/rendering\/object.dart:1852:7)
    #168    RenderProxyBoxMixin.performLayout (package:flutter\/src\/rendering\/proxy_box.dart:116:14)
    #169    RenderObject.layout (package:flutter\/src\/rendering\/object.dart:1852:7)
    #170    RenderProxyBoxMixin.performLayout (package:flutter\/src\/rendering\/proxy_box.dart:116:14)
    #171    RenderObject.layout (package:flutter\/src\/rendering\/object.dart:1852:7)
    #172    RenderView.performLayout (package:flutter\/src\/rendering\/view.dart:165:14)
    #173    RenderObject._layoutWithoutResize (package:flutter\/src\/rendering\/object.dart:1707:7)
    #174    PipelineOwner.flushLayout (package:flutter\/src\/rendering\/object.dart:879:18)
    #175    RendererBinding.drawFrame (package:flutter\/src\/rendering\/binding.dart:497:19)
    #176    WidgetsBinding.drawFrame (package:flutter\/src\/widgets\/binding.dart:883:13)
    #177    RendererBinding._handlePersistentFrameCallback (package:flutter\/src\/rendering\/binding.dart:363:5)
    #178    SchedulerBinding._invokeFrameCallback (package:flutter\/src\/scheduler\/binding.dart:1145:15)
    #179    SchedulerBinding.handleDrawFrame (package:flutter\/src\/scheduler\/binding.dart:1082:9)
    #180    SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter\/src\/scheduler\/binding.dart:863:7)
    (elided 11 frames from class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)
    
    opened by cdm2012 0
  • Responsive app has not been created yet failure

    Responsive app has not been created yet failure

    There is an error that is caused during ResponsiveMaterialApp/ResponsiveCupertinoApp creation.

    Your responsive app has not been created yet, please move your Responsive Widgets outside of the Responsive app creation.

    
      @override
      Widget build(BuildContext context) {
    
        return ResponsiveMaterialApp(
          title: 'Welcome to Flutter',
          home: Scaffold(
            appBar: AppBar(
              title: const Text('Welcome to Flutter'),
            ),
            body: const ResponsiveText('Hello, Flutter'),
          ),
        );
      }
    
    opened by cdm2012 0
  • CircleAvatar

    CircleAvatar

    What category Is your widget request for? (mark with [x] for category)

    • [x] Visual
    • [ ] Structural
    • [ ] Interactive
    • [ ] Platform

    List the widget's attributes that can be scaled (size, width, height, radius, etc.)

    radius

    Paste the Constructor for your widget in the below code block

    
    const CircleAvatar({
        Key? key,
        this.child,
        this.backgroundColor,
        this.backgroundImage,
        this.foregroundImage,
        this.onBackgroundImageError,
        this.onForegroundImageError,
        this.foregroundColor,
        this.radius,
        this.minRadius,
        this.maxRadius,
      }) : assert(radius == null || (minRadius == null && maxRadius == null)),
           assert(backgroundImage != null || onBackgroundImageError == null),
           assert(foregroundImage != null || onForegroundImageError== null),
           super(key: key);
    
    
    enhancement 
    opened by cdm2012 0
  • CupertinoTextField

    CupertinoTextField

    What category Is your widget request for? (mark with [x] for category)

    • [ ] Visual
    • [ ] Structural
    • [x] Interactive
    • [ ] Platform

    List the widget's attributes that can be scaled (size, width, height, radius, etc.) style.fontSize style.height

    Paste the Constructor for your widget in the below code block

    
    const CupertinoTextField({
        Key? key,
        this.controller,
        this.focusNode,
        this.decoration = _kDefaultRoundedBorderDecoration,
        this.padding = const EdgeInsets.all(6.0),
        this.placeholder,
        this.placeholderStyle = const TextStyle(
          fontWeight: FontWeight.w400,
          color: CupertinoColors.placeholderText,
        ),
        this.prefix,
        this.prefixMode = OverlayVisibilityMode.always,
        this.suffix,
        this.suffixMode = OverlayVisibilityMode.always,
        this.clearButtonMode = OverlayVisibilityMode.never,
        TextInputType? keyboardType,
        this.textInputAction,
        this.textCapitalization = TextCapitalization.none,
        this.style,
        this.strutStyle,
        this.textAlign = TextAlign.start,
        this.textAlignVertical,
        this.textDirection,
        this.readOnly = false,
        ToolbarOptions? toolbarOptions,
        this.showCursor,
        this.autofocus = false,
        this.obscuringCharacter = '•',
        this.obscureText = false,
        this.autocorrect = true,
        SmartDashesType? smartDashesType,
        SmartQuotesType? smartQuotesType,
        this.enableSuggestions = true,
        this.maxLines = 1,
        this.minLines,
        this.expands = false,
        this.maxLength,
        @Deprecated(
          'Use maxLengthEnforcement parameter which provides more specific '
          'behavior related to the maxLength limit. '
          'This feature was deprecated after v1.25.0-5.0.pre.',
        )
        this.maxLengthEnforced = true,
        this.maxLengthEnforcement,
        this.onChanged,
        this.onEditingComplete,
        this.onSubmitted,
        this.inputFormatters,
        this.enabled,
        this.cursorWidth = 2.0,
        this.cursorHeight,
        this.cursorRadius = const Radius.circular(2.0),
        this.cursorColor,
        this.selectionHeightStyle = ui.BoxHeightStyle.tight,
        this.selectionWidthStyle = ui.BoxWidthStyle.tight,
        this.keyboardAppearance,
        this.scrollPadding = const EdgeInsets.all(20.0),
        this.dragStartBehavior = DragStartBehavior.start,
        this.enableInteractiveSelection = true,
        this.selectionControls,
        this.onTap,
        this.scrollController,
        this.scrollPhysics,
        this.autofillHints = const <String>[],
        this.clipBehavior = Clip.hardEdge,
        this.restorationId,
        this.enableIMEPersonalizedLearning = true,
      }) : assert(textAlign != null),
           assert(readOnly != null),
           assert(autofocus != null),
           assert(obscuringCharacter != null && obscuringCharacter.length == 1),
           assert(obscureText != null),
           assert(autocorrect != null),
           smartDashesType = smartDashesType ?? (obscureText ? SmartDashesType.disabled : SmartDashesType.enabled),
           smartQuotesType = smartQuotesType ?? (obscureText ? SmartQuotesType.disabled : SmartQuotesType.enabled),
           assert(enableSuggestions != null),
           assert(maxLengthEnforced != null),
           assert(
             maxLengthEnforced || maxLengthEnforcement == null,
             'maxLengthEnforced is deprecated, use only maxLengthEnforcement',
           ),
           assert(scrollPadding != null),
           assert(dragStartBehavior != null),
           assert(selectionHeightStyle != null),
           assert(selectionWidthStyle != null),
           assert(maxLines == null || maxLines > 0),
           assert(minLines == null || minLines > 0),
           assert(
             (maxLines == null) || (minLines == null) || (maxLines >= minLines),
             "minLines can't be greater than maxLines",
           ),
           assert(expands != null),
           assert(
             !expands || (maxLines == null && minLines == null),
             'minLines and maxLines must be null when expands is true.',
           ),
           assert(!obscureText || maxLines == 1, 'Obscured fields cannot be multiline.'),
           assert(maxLength == null || maxLength > 0),
           assert(clearButtonMode != null),
           assert(prefixMode != null),
           assert(suffixMode != null),
           // Assert the following instead of setting it directly to avoid surprising the user by silently changing the value they set.
           assert(
             !identical(textInputAction, TextInputAction.newline) ||
             maxLines == 1 ||
             !identical(keyboardType, TextInputType.text),
             'Use keyboardType TextInputType.multiline when using TextInputAction.newline on a multiline TextField.',
           ),
           assert(enableIMEPersonalizedLearning != null),
           keyboardType = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline),
           toolbarOptions = toolbarOptions ?? (obscureText ?
             const ToolbarOptions(
               selectAll: true,
               paste: true,
             ) :
             const ToolbarOptions(
               copy: true,
               cut: true,
               selectAll: true,
               paste: true,
             )),
           super(key: key);
    
    
    enhancement 
    opened by cdm2012 0
  • TextField

    TextField

    What category Is your widget request for? (mark with [x] for category)

    • [ ] Visual
    • [ ] Structural
    • [x] Interactive
    • [ ] Platform

    List the widget's attributes that can be scaled (size, width, height, radius, etc.) style.fontSize style.height

    Paste the Constructor for your widget in the below code block

    
    const TextField({
        Key? key,
        this.controller,
        this.focusNode,
        this.decoration = const InputDecoration(),
        TextInputType? keyboardType,
        this.textInputAction,
        this.textCapitalization = TextCapitalization.none,
        this.style,
        this.strutStyle,
        this.textAlign = TextAlign.start,
        this.textAlignVertical,
        this.textDirection,
        this.readOnly = false,
        ToolbarOptions? toolbarOptions,
        this.showCursor,
        this.autofocus = false,
        this.obscuringCharacter = '•',
        this.obscureText = false,
        this.autocorrect = true,
        SmartDashesType? smartDashesType,
        SmartQuotesType? smartQuotesType,
        this.enableSuggestions = true,
        this.maxLines = 1,
        this.minLines,
        this.expands = false,
        this.maxLength,
        @Deprecated(
          'Use maxLengthEnforcement parameter which provides more specific '
          'behavior related to the maxLength limit. '
          'This feature was deprecated after v1.25.0-5.0.pre.',
        )
        this.maxLengthEnforced = true,
        this.maxLengthEnforcement,
        this.onChanged,
        this.onEditingComplete,
        this.onSubmitted,
        this.onAppPrivateCommand,
        this.inputFormatters,
        this.enabled,
        this.cursorWidth = 2.0,
        this.cursorHeight,
        this.cursorRadius,
        this.cursorColor,
        this.selectionHeightStyle = ui.BoxHeightStyle.tight,
        this.selectionWidthStyle = ui.BoxWidthStyle.tight,
        this.keyboardAppearance,
        this.scrollPadding = const EdgeInsets.all(20.0),
        this.dragStartBehavior = DragStartBehavior.start,
        this.enableInteractiveSelection = true,
        this.selectionControls,
        this.onTap,
        this.mouseCursor,
        this.buildCounter,
        this.scrollController,
        this.scrollPhysics,
        this.autofillHints = const <String>[],
        this.clipBehavior = Clip.hardEdge,
        this.restorationId,
        this.enableIMEPersonalizedLearning = true,
      }) : assert(textAlign != null),
           assert(readOnly != null),
           assert(autofocus != null),
           assert(obscuringCharacter != null && obscuringCharacter.length == 1),
           assert(obscureText != null),
           assert(autocorrect != null),
           smartDashesType = smartDashesType ?? (obscureText ? SmartDashesType.disabled : SmartDashesType.enabled),
           smartQuotesType = smartQuotesType ?? (obscureText ? SmartQuotesType.disabled : SmartQuotesType.enabled),
           assert(enableSuggestions != null),
           assert(enableInteractiveSelection != null),
           assert(maxLengthEnforced != null),
           assert(
             maxLengthEnforced || maxLengthEnforcement == null,
             'maxLengthEnforced is deprecated, use only maxLengthEnforcement',
           ),
           assert(scrollPadding != null),
           assert(dragStartBehavior != null),
           assert(selectionHeightStyle != null),
           assert(selectionWidthStyle != null),
           assert(maxLines == null || maxLines > 0),
           assert(minLines == null || minLines > 0),
           assert(
             (maxLines == null) || (minLines == null) || (maxLines >= minLines),
             "minLines can't be greater than maxLines",
           ),
           assert(expands != null),
           assert(
             !expands || (maxLines == null && minLines == null),
             'minLines and maxLines must be null when expands is true.',
           ),
           assert(!obscureText || maxLines == 1, 'Obscured fields cannot be multiline.'),
           assert(maxLength == null || maxLength == TextField.noMaxLength || maxLength > 0),
           // Assert the following instead of setting it directly to avoid surprising the user by silently changing the value they set.
           assert(
             !identical(textInputAction, TextInputAction.newline) ||
             maxLines == 1 ||
             !identical(keyboardType, TextInputType.text),
             'Use keyboardType TextInputType.multiline when using TextInputAction.newline on a multiline TextField.',
           ),
           assert(clipBehavior != null),
           assert(enableIMEPersonalizedLearning != null),
           keyboardType = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline),
           toolbarOptions = toolbarOptions ?? (obscureText ?
             const ToolbarOptions(
               selectAll: true,
               paste: true,
             ) :
             const ToolbarOptions(
               copy: true,
               cut: true,
               selectAll: true,
               paste: true,
             )),
           super(key: key);
    
    
    enhancement 
    opened by cdm2012 0
  • Asset Image bundle, package keys

    Asset Image bundle, package keys

    The Responsive Asset Image is missing bundle, package keys:

    
      const AssetImage(
        this.assetName, {
        this.bundle,
        this.package,
      }) : assert(assetName != null);
    
    
    opened by cdm2012 0
Owner
The Mobile Applications Community
The Mobile Applications Community is where apps can be built using community resources.
The Mobile Applications Community
A simple Flutter widget to add in the widget tree when you want to show nothing, with minimal impact on performance.

nil A simple widget to add in the widget tree when you want to show nothing, with minimal impact on performance. Why? Sometimes, according to a condit

Romain Rastel 127 Dec 22, 2022
An advanced switch widget, that can be fully customized with size, text, color, radius of corners.

flutter_advanced_switch An advanced switch widget, that can be fully customized with size, text, color, radius of corners. Switch Light Switch Dark Ge

Alex Melnyk 13 Dec 15, 2022
An extensive snap tool/widget for Flutter that allows very flexible snap management and snapping between your widgets.

An extensive snap tool/widget for Flutter that allows very flexible snap management and snapping between your widgets.

AliYigitBireroglu 101 Dec 16, 2022
Widget, that can make any static located widget hidable

Installing See the official installing guidline from hidable/install Usage & Overview To start using Hidable widget, we have to create a ScrollControl

Anon 18 Dec 16, 2022
Show custom in-app notification with any Widgets in flutter

notify_inapp show custom in-app notification with any Widgets. Getting Started Add this to your package's pubspec.yaml file: dependencies: notify_in

NewTab 3 Aug 19, 2022
An alternative to Overlay which allows you to easily render and hit test a widget outside its parent bounds

An alternative to Overlay which allows you to easily render and hit test a widget outside its parent bounds. Based on the original idea by @shrouxm he

gskinner team 26 Dec 31, 2022
The flutter_otp_text_field package for flutter is a TextField widget that allows you to display different style pin.

flutter_otp_text_field flutter_otp_text_field The flutter_otp_text_field package for flutter is a TextField widget that allows you to display differen

David-Legend 30 Nov 8, 2022
Flutter package: Similar to a ListView, but lets you programmatically jump to any item, by index.

indexed_list_view Similar to a ListView, but lets you programmatically jump to any item, by index. The index jump happens instantly, no matter if you

Marcelo Glasberg 244 Dec 27, 2022
Donation/Support buttons to allow you to add your favorite support buttons like: Paypal, Ko-fi or Patreon and more.

flutter_donation_buttons Donation/Support buttons to allow you to add your favorite support buttons like: Paypal, Ko-fi or Patreon and more. Getting S

null 6 Dec 10, 2022
Love the material AppBar? Do you want to add more color to the appbar? Here's a gradientAppBar.

Gradient App Bar Love the material AppBar? Do you want to add more color to the appbar? Here's a gradientAppBar. It works just like the normal AppBar.

Joost Lekkerkerker 131 Nov 11, 2022
Animated Search Bar package lets you add a beautiful search bar to your Flutter app.

Animated Search Bar Animated Search Bar package lets you add a beautiful search bar to your Flutter app. Installation Add the latest version of packag

Mohammad Saleh 5 Aug 7, 2022
Add decoration capabilities for the Icon widget with shadows, borders, gradients.

icon_decoration Add decoration capabilities for the Icon widget with shadows, borders, gradients. This new DecoratedIcon widget overlap itself with th

Guillaume Roux 23 Oct 7, 2022
Flutter Number Picker is a custom widget designed for choosing an integer or decimal number by using add and minus buttons

Flutter Number Picker is a custom widget designed for choosing an integer or decimal number by using add and minus buttons. Getting Started Head to /p

Vũ Phương 2 Jul 4, 2022
Custom widgets and utils using Flutter framework widgets and Dart language

reuse_widgets_and_utils The custom widgets and utils using Flutter framework widgets and Dart programming language. Getting Started This project is a

null 1 Oct 29, 2021
Flutter package: Assorted layout widgets that boldly go where no native Flutter widgets have gone before.

assorted_layout_widgets I will slowly but surely add interesting widgets, classes and methods to this package. Despite the package name, they are not

Marcelo Glasberg 122 Dec 22, 2022
Flutter-useful-widgets - Flutter Useful Widgets

useful_widgets This package makes it easy to build apps by providing a list of simple and useful widgets. import 'package:useful_widgets/useful_widget

Ricardo Crescenti 6 Jun 20, 2022
Widgets beginner - Widgets beginner with flutter

Widgets beginner - Widgets beginner with flutter

Tukhtamurodov Sardorbek 2 Feb 6, 2022
SmartSelect allows you to easily convert your usual form select or dropdown into dynamic page

SmartSelect allows you to easily convert your usual form select or dropdown into dynamic page, popup dialog, or sliding bottom sheet with various choices input such as radio, checkbox, switch, chips, or even custom input. Supports single and multiple choice.

Irfan Vigma Taufik 332 Dec 20, 2022
The SpannableGrid is a Flutter widget that allows its cells to span columns and rows and supports moving cells inside the grid.

Spannable Grid The SpannableGrid is a Flutter widget that allows its cells to span columns and rows and supports moving cells inside the grid. Feature

Evgeny Cherkasov 17 Nov 7, 2022