https://github.com/vellt/tabbarview-notifies-the-view-without-delay
I demonstrate the ability of TabBarView to notify the view with the correct index without delay. Documentation in the rows of the code.
https://github.com/vellt/tabbarview-notifies-the-view-without-delay
delay issues tabbarview
Last synced: 3 months ago
JSON representation
I demonstrate the ability of TabBarView to notify the view with the correct index without delay. Documentation in the rows of the code.
- Host: GitHub
- URL: https://github.com/vellt/tabbarview-notifies-the-view-without-delay
- Owner: vellt
- Created: 2023-01-30T18:00:50.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-11T14:38:33.000Z (over 3 years ago)
- Last Synced: 2025-09-08T06:01:52.540Z (11 months ago)
- Topics: delay, issues, tabbarview
- Language: C++
- Homepage:
- Size: 997 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TabBarView notifies the View without delay⏱️
I encountered an interesting problem throgh a project, with many open issues on the Web, such as:
- [TabController notifies correct index with a delay (after the tab scroll animation ends) #88875](https://github.com/flutter/flutter/issues/88875)
- [TabController listener triggers with delay on swipe #89371](https://github.com/flutter/flutter/issues/89371)
- [Describe how to listen for page updates in TabBar and TabBarView when using DefaultTabController #53155](https://github.com/flutter/flutter/issues/53155)
I demonstrate the ability of TabBarView to notify the view with the correct index without delay. ✅
Documentation in the [the rows of the code](https://github.com/vellt/TabBarView-Notifies-The-View-Without-Delay/blob/main/lib/main.dart). ✍️
The soul of the project:
```dart
// indexController.change() comes from IndexController, which is declared in main.dart.
var _ = DefaultTabController.of(context);
_?.animation!.addListener(() {
indexController.change(newValue:(_.indexIsChanging)?_.index:_.animation!.value.round());
});
```
🎥 Here is a **preview GIF**, where you can see, how it works: