1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-10 14:58:34 +00:00

[VeggieSeasons] Fix dark mode problems (#395)

This commit is contained in:
Abdullah Deshmukh
2020-03-31 10:25:00 +05:30
committed by GitHub
parent 28742ddeaf
commit d9c9b3a519
12 changed files with 255 additions and 207 deletions

View File

@@ -36,44 +36,43 @@ class ListScreen extends StatelessWidget {
ScopedModel.of<AppState>(context, rebuildOnChange: true);
final prefs =
ScopedModel.of<Preferences>(context, rebuildOnChange: true);
return DecoratedBox(
decoration: BoxDecoration(color: Color(0xffffffff)),
child: SafeArea(
bottom: false,
child: ListView.builder(
itemCount: appState.allVeggies.length + 2,
itemBuilder: (context, index) {
if (index == 0) {
return Padding(
padding: const EdgeInsets.fromLTRB(16, 24, 16, 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(dateString.toUpperCase(), style: Styles.minorText),
Text('In season today', style: Styles.headlineText),
],
),
);
} else if (index <= appState.availableVeggies.length) {
return _generateVeggieRow(
appState.availableVeggies[index - 1],
prefs,
);
} else if (index <= appState.availableVeggies.length + 1) {
return Padding(
padding: const EdgeInsets.fromLTRB(16, 24, 16, 16),
child: Text('Not in season', style: Styles.headlineText),
);
} else {
int relativeIndex =
index - (appState.availableVeggies.length + 2);
return _generateVeggieRow(
appState.unavailableVeggies[relativeIndex], prefs,
inSeason: false);
}
},
),
final CupertinoThemeData themeData = CupertinoTheme.of(context);
return SafeArea(
bottom: false,
child: ListView.builder(
itemCount: appState.allVeggies.length + 2,
itemBuilder: (context, index) {
if (index == 0) {
return Padding(
padding: const EdgeInsets.fromLTRB(16, 24, 16, 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(dateString.toUpperCase(), style: Styles.minorText),
Text('In season today',
style: Styles.headlineText(themeData)),
],
),
);
} else if (index <= appState.availableVeggies.length) {
return _generateVeggieRow(
appState.availableVeggies[index - 1],
prefs,
);
} else if (index <= appState.availableVeggies.length + 1) {
return Padding(
padding: const EdgeInsets.fromLTRB(16, 24, 16, 16),
child: Text('Not in season',
style: Styles.headlineText(themeData)),
);
} else {
int relativeIndex =
index - (appState.availableVeggies.length + 2);
return _generateVeggieRow(
appState.unavailableVeggies[relativeIndex], prefs,
inSeason: false);
}
},
),
);
},