Skip to content

Instantly share code, notes, and snippets.

@hitherejoe
Created December 17, 2018 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hitherejoe/ef090056d00802710c39099a477ce88e to your computer and use it in GitHub Desktop.
Save hitherejoe/ef090056d00802710c39099a477ce88e to your computer and use it in GitHub Desktop.
class PlatformContent {
List<Widget> generate(int categoryIndex, int selectedCountryIndex) {
return _buildContentWidgets(categoryIndex, selectedCountryIndex);
}
List<Widget> _buildContentWidgets(
int categoryIndex, int selectedCountryIndex) {
if (Platform.isAndroid) {
return [
categoryIndex == 3
? _buildContentWidget(3, categoryIndex)
: _buildContentWidget(0, categoryIndex),
_buildContentWidget(1, categoryIndex),
_buildContentWidget(2, categoryIndex)
];
} else {
return categoryIndex == 3
? [_buildContentWidget(3, categoryIndex)]
: [_buildContentWidget(selectedCountryIndex, categoryIndex)];
}
}
Widget _buildContentWidget(int selectedCountryIndex, int navigationIndex) {
return SafeArea(
child: DocumentContent(
selectedCategory: categories[navigationIndex].documentName,
selectedCountry: countries[selectedCountryIndex].country,
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment