-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Styling revamp using CupertinoThemeData and CupertinoTextThemeData #593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
d9da034
bf79045
5e39732
d6307ad
9c564ad
70b661c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,12 +28,11 @@ class ServingInfoChart extends StatelessWidget { | |
| builder: (context, snapshot) { | ||
| final target = snapshot?.data ?? 2000; | ||
| final percent = standardPercentage * 2000 ~/ target; | ||
| final themeData = CupertinoTheme.of(context); | ||
|
|
||
| return Text( | ||
| '$percent% DV', | ||
| style: CupertinoTheme.of(context).textTheme.textStyle, | ||
| textAlign: TextAlign.end, | ||
| style: Styles.detailsServingValueText(themeData), | ||
| ); | ||
| }, | ||
| ); | ||
|
|
@@ -54,7 +53,7 @@ class ServingInfoChart extends StatelessWidget { | |
| ), | ||
| child: Text( | ||
| 'Serving info', | ||
| style: Styles.detailsServingHeaderText, | ||
| style: CupertinoTheme.of(context).textTheme.textStyle, | ||
| ), | ||
| ), | ||
| ), | ||
|
|
@@ -79,7 +78,7 @@ class ServingInfoChart extends StatelessWidget { | |
| child: Text( | ||
| veggie.servingSize, | ||
| textAlign: TextAlign.end, | ||
| style: Styles.detailsServingValueText(themeData), | ||
| style: CupertinoTheme.of(context).textTheme.textStyle, | ||
| ), | ||
| ), | ||
| ], | ||
|
|
@@ -95,8 +94,8 @@ class ServingInfoChart extends StatelessWidget { | |
| TableCell( | ||
| child: Text( | ||
| '${veggie.caloriesPerServing} kCal', | ||
| style: CupertinoTheme.of(context).textTheme.textStyle, | ||
| textAlign: TextAlign.end, | ||
| style: Styles.detailsServingValueText(themeData), | ||
| ), | ||
| ), | ||
| ], | ||
|
|
@@ -184,7 +183,7 @@ class InfoView extends StatelessWidget { | |
| style: (snapshot.hasData && | ||
| snapshot.data.contains(veggie.category)) | ||
| ? Styles.detailsPreferredCategoryText(themeData) | ||
| : Styles.detailsCategoryText(themeData), | ||
| : themeData.textTheme.textStyle, | ||
| ); | ||
| }, | ||
| ), | ||
|
|
@@ -210,7 +209,7 @@ class InfoView extends StatelessWidget { | |
| SizedBox(height: 8), | ||
| Text( | ||
| veggie.shortDescription, | ||
| style: Styles.detailsDescriptionText(themeData), | ||
| style: CupertinoTheme.of(context).textTheme.textStyle, | ||
| ), | ||
| ServingInfoChart(veggie, prefs), | ||
| SizedBox(height: 24), | ||
|
|
@@ -249,7 +248,8 @@ class DetailsScreen extends StatefulWidget { | |
| static Route<void> _routeBuilder(BuildContext context, Object arguments) { | ||
| final veggieId = arguments as int; | ||
| return CupertinoPageRoute( | ||
| builder: (context) => DetailsScreen(id: veggieId, restorationId: 'details'), | ||
| builder: (context) => | ||
| DetailsScreen(id: veggieId, restorationId: 'details'), | ||
| fullscreenDialog: true, | ||
| ); | ||
| } | ||
|
|
@@ -324,8 +324,14 @@ class _DetailsScreenState extends State<DetailsScreen> with RestorationMixin { | |
| SizedBox(height: 20), | ||
| CupertinoSegmentedControl<int>( | ||
| children: { | ||
| 0: Text('Facts & Info'), | ||
| 1: Text('Trivia'), | ||
| 0: Text( | ||
| 'Facts & Info', | ||
| ), | ||
| //style: CupertinoTheme.of(context).textTheme.textStyle), | ||
redbrogdon marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 1: Text( | ||
| 'Trivia', | ||
| ) | ||
| //style: CupertinoTheme.of(context).textTheme.textStyle), | ||
|
||
| }, | ||
| groupValue: _selectedViewIndex.value, | ||
| onValueChanged: (value) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: is it needed to explicitly specify the text style? I'd expect the
Textwidget to inherit the style from the theme.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps I've done something wrong in assigning the theme to the whole app, but removing the
stylemakes the text black regardless of the IOS brightness.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it work if you wrap the
DetailsScreenwidget in aDefaultTextStyle(style: CupertinoTheme.of(context).textTheme.textStyle)widget? Anyways not a big deal it just makes the code a little bit more verbose.