ask 0.0.3
ask: ^0.0.3 copied to clipboard

Create verification, radio, checkbox, and other dialogs using only a few lines of code.

example/lib/main.dart

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

void main() {
  runApp(MaterialApp(
    home: Scaffold(
      body: Center(
        child: Builder(
          builder: (context) => RaisedButton(
            child: Text('ask'),
            onPressed: () async {
              bool value = await ask(
                  title: 'Unsaved File',
                  message: 'Do you really want to discard this file?',
                  context: context,
                  defaultValue: false,
                  buttons: [
                    AskButton(
                        value: true,
                        text: 'YES',
                        type: AskButtonType.text,
                        color: Colors.red),
                    AskButton(
                        value: false,
                        text: 'NO',
                        type: AskButtonType.flat,
                        color: Colors.green),
                  ]);
              ScaffoldMessenger.of(context).showSnackBar(SnackBar(
                content: Text(
                    'The user click the button with value ${value ? 'YES' : 'NO'}.'),
              ));
            },
          ),
        ),
      ),
    ),
  ));
}
2
likes
100
pub points
0%
popularity

Create verification, radio, checkbox, and other dialogs using only a few lines of code.

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on ask