Skip to content

Commit

Permalink
Fix null pointer issue for isContinent
Browse files Browse the repository at this point in the history
  • Loading branch information
Ritam Chakraborty committed Apr 23, 2020
1 parent f949ff9 commit f27df2f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion lib/pages/country_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ class CountryDetails extends StatelessWidget {
final bool _isContinent;

const CountryDetails(
{GlobalData globalData, CountryData country, bool isContinent})
{@required GlobalData globalData,
@required CountryData country,
@required bool isContinent})
: this._globalData = globalData,
this._country = country,
this._isContinent = isContinent,
Expand Down
10 changes: 7 additions & 3 deletions lib/pages/country_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ class _CountryPageState extends State<CountryPage> {

/// Widget to show the country details
/// When pressed, navigate to [CountryDetails] page
Widget countryCard({CountryData data, int index, bool isContinent}) =>
Widget countryCard(
{@required CountryData data,
int index,
@required bool isContinent}) =>
Container(
padding: EdgeInsets.symmetric(horizontal: 16),
child: ListTile(
Expand Down Expand Up @@ -227,7 +230,6 @@ class _CountryPageState extends State<CountryPage> {
body: SafeArea(
child: Container(
alignment: Alignment.center,
// padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Consumer(
builder: (BuildContext context, DataProvider dataProvider,
Widget child) {
Expand Down Expand Up @@ -261,7 +263,9 @@ class _CountryPageState extends State<CountryPage> {
.toLowerCase()
.contains(filter)) {
/// If country name contains a part of filter text
return countryCard(data: list[index]);
return countryCard(
data: list[index],
isContinent: list.length < 7);
} else {
/// Otherwise
return Container();
Expand Down
2 changes: 0 additions & 2 deletions lib/widgets/data_connection_checker_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ class DataConnectionCheckerWidget extends StatelessWidget {
child: Consumer(
builder: (BuildContext context,
DataConnectionStatus dataConnectionStatus, Widget child) {
print(dataConnectionStatus);

switch (dataConnectionStatus) {
case DataConnectionStatus.disconnected:
return NoInternet();
Expand Down

0 comments on commit f27df2f

Please sign in to comment.