rescaleChooser method

Widget rescaleChooser()

Implementation

Widget rescaleChooser() {
  final TextEditingController valCtrl = TextEditingController();
  valCtrl.text = ref.read(intervalProvider.notifier).state.toString();

  return Row(
    spacing: configWidgetSpace,
    children: [
      configLeftGap,

      // Add tooltips to normaliseMethods ChoiceChipTip.

      ChoiceChipTip<String>(
        options: normaliseMethods,
        selectedOption: selectedTransform,
        onSelected: (String? selected) {
          setState(() {
            selectedTransform = selected ?? '';
          });
        },
        // Adding tooltips here.

        tooltips: normaliseMethodTooltips,
      ),

      // Add a ChoiceChip with Tooltip for RANK. This is separated out now so
      // that we can have a larger gap between this and INTERVAL. The INTERVAL
      // button needs to be closer to the INTERVAL number widget.

      ChoiceChipTip<String>(
        options: orderMethods.sublist(0, 1),
        selectedOption: selectedTransform,
        onSelected: (String? selected) {
          setState(() {
            selectedTransform = selected ?? '';
          });
        },

        // Adding tooltips here.

        tooltips: orderMethodTooltips,
      ),

      // Add tooltips to orderMethods ChoiceChipTip. INTERVAL

      ChoiceChipTip<String>(
        options: orderMethods.sublist(1),
        selectedOption: selectedTransform,
        onSelected: (String? selected) {
          setState(() {
            selectedTransform = selected ?? '';
          });
        },

        // Adding tooltips here.

        tooltips: orderMethodTooltips,
      ),

      NumberField(
        label: 'Interval',
        tooltip: '''

        When rescaling a numeric variable using an Interval, the numeric value
        here is the maximum value for the resulting interval. A default
        maximum value of 100 is often used. The minimum value is fixed as 0.

        ''',
        controller: valCtrl,

        // Allow integers only.

        inputFormatter: FilteringTextInputFormatter.digitsOnly,
        validator: (value) => validateInteger(value, min: 1),
        stateProvider: intervalProvider,

        // Enable only when "Interval" is selected.

        enabled: selectedTransform == 'Interval',
      ),
    ],
  );
}