ask 0.0.3 copy "ask: ^0.0.3" to clipboard
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
20
pub points
0%
popularity

Publisher

unverified uploader

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

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on ask