|
3 | 3 | // found in the LICENSE file. |
4 | 4 |
|
5 | 5 | import 'package:flutter/cupertino.dart'; |
| 6 | +import 'package:flutter/services.dart'; |
6 | 7 | import 'package:flutter/widgets.dart'; |
7 | 8 | import 'package:intl/intl.dart'; |
8 | 9 | import 'package:provider/provider.dart'; |
@@ -40,43 +41,48 @@ class ListScreen extends StatelessWidget { |
40 | 41 | final appState = Provider.of<AppState>(context); |
41 | 42 | final prefs = Provider.of<Preferences>(context); |
42 | 43 | final themeData = CupertinoTheme.of(context); |
43 | | - return SafeArea( |
44 | | - bottom: false, |
45 | | - child: ListView.builder( |
46 | | - restorationId: 'list', |
47 | | - itemCount: appState.allVeggies.length + 2, |
48 | | - itemBuilder: (context, index) { |
49 | | - if (index == 0) { |
50 | | - return Padding( |
51 | | - padding: const EdgeInsets.fromLTRB(16, 24, 16, 16), |
52 | | - child: Column( |
53 | | - crossAxisAlignment: CrossAxisAlignment.start, |
54 | | - children: [ |
55 | | - Text(dateString.toUpperCase(), style: Styles.minorText), |
56 | | - Text('In season today', |
57 | | - style: Styles.headlineText(themeData)), |
58 | | - ], |
59 | | - ), |
60 | | - ); |
61 | | - } else if (index <= appState.availableVeggies.length) { |
62 | | - return _generateVeggieRow( |
63 | | - appState.availableVeggies[index - 1], |
64 | | - prefs, |
65 | | - ); |
66 | | - } else if (index <= appState.availableVeggies.length + 1) { |
67 | | - return Padding( |
68 | | - padding: const EdgeInsets.fromLTRB(16, 24, 16, 16), |
69 | | - child: Text('Not in season', |
70 | | - style: Styles.headlineText(themeData)), |
71 | | - ); |
72 | | - } else { |
73 | | - var relativeIndex = |
74 | | - index - (appState.availableVeggies.length + 2); |
75 | | - return _generateVeggieRow( |
76 | | - appState.unavailableVeggies[relativeIndex], prefs, |
77 | | - inSeason: false); |
78 | | - } |
79 | | - }, |
| 44 | + return AnnotatedRegion<SystemUiOverlayStyle>( |
| 45 | + value: SystemUiOverlayStyle( |
| 46 | + statusBarBrightness: MediaQuery.platformBrightnessOf(context)), |
| 47 | + child: SafeArea( |
| 48 | + bottom: false, |
| 49 | + child: ListView.builder( |
| 50 | + restorationId: 'list', |
| 51 | + itemCount: appState.allVeggies.length + 2, |
| 52 | + itemBuilder: (context, index) { |
| 53 | + if (index == 0) { |
| 54 | + return Padding( |
| 55 | + padding: const EdgeInsets.fromLTRB(16, 24, 16, 16), |
| 56 | + child: Column( |
| 57 | + crossAxisAlignment: CrossAxisAlignment.start, |
| 58 | + children: [ |
| 59 | + Text(dateString.toUpperCase(), |
| 60 | + style: Styles.minorText(themeData)), |
| 61 | + Text('In season today', |
| 62 | + style: Styles.headlineText(themeData)), |
| 63 | + ], |
| 64 | + ), |
| 65 | + ); |
| 66 | + } else if (index <= appState.availableVeggies.length) { |
| 67 | + return _generateVeggieRow( |
| 68 | + appState.availableVeggies[index - 1], |
| 69 | + prefs, |
| 70 | + ); |
| 71 | + } else if (index <= appState.availableVeggies.length + 1) { |
| 72 | + return Padding( |
| 73 | + padding: const EdgeInsets.fromLTRB(16, 24, 16, 16), |
| 74 | + child: Text('Not in season', |
| 75 | + style: Styles.headlineText(themeData)), |
| 76 | + ); |
| 77 | + } else { |
| 78 | + var relativeIndex = |
| 79 | + index - (appState.availableVeggies.length + 2); |
| 80 | + return _generateVeggieRow( |
| 81 | + appState.unavailableVeggies[relativeIndex], prefs, |
| 82 | + inSeason: false); |
| 83 | + } |
| 84 | + }, |
| 85 | + ), |
80 | 86 | ), |
81 | 87 | ); |
82 | 88 | }, |
|
0 commit comments