Skip to content

Commit

Permalink
image for no data on feeds adde ✅
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisamank committed May 4, 2021
1 parent ec6bcf5 commit 7a66744
Show file tree
Hide file tree
Showing 10 changed files with 201 additions and 138 deletions.
1 change: 1 addition & 0 deletions images/add-volunteer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
117 changes: 64 additions & 53 deletions lib/screens/feed/feed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:covid_care/constants/colors.dart';
import 'package:covid_care/view_model/feed/feed_list_item_view_model.dart';
import 'package:covid_care/view_model/feed/feed_list_view_model.dart';
import 'package:covid_care/view_model/feed/feed_view_model.dart';
import 'package:covid_care/widgets/not_found.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:toast/toast.dart';
Expand All @@ -21,66 +22,76 @@ class FeedPage extends StatelessWidget {
return StreamBuilder<QuerySnapshot>(
stream: feedViewModel.donarsAsStream(),
builder: (context, snapshot) {
if (snapshot.hasData) {
if (snapshot.connectionState == ConnectionState.active) {
final feedList = FeedListViewModel.fromSnapshot(snapshot.data);
donors = feedList.donors;
return Container(
width: size.width,
height: size.height,
child: ListView.builder(
itemCount: donors.length,
itemBuilder: (context, index) {
return Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: BrandColors.lightBlue,
),
height: 200,
width: size.width * .8,
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16, vertical: 8),
child: Column(
children: [
SizedBox(height: 8),
_cardTextWidget(
donors[index].volunteer.name,
"Name"),
SizedBox(height: 8),
_cardTextWidget(
donors[index].volunteer.bloodGroup,
"Blood Group"),
SizedBox(height: 8),
_cardTextWidget(
'${donors[index].volunteer.city}, ${donors[index].volunteer.location}',
"Location"),
SizedBox(height: 8),
_cardTextWidget(
donors[index].volunteer.covidMonth,
"Recovered\nfrom Covid"),
],
if (feedList.donors.length > 0) {
donors = feedList.donors;
return Container(
width: size.width,
height: size.height,
child: ListView.builder(
itemCount: donors.length,
itemBuilder: (context, index) {
return Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: BrandColors.lightBlue,
),
height: 200,
width: size.width * .8,
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16, vertical: 8),
child: Column(
children: [
SizedBox(height: 8),
_cardTextWidget(
donors[index].volunteer.name,
"Name"),
SizedBox(height: 8),
_cardTextWidget(
donors[index]
.volunteer
.bloodGroup,
"Blood Group"),
SizedBox(height: 8),
_cardTextWidget(
'${donors[index].volunteer.city}, ${donors[index].volunteer.location}',
"Location"),
SizedBox(height: 8),
_cardTextWidget(
donors[index]
.volunteer
.covidMonth,
"Recovered\nfrom Covid"),
],
),
),
),
_callNowButton(
donors[index], feedViewModel, context)
],
_callNowButton(
donors[index], feedViewModel, context)
],
),
),
),
),
);
},
));
} else
);
},
));
} else {
return VolunteerNotFound(
"No Donars found for this blood group");
}
} else {
return Center(
child: CircularProgressIndicator(
backgroundColor: BrandColors.blue));
}
});
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class VolunteerPage extends StatelessWidget {
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(),
VolunteerFeed(),
GestureDetector(
onTap: () {
Expand Down
Loading

0 comments on commit 7a66744

Please sign in to comment.