**EDIT --------->
Additional info. It is possible that I am going about it all wrong. I am trying to achieve the image below. Is an infinite scrolling "calendar" that shows a feed for the corresponding day. I'm beginning to think this is not a tab view issue and it needs to be done some other way.
------------------>
I'm creating an app that creates a StreamBuilder in Flutter that relies on comparing a date to return Firestore data.
I've created an array of possible date tab values. When the user selects that tab I need to compare the DATE ONLY - no timestamp and show a stream of games that have a matching date field in local time.
I have multiple tabs with one changing view so it isn't a 1:1 ratio of tabs to widgets but the tab needs to control the state of the widget by returning the date value at a clicked index and setting that to stateDate.
Also it would be great to start the user selected on the tab that is todays date.
var datesList = [];
var _stateDate = DateTime.now();
initState(){
for (int i = -14; i < 57; i++) {
DateTime date = _stateDate;
date = date.add(Duration(days: i));
datesList.add(date);
}
}
------------------------------------------------------>
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: dateList.length,
child: Scaffold(
appBar: AppBar(
bottom: const PreferredSize(
preferredSize: Size.zero,
child: TabBar(
tabs: <Widget>[
_buildTabs(),
],
isScrollable: true,
),
),
),
body: TabBarView(
children: <Widget>[
_buildSchedule()
],
),
),
);
}
@override
Widget _buildSchedule() {
return Container(
child: Center(
child: StreamBuilder<QuerySnapshot>(
stream: Firestore.instance
.collection('schedule')
.where('time', isEqualTo: _stateDate)
.orderBy('date')
.snapshots(),
builder:
(BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
if (!snapshot.hasData) {
return const Text('Loading...');
}
return ListView.builder(
itemCount: snapshot.data.documents.length,
itemBuilder: (BuildContext context, int index) =>
_buildScheduleItem(context, snapshot.data.documents[index]),
);
}),
),
);
}
Any help would be great. Maybe I am just thinking about it all wrong.

