Skip to content

Problem with value update #3

@vincperrone

Description

@vincperrone

Hi, @Ali-Azmoud I have the same problem of #1 with version 0.1.2.
this is my code:

Future<void> _setCustomHours() async {
    return showDialog<void>(
      context: context,
      barrierDismissible: false,
      builder: (BuildContext context) {
        return AlertDialog(
          title: Text('Set hours', textAlign: TextAlign.center,),
          content: SingleChildScrollView(
            child: ListBody(
              mainAxis: Axis.vertical,
              children: <Widget>[
                Padding(
                  padding: EdgeInsets.only(
                    top:15.0
                  ),
                ),
                Center(
                  child: SpinnerInput(
                    minValue: 1,
                    maxValue: 10,
                    step: 0.5,
                    fractionDigits: 1,
                    disabledLongPress: true,
                    disabledPopup: true,
                    plusButton: SpinnerButtonStyle(
                      elevation: 3, 
                      height: 40,
                      width: 40,
                      color: Colors.grey[300], 
                      textColor: Colors.black, 
                      borderRadius: BorderRadius.circular(3)
                    ),
                    minusButton: SpinnerButtonStyle(
                      elevation: 3, 
                      height: 40,
                      width: 40,
                      color: Colors.grey[300], 
                      textColor: Colors.black, 
                      borderRadius: BorderRadius.circular(3)
                    ),
                    middleNumberWidth: 80,
                    middleNumberStyle: TextStyle(
                      fontSize: 14,
                      fontWeight: FontWeight.bold
                    ),
                    spinnerValue: hours, //hours is a double initialized to 1.0 in the State
                    onChange: (newValue) {
                      setState(() => hours = newValue);
                    },
                  ),
                ),
              ],
            ),
          ),
          actions: <Widget>[
            FlatButton(
              child: Text('OK'),
              onPressed: () {
                Navigator.of(context).pop();
              },
            )
          ],
        );
      },
    );
  }

When the app starts, I see the value 1.0.
If I tap + or - the value in the state gets updated, while the value I see on the view is still 1.0...

Any idea?
Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions