build method

  1. @override
Widget build(
  1. BuildContext context
)
override

Build a widget.

Implementation

@override
Widget build(final BuildContext context) => Cancel(
      child: SimpleScaffold(
        actions: [
          SaveButton(
            onPressed: () {
              Navigator.pop(context);
              widget.onChanged(
                Duration(
                  days: days,
                  hours: hours,
                  minutes: minutes,
                  seconds: seconds,
                  milliseconds: milliseconds,
                ),
              );
            },
          ),
        ],
        title: widget.title,
        body: Column(
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          children: [
            Slider(
              value: days.toDouble(),
              onChanged: (final value) => setState(
                () => days = value.round(),
              ),
              label: 'Days',
              autofocus: true,
              max: 364,
              divisions: 364,
              semanticFormatterCallback: (final value) => formatValue(
                value,
                'day',
              ),
            ),
            Slider(
              value: hours.toDouble(),
              onChanged: (final value) => setState(
                () => hours = value.round(),
              ),
              label: 'Hours',
              max: 23,
              divisions: 23,
              semanticFormatterCallback: (final value) => formatValue(
                value,
                'hour',
              ),
            ),
            Slider(
              value: minutes.toDouble(),
              onChanged: (final value) => setState(
                () => minutes = value.round(),
              ),
              label: 'Minutes',
              max: 59,
              divisions: 59,
              semanticFormatterCallback: (final value) => formatValue(
                value,
                'minute',
              ),
            ),
            Slider(
              value: seconds.toDouble(),
              onChanged: (final value) => setState(
                () => seconds = value.round(),
              ),
              label: 'Seconds',
              max: 59,
              divisions: 59,
              semanticFormatterCallback: (final value) => formatValue(
                value,
                'second',
              ),
            ),
            Slider(
              value: milliseconds.toDouble(),
              onChanged: (final value) => setState(
                () => milliseconds = value.round(),
              ),
              label: 'Milliseconds',
              max: 999,
              divisions: 999,
              semanticFormatterCallback: (final value) => formatValue(
                value,
                'millisecond',
              ),
            ),
          ],
        ),
      ),
    );