adaptive_extensions 0.0.4 copy "adaptive_extensions: ^0.0.4" to clipboard
adaptive_extensions: ^0.0.4 copied to clipboard

Material Widgets to Cupertino Widget, this package provides some simple adaptive conversions to Cupertino.

Add adaptive() after Material widget #

Inspired by the build-in adaptive widget like CircularProgressIndicator.adaptive(). All you need to get Cupertino widgets, add adaptive() after Material Widget.

TextButton(
    onPressed: showAdaptiveSnackbar,
    child: const Text('Adaptive TextButton'),
    ).adaptive(),
),

Screencast #

screenshot1

Visit https://dartpad.dev/?id=2f197147d498b0dca1bc9d6fe28ee7de

Usage #

Find material widgets and add adaptive() after them.

The extensions are automatically convert to Cupertino widgets only if the platform is IOS or MacOS.

final TextButton textbutton = TextButton(your code).adaptive();
final FilledButton filledButton = FilledButton(your code).adaptive();

// if you want to use TextButton.icon add icon inside the adaptive
final textbutton = TextButton(your code).adaptive(icon:Icon(Icons.abc));

Design Concept #

This package is composed with extentions of MaterialWidget. So these extensions are return material widget 'this'.

extension Adaptive on Material {
    dynamic adaptive({}){
        if (forceCupertino || Platform.isIOS || Platform.isMacOS) {
            return Cupertino;
        } else {
            return this; // Material;
        }
    }
}

Available Widgets #

Widget Material Cupertino adaptive_extensions
TextButton TextButton CupertinoButton TextButton.adaptive
TextButton with icon TextButton.icon CupertinoButton TextButton.adaptive(icon:Icon)
FilledButton FilledButton CupertinoButton.filled FilledButton.adaptive
FilledButton with icon FilledButton.icon CupertinoButton.filled FilledButton.adaptive(icon:Icon)
ListTile ListTile CupertinoListTile ListTile.adaptive
SnackBar or Toast SnackBar Toast-like SnackBar SnackBar.adaptive

on progress: segmentbutton

Available ThemeData #

Theme Material Cupertino adaptive_extensions
SnackBar or Toast SnackBarThemeData Toast-like SnackBarThemeData SnackBarThemeData.adaptive
AppBarTheme AppBarTheme Cupertino-like AppBarTheme AppBarTheme.adaptive

See also #

If you are looking for Switch,Slider,CircularProgressIndicator,CheckBox, or Radio, visit the Official document Automatic platform adaptations.

If you are looking for some adaptive dialogs, I suggest you to use adaptive_dialog package written by mono0926.com.

If you need more platform adaptive widgets, also see flutter_platform_widgets of stryder.dev.

1
likes
160
pub points
0%
popularity
screenshot

Publisher

verified publisherkoriai.com

Material Widgets to Cupertino Widget, this package provides some simple adaptive conversions to Cupertino.

Homepage
Repository (GitHub)
View/report issues

Topics

#ui #adaptive #widget #theme

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on adaptive_extensions