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

Based on material widgets, this package provides some simple adaptive conversions to Cupertino widgets.

Screencast #

screenshot1

Basic Concept #

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

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

Example #

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

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 working: segmentbutton

Available ThemeData #

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

Installation #

Provides simple extensions for material widgets.

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));

Additional #

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.

2
likes
0
pub points
0%
popularity

Publisher

verified publisherkoriai.com

Based on material widgets, this package provides some simple adaptive conversions to Cupertino widgets.

Homepage

Topics

#ui #adaptive #widget #theme

License

unknown (license)

Dependencies

flutter

More

Packages that depend on adaptive_extensions