Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
418 views
in Technique[技术] by (71.8m points)

dart - How to implement an "infinite" tabbar in flutter

I try to implement a tabbar with 3 items: (back arrow, dateText, forward arrow)

How can I do to have sort of infinite pageView (left or right). I would like to have this behaviour : When you press on the arrowButton, the dateText update and the view update also with the new date.

Is there any widget you recommend ? I try with a TabBar but when I pressed the forward or back arrow, it show me the new page view, but i'm block there, I can't pressed again and go further in date.

enter image description here

question from:https://stackoverflow.com/questions/66054704/how-to-implement-an-infinite-tabbar-in-flutter

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You don't need a tabbar for this case, just wrap leftArrowButton, dateText, rightArrowButton in Row,:

_date = currentDate

Column
  Row
    leftArrowButton: onTap (setState _date)
    Expanded
      _dateText(_date) //Widget Content consists of icons & date text
    rightArrowButton: onTap (setState _date)
  Expanded
    _widgetContent(_date) //return Widget Content based on _date

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...