flutternumberpicker

How to use NumberPicker's textMapper(Flutter)?


enter image description here

I am trying to use textMapper to change the text shown in NumberPicker.

I found the TextMapper class, but I don't know how to use it. Please tell me how to use textMapper


Solution

  • Its basically a method that takes a String argument and returns a String value that transforms the input.

    eg:

    String modifyText(String s){
      return "Value " +s; // Appends "Value" to the String s
    }
    

    Can be set to the textMapper property to show the values in the picker as "Value ..." instead of just '...'