Styling revamp using CupertinoThemeData and CupertinoTextThemeData (#593)

pull/614/head
Alex Vavvas 4 years ago committed by GitHub
parent 1d33b3dcf7
commit 7c5fecbceb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -8,6 +8,7 @@ import 'package:provider/provider.dart';
import 'package:veggieseasons/data/app_state.dart'; import 'package:veggieseasons/data/app_state.dart';
import 'package:veggieseasons/data/preferences.dart'; import 'package:veggieseasons/data/preferences.dart';
import 'package:veggieseasons/screens/home.dart'; import 'package:veggieseasons/screens/home.dart';
import 'package:veggieseasons/styles.dart';
void main() { void main() {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
@ -58,6 +59,7 @@ class _VeggieAppState extends State<VeggieApp> with RestorationMixin {
), ),
], ],
child: CupertinoApp( child: CupertinoApp(
theme: Styles.veggieThemeData,
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
home: HomeScreen(restorationId: 'home'), home: HomeScreen(restorationId: 'home'),
restorationScopeId: 'app', restorationScopeId: 'app',

@ -28,12 +28,11 @@ class ServingInfoChart extends StatelessWidget {
builder: (context, snapshot) { builder: (context, snapshot) {
final target = snapshot?.data ?? 2000; final target = snapshot?.data ?? 2000;
final percent = standardPercentage * 2000 ~/ target; final percent = standardPercentage * 2000 ~/ target;
final themeData = CupertinoTheme.of(context);
return Text( return Text(
'$percent% DV', '$percent% DV',
style: CupertinoTheme.of(context).textTheme.textStyle,
textAlign: TextAlign.end, textAlign: TextAlign.end,
style: Styles.detailsServingValueText(themeData),
); );
}, },
); );
@ -54,7 +53,7 @@ class ServingInfoChart extends StatelessWidget {
), ),
child: Text( child: Text(
'Serving info', 'Serving info',
style: Styles.detailsServingHeaderText, style: CupertinoTheme.of(context).textTheme.textStyle,
), ),
), ),
), ),
@ -79,7 +78,7 @@ class ServingInfoChart extends StatelessWidget {
child: Text( child: Text(
veggie.servingSize, veggie.servingSize,
textAlign: TextAlign.end, textAlign: TextAlign.end,
style: Styles.detailsServingValueText(themeData), style: CupertinoTheme.of(context).textTheme.textStyle,
), ),
), ),
], ],
@ -95,8 +94,8 @@ class ServingInfoChart extends StatelessWidget {
TableCell( TableCell(
child: Text( child: Text(
'${veggie.caloriesPerServing} kCal', '${veggie.caloriesPerServing} kCal',
style: CupertinoTheme.of(context).textTheme.textStyle,
textAlign: TextAlign.end, textAlign: TextAlign.end,
style: Styles.detailsServingValueText(themeData),
), ),
), ),
], ],
@ -184,7 +183,7 @@ class InfoView extends StatelessWidget {
style: (snapshot.hasData && style: (snapshot.hasData &&
snapshot.data.contains(veggie.category)) snapshot.data.contains(veggie.category))
? Styles.detailsPreferredCategoryText(themeData) ? Styles.detailsPreferredCategoryText(themeData)
: Styles.detailsCategoryText(themeData), : themeData.textTheme.textStyle,
); );
}, },
), ),
@ -210,7 +209,7 @@ class InfoView extends StatelessWidget {
SizedBox(height: 8), SizedBox(height: 8),
Text( Text(
veggie.shortDescription, veggie.shortDescription,
style: Styles.detailsDescriptionText(themeData), style: CupertinoTheme.of(context).textTheme.textStyle,
), ),
ServingInfoChart(veggie, prefs), ServingInfoChart(veggie, prefs),
SizedBox(height: 24), SizedBox(height: 24),
@ -249,7 +248,8 @@ class DetailsScreen extends StatefulWidget {
static Route<void> _routeBuilder(BuildContext context, Object arguments) { static Route<void> _routeBuilder(BuildContext context, Object arguments) {
final veggieId = arguments as int; final veggieId = arguments as int;
return CupertinoPageRoute( return CupertinoPageRoute(
builder: (context) => DetailsScreen(id: veggieId, restorationId: 'details'), builder: (context) =>
DetailsScreen(id: veggieId, restorationId: 'details'),
fullscreenDialog: true, fullscreenDialog: true,
); );
} }
@ -324,8 +324,12 @@ class _DetailsScreenState extends State<DetailsScreen> with RestorationMixin {
SizedBox(height: 20), SizedBox(height: 20),
CupertinoSegmentedControl<int>( CupertinoSegmentedControl<int>(
children: { children: {
0: Text('Facts & Info'), 0: Text(
1: Text('Trivia'), 'Facts & Info',
),
1: Text(
'Trivia',
)
}, },
groupValue: _selectedViewIndex.value, groupValue: _selectedViewIndex.value,
onValueChanged: (value) { onValueChanged: (value) {

@ -7,7 +7,6 @@ import 'package:flutter/widgets.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:veggieseasons/data/app_state.dart'; import 'package:veggieseasons/data/app_state.dart';
import 'package:veggieseasons/data/veggie.dart'; import 'package:veggieseasons/data/veggie.dart';
import 'package:veggieseasons/styles.dart';
import 'package:veggieseasons/widgets/veggie_headline.dart'; import 'package:veggieseasons/widgets/veggie_headline.dart';
class FavoritesScreen extends StatelessWidget { class FavoritesScreen extends StatelessWidget {
@ -32,8 +31,7 @@ class FavoritesScreen extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 24), padding: const EdgeInsets.symmetric(horizontal: 24),
child: Text( child: Text(
'You haven\'t added any favorite veggies to your garden yet.', 'You haven\'t added any favorite veggies to your garden yet.',
style: Styles.headlineDescription( style: CupertinoTheme.of(context).textTheme.textStyle,
CupertinoTheme.of(context)),
), ),
) )
: ListView( : ListView(

@ -3,6 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -40,43 +41,48 @@ class ListScreen extends StatelessWidget {
final appState = Provider.of<AppState>(context); final appState = Provider.of<AppState>(context);
final prefs = Provider.of<Preferences>(context); final prefs = Provider.of<Preferences>(context);
final themeData = CupertinoTheme.of(context); final themeData = CupertinoTheme.of(context);
return SafeArea( return AnnotatedRegion<SystemUiOverlayStyle>(
bottom: false, value: SystemUiOverlayStyle(
child: ListView.builder( statusBarBrightness: MediaQuery.platformBrightnessOf(context)),
restorationId: 'list', child: SafeArea(
itemCount: appState.allVeggies.length + 2, bottom: false,
itemBuilder: (context, index) { child: ListView.builder(
if (index == 0) { restorationId: 'list',
return Padding( itemCount: appState.allVeggies.length + 2,
padding: const EdgeInsets.fromLTRB(16, 24, 16, 16), itemBuilder: (context, index) {
child: Column( if (index == 0) {
crossAxisAlignment: CrossAxisAlignment.start, return Padding(
children: [ padding: const EdgeInsets.fromLTRB(16, 24, 16, 16),
Text(dateString.toUpperCase(), style: Styles.minorText), child: Column(
Text('In season today', crossAxisAlignment: CrossAxisAlignment.start,
style: Styles.headlineText(themeData)), children: [
], Text(dateString.toUpperCase(),
), style: Styles.minorText(themeData)),
); Text('In season today',
} else if (index <= appState.availableVeggies.length) { style: Styles.headlineText(themeData)),
return _generateVeggieRow( ],
appState.availableVeggies[index - 1], ),
prefs, );
); } else if (index <= appState.availableVeggies.length) {
} else if (index <= appState.availableVeggies.length + 1) { return _generateVeggieRow(
return Padding( appState.availableVeggies[index - 1],
padding: const EdgeInsets.fromLTRB(16, 24, 16, 16), prefs,
child: Text('Not in season', );
style: Styles.headlineText(themeData)), } else if (index <= appState.availableVeggies.length + 1) {
); return Padding(
} else { padding: const EdgeInsets.fromLTRB(16, 24, 16, 16),
var relativeIndex = child: Text('Not in season',
index - (appState.availableVeggies.length + 2); style: Styles.headlineText(themeData)),
return _generateVeggieRow( );
appState.unavailableVeggies[relativeIndex], prefs, } else {
inSeason: false); var relativeIndex =
} index - (appState.availableVeggies.length + 2);
}, return _generateVeggieRow(
appState.unavailableVeggies[relativeIndex], prefs,
inSeason: false);
}
},
),
), ),
); );
}, },

@ -3,11 +3,11 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:veggieseasons/data/app_state.dart'; import 'package:veggieseasons/data/app_state.dart';
import 'package:veggieseasons/data/veggie.dart'; import 'package:veggieseasons/data/veggie.dart';
import 'package:veggieseasons/styles.dart';
import 'package:veggieseasons/widgets/search_bar.dart'; import 'package:veggieseasons/widgets/search_bar.dart';
import 'package:veggieseasons/widgets/veggie_headline.dart'; import 'package:veggieseasons/widgets/veggie_headline.dart';
@ -63,7 +63,7 @@ class _SearchScreenState extends State<SearchScreen> with RestorationMixin {
padding: const EdgeInsets.symmetric(horizontal: 24), padding: const EdgeInsets.symmetric(horizontal: 24),
child: Text( child: Text(
'No veggies matching your search terms were found.', 'No veggies matching your search terms were found.',
style: Styles.headlineDescription(CupertinoTheme.of(context)), style: CupertinoTheme.of(context).textTheme.textStyle,
), ),
), ),
); );
@ -101,15 +101,19 @@ class _SearchScreenState extends State<SearchScreen> with RestorationMixin {
return UnmanagedRestorationScope( return UnmanagedRestorationScope(
child: CupertinoTabView( child: CupertinoTabView(
builder: (context) { builder: (context) {
return SafeArea( return AnnotatedRegion<SystemUiOverlayStyle>(
bottom: false, value: SystemUiOverlayStyle(
child: Stack( statusBarBrightness:
children: [ MediaQuery.platformBrightnessOf(context)),
_buildSearchResults(model.searchVeggies(terms)), child: SafeArea(
_createSearchBox(), bottom: false,
], child: Stack(
), children: [
); _buildSearchResults(model.searchVeggies(terms)),
_createSearchBox(),
],
),
));
}, },
), ),
); );

@ -8,166 +8,109 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:veggieseasons/data/veggie.dart'; import 'package:veggieseasons/data/veggie.dart';
abstract class Styles { abstract class Styles {
static TextStyle headlineText(CupertinoThemeData themeData) => TextStyle( static CupertinoThemeData veggieThemeData = CupertinoThemeData(
color: themeData.textTheme.textStyle.color, textTheme: CupertinoTextThemeData(
textStyle: TextStyle(
color: CupertinoColors.label,
fontSize: 16,
fontWeight: FontWeight.normal,
fontStyle: FontStyle.normal,
fontFamily: 'NotoSans', fontFamily: 'NotoSans',
letterSpacing: -0.41,
decoration: TextDecoration.none,
),
),
);
static TextStyle headlineText(CupertinoThemeData themeData) =>
themeData.textTheme.textStyle.copyWith(
fontSize: 32, fontSize: 32,
fontStyle: FontStyle.normal,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
); );
static const minorText = TextStyle( static TextStyle minorText(CupertinoThemeData themeData) =>
color: Color.fromRGBO(128, 128, 128, 1), themeData.textTheme.textStyle.copyWith(
fontFamily: 'NotoSans', color: Color.fromRGBO(128, 128, 128, 1),
fontSize: 16, );
fontStyle: FontStyle.normal,
fontWeight: FontWeight.normal,
);
static TextStyle headlineName(CupertinoThemeData themeData) => TextStyle( static TextStyle headlineName(CupertinoThemeData themeData) =>
color: themeData.textTheme.textStyle.color, themeData.textTheme.textStyle.copyWith(
fontFamily: 'NotoSans',
fontSize: 24, fontSize: 24,
fontStyle: FontStyle.normal,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
); );
static TextStyle headlineDescription(CupertinoThemeData themeData) => static TextStyle cardTitleText(CupertinoThemeData themeData) =>
TextStyle( themeData.textTheme.textStyle.copyWith(
color: themeData.textTheme.textStyle.color, color: Color.fromRGBO(0, 0, 0, 0.9),
fontFamily: 'NotoSans', fontSize: 32,
fontSize: 16, fontWeight: FontWeight.bold,
fontStyle: FontStyle.normal,
fontWeight: FontWeight.normal,
); );
static const cardTitleText = TextStyle( static TextStyle cardCategoryText(CupertinoThemeData themeData) =>
color: Color.fromRGBO(0, 0, 0, 0.9), themeData.textTheme.textStyle.copyWith(
fontFamily: 'NotoSans', color: Color.fromRGBO(255, 255, 255, 0.9),
fontSize: 32, );
fontStyle: FontStyle.normal,
fontWeight: FontWeight.bold,
);
static const cardCategoryText = TextStyle(
color: Color.fromRGBO(255, 255, 255, 0.9),
fontFamily: 'NotoSans',
fontSize: 16,
fontStyle: FontStyle.normal,
fontWeight: FontWeight.normal,
);
static const cardDescriptionText = TextStyle( static TextStyle cardDescriptionText(CupertinoThemeData themeData) =>
color: Color.fromRGBO(0, 0, 0, 0.9), themeData.textTheme.textStyle.copyWith(
fontFamily: 'NotoSans', color: Color.fromRGBO(0, 0, 0, 0.9),
fontSize: 16, );
fontStyle: FontStyle.normal,
fontWeight: FontWeight.normal,
);
static TextStyle detailsTitleText(CupertinoThemeData themeData) => TextStyle( static TextStyle detailsTitleText(CupertinoThemeData themeData) =>
color: themeData.textTheme.textStyle.color, themeData.textTheme.textStyle.copyWith(
fontFamily: 'NotoSans',
fontSize: 30, fontSize: 30,
fontStyle: FontStyle.normal,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
); );
static TextStyle detailsPreferredCategoryText(CupertinoThemeData themeData) => static TextStyle detailsPreferredCategoryText(CupertinoThemeData themeData) =>
TextStyle( themeData.textTheme.textStyle.copyWith(
color: themeData.textTheme.textStyle.color,
fontFamily: 'NotoSans',
fontSize: 16,
fontStyle: FontStyle.normal,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
); );
static TextStyle detailsCategoryText(CupertinoThemeData themeData) => static TextStyle detailsBoldDescriptionText(CupertinoThemeData themeData) =>
TextStyle( themeData.textTheme.textStyle.copyWith(
color: themeData.textTheme.textStyle.color, color: Color.fromRGBO(0, 0, 0, 0.9),
fontFamily: 'NotoSans', fontWeight: FontWeight.bold,
fontSize: 16,
fontStyle: FontStyle.normal,
fontWeight: FontWeight.normal,
); );
static TextStyle detailsDescriptionText(CupertinoThemeData themeData) => static TextStyle detailsServingHeaderText(CupertinoThemeData themeData) =>
TextStyle( themeData.textTheme.textStyle.copyWith(
color: themeData.textTheme.textStyle.color, color: Color.fromRGBO(176, 176, 176, 1),
fontFamily: 'NotoSans', fontWeight: FontWeight.bold,
fontSize: 16,
fontStyle: FontStyle.normal,
fontWeight: FontWeight.normal,
); );
static const detailsBoldDescriptionText = TextStyle(
color: Color.fromRGBO(0, 0, 0, 0.9),
fontFamily: 'NotoSans',
fontSize: 16,
fontStyle: FontStyle.normal,
fontWeight: FontWeight.bold,
);
static const detailsServingHeaderText = TextStyle(
color: Color.fromRGBO(176, 176, 176, 1),
fontFamily: 'NotoSans',
fontSize: 16,
fontStyle: FontStyle.normal,
fontWeight: FontWeight.bold,
);
static TextStyle detailsServingLabelText(CupertinoThemeData themeData) => static TextStyle detailsServingLabelText(CupertinoThemeData themeData) =>
TextStyle( themeData.textTheme.textStyle.copyWith(
color: themeData.textTheme.textStyle.color,
fontFamily: 'NotoSans',
fontSize: 16,
fontStyle: FontStyle.normal,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
); );
static TextStyle detailsServingValueText(CupertinoThemeData themeData) =>
TextStyle(
color: themeData.textTheme.textStyle.color,
fontFamily: 'NotoSans',
fontSize: 16,
fontStyle: FontStyle.normal,
fontWeight: FontWeight.normal,
);
static TextStyle detailsServingNoteText(CupertinoThemeData themeData) => static TextStyle detailsServingNoteText(CupertinoThemeData themeData) =>
TextStyle( themeData.textTheme.textStyle.copyWith(
color: themeData.textTheme.textStyle.color,
fontFamily: 'NotoSans',
fontSize: 16,
fontStyle: FontStyle.italic, fontStyle: FontStyle.italic,
fontWeight: FontWeight.normal,
); );
static TextStyle triviaFinishedTitleText(CupertinoThemeData themeData) => static TextStyle triviaFinishedTitleText(CupertinoThemeData themeData) =>
TextStyle( themeData.textTheme.textStyle.copyWith(
color: themeData.textTheme.textStyle.color,
fontFamily: 'NotoSans',
fontSize: 32, fontSize: 32,
fontStyle: FontStyle.normal,
fontWeight: FontWeight.normal,
);
static TextStyle triviaFinishedText(CupertinoThemeData themeData) =>
TextStyle(
color: themeData.textTheme.textStyle.color,
fontFamily: 'NotoSans',
fontSize: 16,
fontStyle: FontStyle.normal,
fontWeight: FontWeight.normal,
); );
static TextStyle triviaFinishedBigText(CupertinoThemeData themeData) => static TextStyle triviaFinishedBigText(CupertinoThemeData themeData) =>
TextStyle( themeData.textTheme.textStyle.copyWith(
color: themeData.textTheme.textStyle.color,
fontFamily: 'NotoSans',
fontSize: 48, fontSize: 48,
fontStyle: FontStyle.normal, );
fontWeight: FontWeight.normal,
static TextStyle settingsGroupHeaderText(CupertinoThemeData themeData) =>
themeData.textTheme.textStyle.copyWith(
color: CupertinoColors.inactiveGray,
fontSize: 13.5,
letterSpacing: -0.5,
);
static TextStyle settingsGroupFooterText(CupertinoThemeData themeData) =>
themeData.textTheme.textStyle.copyWith(
color: Styles.settingsGroupSubtitle,
fontSize: 13,
letterSpacing: -0.08,
); );
static const appBackground = Color(0xffd0d0d0); static const appBackground = Color(0xffd0d0d0);
@ -186,22 +129,15 @@ abstract class Styles {
static const closeButtonPressed = Color(0xff808080); static const closeButtonPressed = Color(0xff808080);
static TextStyle searchText(CupertinoThemeData themeData) => TextStyle( static TextStyle searchText(CupertinoThemeData themeData) =>
color: themeData.textTheme.textStyle.color, themeData.textTheme.textStyle.copyWith(
fontFamily: 'NotoSans',
fontSize: 14, fontSize: 14,
fontStyle: FontStyle.normal,
fontWeight: FontWeight.normal,
); );
static TextStyle settingsItemText(CupertinoThemeData themeData) =>
themeData.textTheme.textStyle;
static TextStyle settingsItemSubtitleText(CupertinoThemeData themeData) => static TextStyle settingsItemSubtitleText(CupertinoThemeData themeData) =>
TextStyle( themeData.textTheme.textStyle.copyWith(
fontSize: 12, fontSize: 12,
letterSpacing: -0.2, letterSpacing: -0.2,
color: themeData.textTheme.textStyle.color,
); );
static const Color searchCursorColor = Color.fromRGBO(0, 122, 255, 1); static const Color searchCursorColor = Color.fromRGBO(0, 122, 255, 1);

@ -28,11 +28,7 @@ class SettingsGroupHeader extends StatelessWidget {
), ),
child: Text( child: Text(
title.toUpperCase(), title.toUpperCase(),
style: TextStyle( style: Styles.settingsGroupHeaderText(CupertinoTheme.of(context)),
color: CupertinoColors.inactiveGray,
fontSize: 13.5,
letterSpacing: -0.5,
),
), ),
); );
} }
@ -51,14 +47,8 @@ class SettingsGroupFooter extends StatelessWidget {
right: 15, right: 15,
top: 7.5, top: 7.5,
), ),
child: Text( child: Text(title,
title, style: Styles.settingsGroupFooterText(CupertinoTheme.of(context))),
style: TextStyle(
color: Styles.settingsGroupSubtitle,
fontSize: 13,
letterSpacing: -0.08,
),
),
); );
} }
} }

@ -134,10 +134,8 @@ class SettingsItemState extends State<SettingsItem> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
SizedBox(height: 8.5), SizedBox(height: 8.5),
Text( Text(widget.label,
widget.label, style: themeData.textTheme.textStyle),
style: Styles.settingsItemText(themeData),
),
SizedBox(height: 4), SizedBox(height: 4),
Text( Text(
widget.subtitle, widget.subtitle,
@ -147,10 +145,8 @@ class SettingsItemState extends State<SettingsItem> {
) )
: Padding( : Padding(
padding: EdgeInsets.only(top: 1.5), padding: EdgeInsets.only(top: 1.5),
child: Text( child: Text(widget.label,
widget.label, style: themeData.textTheme.textStyle),
style: Styles.settingsItemText(themeData),
),
), ),
), ),
), ),

@ -41,7 +41,8 @@ class _TriviaViewState extends State<TriviaView> with RestorationMixin {
Trivia get currentTrivia => veggie.trivia[triviaIndex.value]; Trivia get currentTrivia => veggie.trivia[triviaIndex.value];
/// The current state of the game. /// The current state of the game.
_RestorablePlayerStatus status = _RestorablePlayerStatus(PlayerStatus.readyToAnswer); _RestorablePlayerStatus status =
_RestorablePlayerStatus(PlayerStatus.readyToAnswer);
@override @override
String get restorationId => widget.restorationId; String get restorationId => widget.restorationId;
@ -135,25 +136,19 @@ class _TriviaViewState extends State<TriviaView> with RestorationMixin {
style: Styles.triviaFinishedTitleText(themeData), style: Styles.triviaFinishedTitleText(themeData),
), ),
SizedBox(height: 16), SizedBox(height: 16),
Text( Text('You answered', style: themeData.textTheme.textStyle),
'You answered',
style: Styles.triviaFinishedText(themeData),
),
Row( Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
textBaseline: TextBaseline.alphabetic, textBaseline: TextBaseline.alphabetic,
children: [ children: [
Text( Text(
'$score', '${score.value}',
style: Styles.triviaFinishedBigText(themeData), style: Styles.triviaFinishedBigText(themeData),
), ),
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 16), padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text( child: Text(' of ', style: themeData.textTheme.textStyle),
' of ',
style: Styles.triviaFinishedText(themeData),
),
), ),
Text( Text(
'${veggie.trivia.length}', '${veggie.trivia.length}',
@ -161,10 +156,7 @@ class _TriviaViewState extends State<TriviaView> with RestorationMixin {
), ),
], ],
), ),
Text( Text('questions correctly!', style: themeData.textTheme.textStyle),
'questions correctly!',
style: Styles.triviaFinishedText(themeData),
),
SizedBox(height: 16), SizedBox(height: 16),
CupertinoButton( CupertinoButton(
child: Text('Try Again'), child: Text('Try Again'),

@ -117,7 +117,8 @@ class VeggieCard extends StatelessWidget {
/// Whether [veggie] falls into one of user's preferred [VeggieCategory]s /// Whether [veggie] falls into one of user's preferred [VeggieCategory]s
final bool isPreferredCategory; final bool isPreferredCategory;
Widget _buildDetails() { Widget _buildDetails(BuildContext context) {
final themeData = CupertinoTheme.of(context);
return FrostyBackground( return FrostyBackground(
color: Color(0x90ffffff), color: Color(0x90ffffff),
child: Padding( child: Padding(
@ -127,11 +128,11 @@ class VeggieCard extends StatelessWidget {
children: <Widget>[ children: <Widget>[
Text( Text(
veggie.name, veggie.name,
style: Styles.cardTitleText, style: Styles.cardTitleText(themeData),
), ),
Text( Text(
veggie.shortDescription, veggie.shortDescription,
style: Styles.cardDescriptionText, style: Styles.cardDescriptionText(themeData),
), ),
], ],
), ),
@ -165,7 +166,7 @@ class VeggieCard extends StatelessWidget {
bottom: 0, bottom: 0,
left: 0, left: 0,
right: 0, right: 0,
child: _buildDetails(), child: _buildDetails(context),
), ),
], ],
), ),

@ -97,7 +97,7 @@ class VeggieHeadline extends StatelessWidget {
), ),
Text( Text(
veggie.shortDescription, veggie.shortDescription,
style: Styles.headlineDescription(themeData), style: themeData.textTheme.textStyle,
), ),
], ],
), ),

Loading…
Cancel
Save