flutter_calendar icon indicating copy to clipboard operation
flutter_calendar copied to clipboard

Calendar header handling animation controller incorrectly

Open UnicornaasTech opened this issue 3 years ago • 2 comments

Hello,

It seems that _CalendarHeaderState causes the following exception: flutter error: This widget has been unmounted, so the State no longer has a context (and should be considered defunct)

The fix: 1: Move initialization of _controller to initState(): _controller=AnimationController(duration: _kExpand, vsync: this);

2: Move everything in consctructor to initState() (after setting the _controller): _monthIndex = monthIndexFromTime(clock.now()); _easeInAnimation = CurvedAnimation(parent: _controller, curve: Curves.easeIn); _iconTurns = Tween(begin: 0.0, end: 0.5).animate(_easeInAnimation);

HTH :)

UnicornaasTech avatar Apr 16 '22 18:04 UnicornaasTech

It works, thanks a log.

jiazeh avatar May 23 '22 08:05 jiazeh

Thanks a lot, it's work

Harishsharma714 avatar Sep 21 '22 18:09 Harishsharma714