Fix logic to hide values on page change

This commit is contained in:
Ricardo Markiewicz
2019-07-02 10:20:02 -03:00
parent eb0d9cd524
commit 99de6c4ef9
+7 -4
View File
@@ -107,7 +107,7 @@ class _HomePageState extends State<HomePage> {
StreamBuilder<QuerySnapshot>( StreamBuilder<QuerySnapshot>(
stream: _query, stream: _query,
builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> data) { builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> data) {
if (data.hasData) { if (data.connectionState == ConnectionState.active) {
if (data.data.documents.length > 0) { if (data.data.documents.length > 0) {
return MonthWidget( return MonthWidget(
days: daysInMonth(currentPage + 1), days: daysInMonth(currentPage + 1),
@@ -132,8 +132,10 @@ class _HomePageState extends State<HomePage> {
} }
} }
return Center( return Expanded(
child: CircularProgressIndicator(), child: Center(
child: CircularProgressIndicator(),
),
); );
}, },
), ),
@@ -177,8 +179,9 @@ class _HomePageState extends State<HomePage> {
size: Size.fromHeight(70.0), size: Size.fromHeight(70.0),
child: PageView( child: PageView(
onPageChanged: (newPage) { onPageChanged: (newPage) {
var user = Provider.of<LoginState>(context).currentUser();
setState(() { setState(() {
var user = Provider.of<LoginState>(context).currentUser();
currentPage = newPage; currentPage = newPage;
_query = Firestore.instance _query = Firestore.instance
.collection('users') .collection('users')