zuvola / flutter_simple_calculator

Flutter widget that provides simple calculator.
MIT License
22 stars 26 forks source link

Update current value from outside the calculator #3

Closed innerk closed 3 years ago

innerk commented 3 years ago

Hi i want to reset the current value from outside the calculator widget, setstate 0 on value = _currentvalue doesn't work,

any ideas?

zuvola commented 3 years ago

How about using 'CalcController.clear()' as below?

  final _controller = CalcController();
  @override
  Widget build(BuildContext context) {
    return SimpleCalculator(
      controller: _controller,
      onTappedDisplay: (value, details) {
        _controller.clear();
      },
    );
  }
innerk commented 3 years ago

Woaw awesome thanks!!!