asuka 2.1.0 copy "asuka: ^2.1.0" to clipboard
asuka: ^2.1.0 copied to clipboard

Show Snackbars, dialogs, ModalSheets and more in a single provider. Simple and Clean.

example/example.md

How to use #

Add the following code when calling your Material App:

import 'package:asuka/asuka.dart';

MaterialApp(
    builder: Asuka.builder,
    navigatorObservers: [
       Asuka.asukaHeroController //This line is needed for the Hero widget to work
    ],
);

Exemples #

Asuka Snackbars #

  • AsukaSnackbar.alert
import 'package:asuka/asuka.dart';

ElevatedButton(
onPressed: () {
  asuka.AsukaSnackbar.alert("Alert").show();
},
child: const Text("Show alert"),
)
  • AsukaSnackbar.info
import 'package:asuka/asuka.dart';

ElevatedButton(
onPressed: () {
  asuka.AsukaSnackbar.info("Info").show();
},
child: const Text("Show Info"),
)
  • AsukaSnackbar.message
import 'package:asuka/asuka.dart';

ElevatedButton(
onPressed: () {
  asuka.AsukaSnackbar.message("Message").show();
},
child: const Text("Show message"),
)
  • AsukaSnackbar.success
import 'package:asuka/asuka.dart';

ElevatedButton(
onPressed: () {
  asuka.AsukaSnackbar.success("Success").show();
},
child: const Text("Show success"),
)
  • AsukaSnackbar.warning
import 'package:asuka/asuka.dart';

ElevatedButton(
onPressed: () {
  asuka.AsukaSnackbar.warning("Warning").show();
},
child: const Text("Show warning"),
)

Asuka Examples #

  • Asuka.builder
import 'package:asuka/asuka.dart';

Widget builder(BuildContext context, Widget? child) {
  return Asuka.builder(context, child);
}
  • Asuka.showDialog
import 'package:asuka/asuka.dart';

 void onClickDialog() {
    Asuka.showDialog(
      builder: (context) => AlertDialog(
        title: const Text('My Dialog'),
        content: const Text('This is Dialog Content'),
        actions: [
          TextButton(
            onPressed: () {
              Navigator.pop(context);
            },
            child: const Text('Cancel'),
          ),
          TextButton(
            onPressed: () {
              Navigator.pop(context);
            },
            child: const Text('Ok'),
          ),
        ],
      ),
    );
  }
  • Asuka.showBottomSheet
import 'package:asuka/asuka.dart';

void onClickBottomSheet() {
    Asuka.showBottomSheet((context) {
      return Material(
        elevation: 7,
        child: SizedBox(
          height: MediaQuery.of(context).size.height / 2,
          child: ListView(
            children: [
              const ListTile(
                title: Text('Option 1'),
              ),
              const ListTile(
                title: Text('Option 2'),
              ),
              ListTile(
                title: const Text('Cancel'),
                onTap: () => Navigator.pop(context),
              ),
            ],
          ),
        ),
      );
    });
  }
  • Asuka.showModalBottomSheet
import 'package:asuka/asuka.dart';

void onClickModalBottomSheet() {
    Asuka.showModalBottomSheet(
      builder: (context) => Material(
        borderRadius: const BorderRadius.only(
          topLeft: Radius.circular(16),
          topRight: Radius.circular(16),
        ),
        elevation: 7,
        child: SizedBox(
          height: MediaQuery.of(context).size.height / 2,
          child: ListView(
            children: [
              const ListTile(
                title: Text('Option 1'),
              ),
              const ListTile(
                title: Text('Option 2'),
              ),
              ListTile(
                title: const Text('Cancel'),
                onTap: () => Navigator.pop(context),
              ),
            ],
          ),
        ),
      ),
      backgroundColor: Colors.transparent,
    );
  }
}
189
likes
0
pub points
91%
popularity

Publisher

verified publisherflutterando.com.br

Show Snackbars, dialogs, ModalSheets and more in a single provider. Simple and Clean.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on asuka