mirror of
https://github.com/flutter/samples.git
synced 2025-11-10 14:58:34 +00:00
Samples maintenance (#435)
This commit is contained in:
@@ -28,7 +28,7 @@ class ServingInfoChart extends StatelessWidget {
|
||||
builder: (context, snapshot) {
|
||||
final target = snapshot?.data ?? 2000;
|
||||
final percent = standardPercentage * 2000 ~/ target;
|
||||
final CupertinoThemeData themeData = CupertinoTheme.of(context);
|
||||
final themeData = CupertinoTheme.of(context);
|
||||
|
||||
return Text(
|
||||
'$percent% DV',
|
||||
@@ -41,7 +41,7 @@ class ServingInfoChart extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final CupertinoThemeData themeData = CupertinoTheme.of(context);
|
||||
final themeData = CupertinoTheme.of(context);
|
||||
return Column(
|
||||
children: [
|
||||
SizedBox(height: 16),
|
||||
@@ -141,8 +141,8 @@ class ServingInfoChart extends StatelessWidget {
|
||||
future: prefs.desiredCalories,
|
||||
builder: (context, snapshot) {
|
||||
return Text(
|
||||
'Percent daily values based on a diet of ' +
|
||||
'${snapshot?.data ?? '2,000'} calories.',
|
||||
'Percent daily values based on a diet of '
|
||||
'${snapshot?.data ?? '2,000'} calories.',
|
||||
style: Styles.detailsServingNoteText(themeData),
|
||||
);
|
||||
},
|
||||
@@ -161,11 +161,12 @@ class InfoView extends StatelessWidget {
|
||||
|
||||
const InfoView(this.id);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final appState = ScopedModel.of<AppState>(context, rebuildOnChange: true);
|
||||
final prefs = ScopedModel.of<Preferences>(context, rebuildOnChange: true);
|
||||
final veggie = appState.getVeggie(id);
|
||||
final CupertinoThemeData themeData = CupertinoTheme.of(context);
|
||||
final themeData = CupertinoTheme.of(context);
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
|
||||
@@ -20,7 +20,7 @@ class ListScreen extends StatelessWidget {
|
||||
child: FutureBuilder<Set<VeggieCategory>>(
|
||||
future: prefs.preferredCategories,
|
||||
builder: (context, snapshot) {
|
||||
final data = snapshot.data ?? Set<VeggieCategory>();
|
||||
final data = snapshot.data ?? <VeggieCategory>{};
|
||||
return VeggieCard(veggie, inSeason, data.contains(veggie.category));
|
||||
}),
|
||||
);
|
||||
@@ -30,13 +30,13 @@ class ListScreen extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return CupertinoTabView(
|
||||
builder: (context) {
|
||||
String dateString = DateFormat("MMMM y").format(DateTime.now());
|
||||
var dateString = DateFormat('MMMM y').format(DateTime.now());
|
||||
|
||||
final appState =
|
||||
ScopedModel.of<AppState>(context, rebuildOnChange: true);
|
||||
final prefs =
|
||||
ScopedModel.of<Preferences>(context, rebuildOnChange: true);
|
||||
final CupertinoThemeData themeData = CupertinoTheme.of(context);
|
||||
final themeData = CupertinoTheme.of(context);
|
||||
return SafeArea(
|
||||
bottom: false,
|
||||
child: ListView.builder(
|
||||
@@ -66,7 +66,7 @@ class ListScreen extends StatelessWidget {
|
||||
style: Styles.headlineText(themeData)),
|
||||
);
|
||||
} else {
|
||||
int relativeIndex =
|
||||
var relativeIndex =
|
||||
index - (appState.availableVeggies.length + 2);
|
||||
return _generateVeggieRow(
|
||||
appState.unavailableVeggies[relativeIndex], prefs,
|
||||
|
||||
@@ -17,7 +17,7 @@ class VeggieCategorySettingsScreen extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final model = ScopedModel.of<Preferences>(context, rebuildOnChange: true);
|
||||
final currentPrefs = model.preferredCategories;
|
||||
Brightness brightness = CupertinoTheme.brightnessOf(context);
|
||||
var brightness = CupertinoTheme.brightnessOf(context);
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
middle: Text('Preferred Categories'),
|
||||
@@ -80,7 +80,7 @@ class CalorieSettingsScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final model = ScopedModel.of<Preferences>(context, rebuildOnChange: true);
|
||||
Brightness brightness = CupertinoTheme.brightnessOf(context);
|
||||
var brightness = CupertinoTheme.brightnessOf(context);
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
previousPageTitle: 'Settings',
|
||||
@@ -93,7 +93,7 @@ class CalorieSettingsScreen extends StatelessWidget {
|
||||
builder: (context, snapshot) {
|
||||
final steps = <SettingsItem>[];
|
||||
|
||||
for (int cals = max; cals < min; cals += step) {
|
||||
for (var cals = max; cals < min; cals += step) {
|
||||
steps.add(
|
||||
SettingsItem(
|
||||
label: cals.toString(),
|
||||
|
||||
Reference in New Issue
Block a user