launchNumberPickerDialog function

void launchNumberPickerDialog(
  1. BuildContext context,
  2. {required int minValue,
  3. required int maxValue,
  4. int? itemCount,
  5. Icon? headerIcon,
  6. bool infiniteLoop = true,
  7. Axis? alignment,
  8. required String headerMessage,
  9. String? comment,
  10. required void onChange(
    1. int res
    )}
)

Implementation

void launchNumberPickerDialog(BuildContext context,
        {required int minValue,
        required int maxValue,
        int? itemCount,
        Icon? headerIcon,
        bool infiniteLoop = true,
        Axis? alignment,
        required String headerMessage,
        String? comment,
        required void Function(int res) onChange}) =>
    Navigator.of(context).push(
        MaterialPageRoute<Widget>(builder: (BuildContext context) {
      return Scaffold(
          appBar: AppBar(
              title: Row(children: <Widget>[
            const Icon(Icons.numbers_rounded),
            const SizedBox(width: 8),
            Text(headerMessage)
          ])),
          body: SafeArea(
              child: SingleChildScrollView(
                  child: _InternalNumberPicker(
                      infiniteLoop: infiniteLoop,
                      alignment: alignment,
                      itemCount: itemCount ??
                          maxValue.abs().toString().length,
                      minValue: minValue,
                      maxValue: maxValue,
                      onChange: onChange))));
    }));