easy_dialogs 1.0.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new65

easy_dialogs

Easy to use dialogs with lists

  • SingleChoiceDialog
  • SingleChoiceConfirmationDialog
SingleChoiceConfirmationDialog 1SingleChoiceConfirmationDialog 2SingleChoiceDialog

SingleChoiceConfirmationDialog 1

SingleChoiceConfirmationDialog<String>(
            title: Text('Phone ringtone'),
            initialValue: _ringTone,
            items: _ringTones,
            onSelected: _onSelected,
            onSubmitted: _onSubmitted)

SingleChoiceConfirmationDialog 2

SingleChoiceConfirmationDialog<Color>(
            title: Text('Color'),
            initialValue: _color,
            items: _colors,
            contentPadding: EdgeInsets.symmetric(vertical: 16.0),
            divider: Container(
              height: 1.0,
              color: Colors.blue,
            ),
            onSubmitted: (Color color) {
              setState(() => _color = color);
            },
            itemBuilder: (Color color) =>
                Container(height: 100.0, color: color))

SingleChoiceDialog

SingleChoiceDialog<Color>(
              isDividerEnabled: true,
              title: Text('Pick a color'),
              items: _colors,
              onSelected: (Color color) {
                setState(() => _color = color);
              },
              itemBuilder: (Color color) =>
                  Container(height: 100.0, color: color))

[1.0.0] - 9/9/2018

  • Initial Release 🎉
  • It includes [SingleChoiceDialog] and [SingleChoiceConfirmationDialog]

example/lib/main.dart

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Easy Dialogs Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      routes: {
        '/': (context) => HomePage(),
      },
    );
  }
}

class HomePage extends StatefulWidget {
  @override
  HomePageState createState() {
    return new HomePageState();
  }
}

class HomePageState extends State<HomePage> {
  final List<String> _ringTones = [
    'None',
    'Callisto',
    'Ganymede',
    'Luna',
    'Oberon',
    'Phobos',
    'Dione',
    'Jungle Gym',
    'Ukulele',
    'Snowflakes',
  ];

  final List<Color> _colors = [
    Colors.orange,
    Colors.pinkAccent,
    Colors.black,
    Colors.blue,
    Colors.brown,
    Colors.green,
  ];

  String _ringTone = "None";

  Color _color = Colors.black;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Settings'),
      ),
      body: ListView(
        children: <Widget>[
          ListTile(
            onTap: _openRingtoneDialog,
            title: Text('Ringtone'),
            subtitle: Text(_ringTone),
            leading: Icon(Icons.music_note),
          ),
          ListTile(
              onTap: _openColorDialog,
              title: Text('Color'),
              subtitle: Container(
                margin: EdgeInsets.only(top: 8.0),
                height: 20.0,
                color: _color,
              ),
              leading: Icon(Icons.colorize)),
          ListTile(
              onTap: _openColorDialogWithoutConfirmation,
              title: Text('Color without confirmation'),
              subtitle: Container(
                margin: EdgeInsets.only(top: 8.0),
                height: 20.0,
                color: _color,
              ),
              leading: Icon(Icons.colorize)),
        ],
      ),
    );
  }

  _openRingtoneDialog() {
    showDialog(
        context: context,
        builder: (context) => SingleChoiceConfirmationDialog<String>(
            title: Text('Phone ringtone'),
            initialValue: _ringTone,
            items: _ringTones,
            onSelected: _onSelected,
            onSubmitted: _onSubmitted));
  }

  _openColorDialog() {
    showDialog(
      context: context,
      builder: (context) => SingleChoiceConfirmationDialog<Color>(
            title: Text('Color'),
            initialValue: _color,
            items: _colors,
            contentPadding: EdgeInsets.symmetric(vertical: 16.0),
            divider: Container(
              height: 1.0,
              color: Colors.blue,
            ),
            onSubmitted: (Color color) {
              setState(() => _color = color);
            },
            itemBuilder: (Color color) =>
                Container(height: 100.0, color: color),
          ),
    );
  }

  _openColorDialogWithoutConfirmation() {
    showDialog(
        context: context,
        builder: (context) => SingleChoiceDialog<Color>(
              isDividerEnabled: true,
              title: Text('Pick a color'),
              items: _colors,
              onSelected: (Color color) {
                setState(() => _color = color);
              },
              itemBuilder: (Color color) =>
                  Container(height: 100.0, color: color),
            ));
  }

  void _onSelected(String value) {
    print('Selected $value');
    setState(() {
      _ringTone = value;
    });
  }

  void _onSubmitted(String value) {
    print('Submitted $value');
    setState(() {
      _ringTone = value;
    });
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  easy_dialogs: ^1.0.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:easy_dialogs/easy_dialogs.dart';
  
Version Uploaded Documentation Archive
1.0.0 Sep 9, 2018 Go to the documentation of easy_dialogs 1.0.0 Download easy_dialogs 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
38
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
65
Learn more about scoring.

We analyzed this package on Sep 18, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.3
  • Flutter: 0.8.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Suggestions

The description is too short.

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test