smart_dialogs 2.1.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 75

Smart Dialogs for Web Apps #

What the package can do for you #

  • You want to show an alert message?
  • You want to let something confirm?
  • You want to show a dialog with several action buttons to offer a choice?
  • You want to request input from a user, e.g. via text entry fields, combo boxes, radio or check buttons?
  • You want to have all this with a consistent default style?
  • You want to configure the style yourself?
  • You want to open the operating system's file selection dialog?
  • You want to display a panel containing clickable icons to start actions?
  • You want to show popup menus with clickable menu items?
  • You want to show a fine table displaying table data for your users?
  • You want to show such a table, but also with interactive input elements (buttons, text entry fields)?
  • And you want to program this with a few lines of code, compatible with Chrome(Windows/Linux/Android), Safari (Mac/IOS), and MS Edge, without importing extra packages, just based on standard Dart packages, especially on 'Dart.html'.?
  • You are looking for simple code examples to start with?

Then your are exactly right here. The focus of this package is the ease-of-use of the provided functionalities.

Display the examples #

  • Click here to view the examples: smart_dialog examples

  • Or, download and unpack the package, then execute the file example/example.html in your browser.

Dialogs #

For convenience and ease-of-use, employ the following asynchronous functions (see API for details).

  • Info.show(..) or Info.showGo(..)- display a message.
  • Info.confirm(..) - confirm a message (optionally with multiple confirm buttons).
  • Info.get(..) - display a dialog an return the user's input from the text entry fields, combo boxes, radio or check buttons.
  • Info.get2D(..) - similar to Info.get(), however the displayed dialog provides two columns of text entry fields, combo boxes, etc..

These methods display a dialog and return a Future of type UserInput, containing everything the user entered into the dialog, including which buttons were pressed.

For additional flexibility, dialogs can be opened by using their respective constructors. Modal (blocking) and non-modal dialogs are supported. Constructors require a callback function invoked when a button is pressed.

A special dialog provides access to the operating system's file selection dialog:

  • FileSelectionDialog(..) (the constructor)

Table, Icon Panel, Popup Menu #

This package provides the following GUI elements in addition to dialogs :

  • BasicTable - display table data, and provide access to the data a user entered into the optional interactive elements of the table. A table must be embedded into a parent html element for display, e.g. into a dialog (demonstrated by the examples of this package), a user provided div, etc.
  • IconPanel - a rectangular grid of icons acting as buttons with assigned action functions,
  • PopupMenu - a popup menu with a list of menu items, acting as buttons with assigned action functions.

Style configuration #

The classes DiaAttr and TableAttr contain style attribute names and their defaults for various screen sizes (PC, Tablet, Phone) and attribute setter methods for Dialogs and Tables, respectively. See also the example source files where style changes are demonstrated.

smart_arrays_base: Basic functions for 1D and 2D arrays

smart_arrays_numerics: Numerics with 1D and 2D arrays

smart_arrays_compress: Compress 1D and 2D arrays to a smaller size.

smart_arrays_sample_data: Computes 1D and 2D arrays containing sample data.

smart_arrays_dbstore: Store 1D and 2D arrays along with metadata on the local device.

smart_arrays_peaks: Detect peaks in 1D and 2D arrays.

smart_arrays_contour_finder: Contours the three-dimensional surface represented by the values f(x,y) of a matrix.

smart_arrays_plot_polyline: Plots 1D arrays as polyline along with axes and more.

smart_arrays_lmfit: Fits (x, y) data given as arrays to a specified model function using the Levenberg-Marquardt algorithm.

smart_lorentz_gauss: Compute Lorentz-Gauss (pseudo-Voigt) line shapes.

smart_signal_processing: Fourier transform and more of arrays.

smart_dialogs: Easy-to-use dialogs in Web applications

Smart Dialogs for Web Apps #

Version history #

2.1.2 - 2019-10-10 MadeInfo.showGo static.

2.1.1 - 2019-10-10 Added method Info.showGo.

2.1.0 - 2019-10-05 Now sdk 2.5.0 in pubspec.

2.0.0 - 2019-03-04 First version available on pub site.

2.0.1 - 2019-03-05 Fixed some code health issues.

2.0.2 - 2019-03-05 Fixed link to executable example.

2.0.3 - 2019-03-06 Fixed bug when clicking into opened combo box.

2.0.4 - 2019-03-07 Now uses the analysis_options.yaml file of the pedantic Dart package for code checking.

2.0.5 - 2019-03-10 Simplified example.

2.0.6 - 2019-03-24 Updated docs.

2.0.7 - 2019-04-04 Updated docs.

2.0.8 - 2019-04-09 Fixed issue with dialogs containing combo box

2.0.9 - 2019-04-23 [TableAttr.attr] is now initialized with defaults, no longer null initially.

2.0.10 - 2019-04-27 Improved documentation.

2.0.11 - 2019-05-06 Updated docs.

2.0.12 - 2019-07-11 Updated docs.

2.0.13 - 2019-08-01 Fixed health suggestions of pub.dev.

2.0.14 - 2019-08-01 More fixes according to health suggestions of pub.dev

2.0.15 - 2019-08-04 Using package:pedantic/analysis_options.yaml from now on.

example/main.dart

// Copyright (c) 2019, Dr. Bruno Guigas. All rights reserved. Use of this source
// code is governed by a BSD-style license that can be found in the LICENSE file.
//
// To execute this example, visit the following page:
//   https://smart.specpad.bplaced.net/smart_dialogs/example.html

import 'package:smart_dialogs/smart_dialogs.dart';

import 'dart:html';
import 'src/examples.dart';

main() {
  ExampleDispatcher();
}

/// Displays a dialog to select and execute examples
class ExampleDispatcher {
  static List<String> itemsChecked;
  static DivElement app_div;

  List<String> items = [
    "Info Dialog",
    "Confirm Dialog",
    "Single-Line Input Dialog",
    "Multi-Line Input Dialog",
    "Advanced Input Dialog with Check Buttons",
    "Advanced Input Dialog with Radio Buttons",
    "Advanced Input Dialog with Radio Buttons, 2D",
    "Non-Modal Dialog",
    "System's File Selection Dialog",
    "Change Dialog Attributes",
    "Icon Panel",
    "Popup Menu",
    "Simple Table",
    "Interactive Table"
  ];

  List<Function> itemsFuncs = [
    showInfoDialog,
    showConfirmDialog,
    showSingleLineInputDialog,
    showMultiLineInputDialog,
    showAdvancedInputDialogCheckButtons,
    showAdvancedInputDialogRadioButtons,
    showAdvancedInputDialog2D,
    showNonModalDialog,
    showFileInputDialog,
    DialogAttributeChanger.changeDialogAttributes,
    showIconPanel,
    showPopupMenu,
    showSimpleTable,
    showInterActiveTable
  ];

  ExampleDispatcher() {
    showDialogExamples();
  }

  /// Shows the example options and displays the selected dialog example
  void showDialogExamples() async {
    app_div = (querySelector("#app_div") as DivElement);
    if (itemsChecked == null) {
      itemsChecked = List<String>.filled(items.length, DiaUtils.FALSE);
      itemsChecked[0] = DiaUtils.TRUE;
    }

    UserInput uin = await Info.get(
        DiaAttr.RADIO,
        "Examples for the Dart package <i>smart_dialogs</i>." +
            "<br>Please select an example and press OK",
        items,
        null,
        List.filled(items.length, null),
        List<int>.filled(items.length, 0),
        itemsChecked,
        true,
        null);

    if (uin.buttonCode == DiaAttr.DIA_ACT_OK) {
      itemsChecked = List<String>.filled(itemsChecked.length, DiaUtils.FALSE);
      for (int i = 0; i < items.length; i++) {
        if (uin.getCheckedState(i) == DiaUtils.TRUE) {
          itemsChecked[i] = DiaUtils.TRUE;
          DiaAttr.initAttrFromDefaults();
          await itemsFuncs[i](); // execute selected example
          break;
        }
      }
    }
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  smart_dialogs: ^2.1.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:smart_dialogs/smart_dialogs.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
50
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
75
Learn more about scoring.

We analyzed this package on Oct 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21

Platforms

Detected platforms: web

Primary library: package:smart_dialogs/smart_dialogs.dart with components: html.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.5.0 <3.0.0
build_runner ^1.6.2 1.7.1 1.7.2
build_web_compilers ^2.0.0 2.7.0
pedantic ^1.7.0 1.8.0+1
Transitive dependencies
analyzer 0.38.5 0.39.0
archive 2.0.10
args 1.5.2
async 2.4.0
bazel_worker 0.1.23
build 1.2.0
build_config 0.4.1+1
build_daemon 2.1.0
build_modules 2.6.2
build_resolvers 1.2.1
build_runner_core 4.1.0
built_collection 4.2.2
built_value 6.7.1
charcode 1.1.2
checked_yaml 1.0.2
code_builder 3.2.0
collection 1.14.12
convert 2.1.1
crypto 2.1.3
csslib 0.16.1
dart_style 1.3.2
fixnum 0.10.9
front_end 0.1.27 0.1.28
glob 1.2.0
graphs 0.2.0
html 0.14.0+3
http 0.12.0+2
http_multi_server 2.1.0
http_parser 3.1.3
io 0.3.3
js 0.6.1+1
json_annotation 3.0.0
kernel 0.3.27 0.3.28
logging 0.11.3+2
matcher 0.12.6
meta 1.1.7
mime 0.9.6+3
node_interop 1.0.3
node_io 1.0.1+2
package_config 1.1.0
package_resolver 1.0.10
path 1.6.4
pool 1.4.0
protobuf 1.0.0
pub_semver 1.4.2
pubspec_parse 0.1.5
quiver 2.0.5
scratch_space 0.0.4+1
shelf 0.7.5
shelf_web_socket 0.2.3
source_maps 0.10.8
source_span 1.5.5
stack_trace 1.9.3
stream_channel 2.0.0
stream_transform 0.0.19
string_scanner 1.0.5
term_glyph 1.1.0
timing 0.1.1+2
typed_data 1.1.6
watcher 0.9.7+12
web_socket_channel 1.1.0
yaml 2.2.0