Commit 2c1e4b1
Reverts "Fix
<!-- start_original_pr_link -->
Reverts: flutter/flutter#162315
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: TahaTesser
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: Red tree due to unapproved golden images.
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: TahaTesser
<!-- end_original_pr_author -->
<!-- start_reviewers -->
Reviewed By: {justinmc}
<!-- end_reviewers -->
<!-- start_revert_body -->
This change reverts the following previous change:
Fixes
[https://github.com/flutter/flutter/issues/162098](https://github.com/flutter/flutter/issues/162098)
### Description
This PR fixes `Tab` linear and elastic animation blinks/flickers when
skipping multiple tabs. Previous attempt to fix elastic animation didn't
cover linear animation tests and didn't have enough number of tab items
which this PR fixes.
- Fixed Linear and elastic animation blink issue.
- Added tests for linear and elastic animation with various tab sizes
(LTR and RTL)
- Added tests for linear and elastic animation when skipping tabs (LTR
and RTL)
### Code Sample
<details>
<summary>expand to view the code sample</summary>
```dart
import 'package:flutter/material.dart';
// import 'package:flutter/scheduler.dart';
void main() {
// timeDilation = 10;
runApp(const TabBarDemo());
}
class TabBarDemo extends StatelessWidget {
const TabBarDemo({super.key});
@OverRide
Widget build(BuildContext context) {
final List<Widget> tabs = <Widget>[
const Tab(text: 'Short'),
const Tab(text: 'A Bit Longer Text'),
const Tab(text: 'An Extremely Long Tab Label That Overflows'),
const Tab(text: 'Tiny'),
const Tab(text: 'Moderate Length'),
const Tab(text: 'Just Right'),
const Tab(text: 'Supercalifragilisticexpialidocious'),
const Tab(text: 'Longer Than Usual'),
];
return MaterialApp(
home: DefaultTabController(
length: tabs.length,
child: Scaffold(
appBar: AppBar(
bottom: TabBar(
tabAlignment: TabAlignment.start,
isScrollable: true,
indicatorAnimation: TabIndicatorAnimation.elastic,
tabs: tabs,
),
title: const Text('Tabs Demo'),
),
body: TabBarView(
children: <Widget>[
for (int i = 0; i < tabs.length; i++) const Icon(Icons.directions_car),
],
),
),
),
);
}
}
```
</details>
### Before
https://github.com/user-attachments/assets/5c271948-5a01-4520-90a3-921c20c79470
### After
https://github.com/user-attachments/assets/6af32d43-3588-488f-ba50-be59323ed692
### Linear animation before (left) and After (right) comparison.
<img width="1048" alt="Screenshot 2025-01-28 at 17 27 50"
src="https://github.com/user-attachments/assets/4ba587a5-24d0-40ce-817c-366d004abc05"
/>
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
<!-- end_revert_body -->
Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>Tab linear and elastic animation blink (#162315)" (#162387)1 parent b007899 commit 2c1e4b1
2 files changed
Lines changed: 98 additions & 432 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
586 | 586 | | |
587 | 587 | | |
588 | 588 | | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
589 | 606 | | |
590 | 607 | | |
591 | | - | |
592 | | - | |
| 608 | + | |
| 609 | + | |
593 | 610 | | |
594 | 611 | | |
595 | 612 | | |
| |||
611 | 628 | | |
612 | 629 | | |
613 | 630 | | |
614 | | - | |
615 | | - | |
616 | | - | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | | - | |
625 | 631 | | |
626 | 632 | | |
627 | 633 | | |
| |||
633 | 639 | | |
634 | 640 | | |
635 | 641 | | |
636 | | - | |
637 | | - | |
638 | | - | |
639 | | - | |
640 | | - | |
641 | | - | |
642 | | - | |
643 | | - | |
644 | | - | |
645 | | - | |
646 | | - | |
647 | | - | |
648 | | - | |
649 | | - | |
650 | | - | |
651 | | - | |
652 | | - | |
653 | | - | |
654 | | - | |
655 | | - | |
656 | | - | |
657 | | - | |
| 642 | + | |
658 | 643 | | |
659 | 644 | | |
660 | 645 | | |
661 | 646 | | |
662 | | - | |
| 647 | + | |
663 | 648 | | |
664 | 649 | | |
| 650 | + | |
| 651 | + | |
665 | 652 | | |
666 | 653 | | |
667 | 654 | | |
| 655 | + | |
668 | 656 | | |
669 | 657 | | |
670 | 658 | | |
| |||
676 | 664 | | |
677 | 665 | | |
678 | 666 | | |
679 | | - | |
| 667 | + | |
680 | 668 | | |
681 | 669 | | |
682 | 670 | | |
| |||
713 | 701 | | |
714 | 702 | | |
715 | 703 | | |
716 | | - | |
| 704 | + | |
717 | 705 | | |
718 | 706 | | |
719 | 707 | | |
| |||
0 commit comments