mirror of
https://github.com/flutter/samples.git
synced 2026-05-17 20:37:44 +00:00
[VeggieSeasons] Fix dark mode problems (#395)
This commit is contained in:
committed by
GitHub
parent
28742ddeaf
commit
d9c9b3a519
@@ -17,9 +17,11 @@ class SearchBar extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final CupertinoThemeData themeData = CupertinoTheme.of(context);
|
||||
|
||||
return DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: Styles.searchBackground,
|
||||
color: Styles.searchBackground(themeData),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Padding(
|
||||
@@ -40,7 +42,7 @@ class SearchBar extends StatelessWidget {
|
||||
controller: controller,
|
||||
focusNode: focusNode,
|
||||
decoration: null,
|
||||
style: Styles.searchText,
|
||||
style: Styles.searchText(themeData),
|
||||
cursorColor: Styles.searchCursorColor,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -74,14 +74,13 @@ class SettingsGroup extends StatelessWidget {
|
||||
final List<SettingsItem> items;
|
||||
final Widget header;
|
||||
final Widget footer;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Brightness brightness = CupertinoTheme.brightnessOf(context);
|
||||
final dividedItems = <Widget>[items[0]];
|
||||
|
||||
for (int i = 1; i < items.length; i++) {
|
||||
dividedItems.add(Container(
|
||||
color: Styles.settingsLineation,
|
||||
color: Styles.settingsLineation(brightness),
|
||||
height: 0.3,
|
||||
));
|
||||
dividedItems.add(items[i]);
|
||||
@@ -99,12 +98,12 @@ class SettingsGroup extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: CupertinoColors.white,
|
||||
border: Border(
|
||||
top: const BorderSide(
|
||||
color: Styles.settingsLineation,
|
||||
top: BorderSide(
|
||||
color: Styles.settingsLineation(brightness),
|
||||
width: 0,
|
||||
),
|
||||
bottom: const BorderSide(
|
||||
color: Styles.settingsLineation,
|
||||
bottom: BorderSide(
|
||||
color: Styles.settingsLineation(brightness),
|
||||
width: 0,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -85,9 +85,11 @@ class SettingsItemState extends State<SettingsItem> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
CupertinoThemeData themeData = CupertinoTheme.of(context);
|
||||
Brightness brightness = CupertinoTheme.brightnessOf(context);
|
||||
return AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
color: pressed ? Styles.settingsItemPressed : Styles.transparentColor,
|
||||
color: Styles.settingsItemColor(brightness),
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () async {
|
||||
@@ -132,20 +134,23 @@ class SettingsItemState extends State<SettingsItem> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
SizedBox(height: 8.5),
|
||||
Text(widget.label),
|
||||
Text(
|
||||
widget.label,
|
||||
style: Styles.settingsItemText(themeData),
|
||||
),
|
||||
SizedBox(height: 4),
|
||||
Text(
|
||||
widget.subtitle,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
letterSpacing: -0.2,
|
||||
),
|
||||
style: Styles.settingsItemSubtitleText(themeData),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Padding(
|
||||
padding: EdgeInsets.only(top: 1.5),
|
||||
child: Text(widget.label),
|
||||
child: Text(
|
||||
widget.label,
|
||||
style: Styles.settingsItemText(themeData),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -106,18 +106,20 @@ class _TriviaViewState extends State<TriviaView> {
|
||||
// Widget shown when the game is over. It includes the score and a button to
|
||||
// restart everything.
|
||||
Widget _buildFinishedView() {
|
||||
final CupertinoThemeData themeData = CupertinoTheme.of(context);
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(32),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'All done!',
|
||||
style: Styles.triviaFinishedTitleText,
|
||||
style: Styles.triviaFinishedTitleText(themeData),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Text(
|
||||
'You answered',
|
||||
style: Styles.triviaFinishedText,
|
||||
style: Styles.triviaFinishedText(themeData),
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -126,24 +128,24 @@ class _TriviaViewState extends State<TriviaView> {
|
||||
children: [
|
||||
Text(
|
||||
'$score',
|
||||
style: Styles.triviaFinishedBigText,
|
||||
style: Styles.triviaFinishedBigText(themeData),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Text(
|
||||
' of ',
|
||||
style: Styles.triviaFinishedText,
|
||||
style: Styles.triviaFinishedText(themeData),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'${veggie.trivia.length}',
|
||||
style: Styles.triviaFinishedBigText,
|
||||
style: Styles.triviaFinishedBigText(themeData),
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
'questions correctly!',
|
||||
style: Styles.triviaFinishedText,
|
||||
style: Styles.triviaFinishedText(themeData),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
CupertinoButton(
|
||||
@@ -162,7 +164,10 @@ class _TriviaViewState extends State<TriviaView> {
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 16),
|
||||
Text(currentTrivia.question),
|
||||
Text(
|
||||
currentTrivia.question,
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
),
|
||||
SizedBox(height: 32),
|
||||
for (int i = 0; i < currentTrivia.answers.length; i++)
|
||||
Padding(
|
||||
@@ -188,9 +193,12 @@ class _TriviaViewState extends State<TriviaView> {
|
||||
padding: const EdgeInsets.all(32),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(status == PlayerStatus.wasCorrect
|
||||
? 'That\'s right!'
|
||||
: 'Sorry, that wasn\'t the right answer.'),
|
||||
Text(
|
||||
status == PlayerStatus.wasCorrect
|
||||
? 'That\'s right!'
|
||||
: 'Sorry, that wasn\'t the right answer.',
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
CupertinoButton(
|
||||
child: Text('Next Question'),
|
||||
|
||||
@@ -67,6 +67,8 @@ class VeggieHeadline extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final CupertinoThemeData themeData = CupertinoTheme.of(context);
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () => Navigator.of(context).push<void>(CupertinoPageRoute(
|
||||
builder: (context) => DetailsScreen(veggie.id),
|
||||
@@ -89,13 +91,16 @@ class VeggieHeadline extends StatelessWidget {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(veggie.name, style: Styles.headlineName),
|
||||
Text(
|
||||
veggie.name,
|
||||
style: Styles.headlineName(themeData),
|
||||
),
|
||||
..._buildSeasonDots(veggie.seasons),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
veggie.shortDescription,
|
||||
style: Styles.headlineDescription,
|
||||
style: Styles.headlineDescription(themeData),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user