@@ -22,41 +22,49 @@ class _TwitterProfilePageState extends State<TwitterProfilePage> {
2222 body: NotificationListener <ScrollUpdateNotification >(
2323 onNotification: (scrollNotification) {
2424 final pixels = scrollNotification.metrics.pixels;
25- if (expandedHeader - pixels <= kToolbarHeight) {
26- if (isExpanded) {
27- translate = 0.0 ;
28- setState (() {
29- isExpanded = false ;
30- });
31- }
32- } else {
33- translate = - avatarMaximumRadius + pixels;
34- if (translate > 0 ) {
35- translate = 0.0 ;
36- }
37- if (! isExpanded) {
38- setState (() {
39- isExpanded = true ;
40- });
41- }
42- }
43-
44- offset = pixels * 0.4 ;
4525
46- final newSize = (avatarMaximumRadius - offset);
26+ // check if scroll is vertical ( left to right OR right to left)
27+ final scrollTabs =
28+ (scrollNotification.metrics.axisDirection == AxisDirection .right ||
29+ scrollNotification.metrics.axisDirection == AxisDirection .left);
4730
48- setState (() {
49- if (newSize < avatarMinimumRadius) {
50- avatarRadius = avatarMinimumRadius;
51- } else if (newSize > avatarMaximumRadius) {
52- avatarRadius = avatarMaximumRadius;
31+ if (! scrollTabs){ // and here prevents animation of avatar when you scroll tabs
32+ if (expandedHeader - pixels <= kToolbarHeight) {
33+ if (isExpanded) {
34+ translate = 0.0 ;
35+ setState (() {
36+ isExpanded = false ;
37+ });
38+ }
5339 } else {
54- avatarRadius = newSize;
40+ translate = - avatarMaximumRadius + pixels;
41+ if (translate > 0 ) {
42+ translate = 0.0 ;
43+ }
44+ if (! isExpanded) {
45+ setState (() {
46+ isExpanded = true ;
47+ });
48+ }
5549 }
56- });
50+
51+ offset = pixels * 0.4 ;
52+
53+ final newSize = (avatarMaximumRadius - offset);
54+
55+ setState (() {
56+ if (newSize < avatarMinimumRadius) {
57+ avatarRadius = avatarMinimumRadius;
58+ } else if (newSize > avatarMaximumRadius) {
59+ avatarRadius = avatarMaximumRadius;
60+ } else {
61+ avatarRadius = newSize;
62+ }
63+ });
64+ }
5765 },
5866 child: DefaultTabController (
59- length: 4 ,
67+ length: 8 ,
6068 child: CustomScrollView (
6169 physics: ClampingScrollPhysics (),
6270 slivers: < Widget > [
@@ -169,6 +177,18 @@ class TwitterTabs extends SliverPersistentHeaderDelegate {
169177 child: TabBar (
170178 isScrollable: true ,
171179 tabs: < Widget > [
180+ Tab (
181+ text: "Tweets" ,
182+ ),
183+ Tab (
184+ text: "Tweets & replies" ,
185+ ),
186+ Tab (
187+ text: "Media" ,
188+ ),
189+ Tab (
190+ text: "Likes" ,
191+ ),
172192 Tab (
173193 text: "Tweets" ,
174194 ),
0 commit comments