showRangeSlider method

void showRangeSlider()

Displays a range slider for adjusting the line width of the painting tool.

This method shows a range slider in a modal bottom sheet for adjusting the line width of the painting tool.

Implementation

void showRangeSlider() {
  showModalBottomSheet(
    context: context,
    backgroundColor: widget.initConfigs.imageEditorTheme.paintingEditor
        .lineWidthBottomSheetColor,
    builder: (BuildContext context) {
      return StatefulBuilder(builder: (context, setState) {
        return Material(
          color: Colors.transparent,
          textStyle:
              platformTextStyle(context, widget.initConfigs.designMode),
          child: SingleChildScrollView(
            physics: const ClampingScrollPhysics(),
            child: Padding(
              padding: const EdgeInsets.fromLTRB(16, 0, 16, 16),
              child: Column(
                mainAxisSize: MainAxisSize.min,
                crossAxisAlignment: CrossAxisAlignment.stretch,
                children: [
                  BottomSheetHeaderRow(
                    title: widget.initConfigs.i18n.paintEditor.lineWidth,
                    theme: widget.initConfigs.theme,
                  ),
                  StatefulBuilder(builder: (context, setState) {
                    return Slider.adaptive(
                      max: 40,
                      min: 2,
                      divisions: 19,
                      value: _paintCtrl.strokeWidth,
                      onChanged: (value) {
                        setStrokeWidth(value);
                        setState(() {});
                      },
                    );
                  }),
                ],
              ),
            ),
          ),
        );
      });
    },
  );
}