From 8ab7b11b433b6dc586690e8dd2d3dfe3c6d6233c Mon Sep 17 00:00:00 2001 From: Xennis Date: Thu, 18 Jul 2024 20:41:22 +0200 Subject: [PATCH] Adjust colors due to Flutter/Material update --- green_walking/lib/main.dart | 12 ++++++++---- green_walking/lib/pages/feedback.dart | 2 +- green_walking/lib/pages/legal_notice.dart | 4 ++-- green_walking/lib/pages/search.dart | 4 +--- green_walking/lib/widgets/location_button.dart | 4 ++-- green_walking/lib/widgets/navigation_drawer.dart | 10 +++++----- green_walking/lib/widgets/search_result_card.dart | 2 +- green_walking/lib/widgets/user_consent_dialog.dart | 6 +++--- 8 files changed, 23 insertions(+), 21 deletions(-) diff --git a/green_walking/lib/main.dart b/green_walking/lib/main.dart index 7d3794e..6cd4218 100644 --- a/green_walking/lib/main.dart +++ b/green_walking/lib/main.dart @@ -33,12 +33,16 @@ class GreenWalkingApp extends StatelessWidget { return MaterialApp( onGenerateTitle: (BuildContext context) => AppLocalizations.of(context)!.appTitle, theme: ThemeData( - brightness: Brightness.light, - primaryColor: Colors.blue, + colorScheme: ColorScheme.fromSeed( + brightness: Brightness.light, + seedColor: Colors.blue, + ), ), darkTheme: ThemeData( - brightness: Brightness.dark, - primaryColor: Colors.blue, + colorScheme: ColorScheme.fromSeed( + brightness: Brightness.dark, + seedColor: Colors.blue, + ), ), themeMode: prefsProvider.themeMode, initialRoute: Routes.map, diff --git a/green_walking/lib/pages/feedback.dart b/green_walking/lib/pages/feedback.dart index b4467e5..aebed60 100644 --- a/green_walking/lib/pages/feedback.dart +++ b/green_walking/lib/pages/feedback.dart @@ -23,7 +23,7 @@ class FeedbackPage extends StatelessWidget { children: [ RichText( text: TextSpan( - style: TextStyle(color: theme.unselectedWidgetColor), + style: TextStyle(color: theme.colorScheme.secondary), children: [ TextSpan( text: '${locale.feedbackPageText}\n', diff --git a/green_walking/lib/pages/legal_notice.dart b/green_walking/lib/pages/legal_notice.dart index d160224..5d3bce9 100644 --- a/green_walking/lib/pages/legal_notice.dart +++ b/green_walking/lib/pages/legal_notice.dart @@ -24,7 +24,7 @@ class LegalNoticePage extends StatelessWidget { children: [ RichText( text: TextSpan( - style: TextStyle(color: theme.unselectedWidgetColor), + style: TextStyle(color: theme.colorScheme.secondary), children: [ TextSpan( text: '${locale.imprintTmgText('5')}:\n\n', @@ -41,7 +41,7 @@ class LegalNoticePage extends StatelessWidget { TextSpan(text: '${locale.imprintGdprApplyText} '), TextSpan( text: locale.gdprPrivacyPolicy, - style: TextStyle(color: theme.primaryColor), + style: TextStyle(color: theme.colorScheme.primary, fontWeight: FontWeight.bold), recognizer: TapGestureRecognizer()..onTap = () => launchUrl(privacyPolicyUrl), ), const TextSpan(text: '.') diff --git a/green_walking/lib/pages/search.dart b/green_walking/lib/pages/search.dart index af13375..0b682a3 100644 --- a/green_walking/lib/pages/search.dart +++ b/green_walking/lib/pages/search.dart @@ -42,7 +42,6 @@ class _SearchPageState extends State { @override Widget build(BuildContext context) { final AppLocalizations locale = AppLocalizations.of(context)!; - final ThemeData theme = Theme.of(context); return Scaffold( // If the search in the search bar is clicked the keyboard appears. The keyboard @@ -59,7 +58,6 @@ class _SearchPageState extends State { title: TextField( controller: _queryFieldController, autofocus: true, - cursorColor: theme.hintColor, keyboardType: TextInputType.text, textInputAction: TextInputAction.go, decoration: InputDecoration( @@ -131,7 +129,7 @@ class _SearchPageState extends State { children: [ Flexible( child: Text(locale.geocodingResultLegalNotice(data.attribution), - style: TextStyle(color: theme.hintColor, fontSize: 12.0))) + style: TextStyle(color: theme.colorScheme.secondary, fontSize: 12.0))) ], ), ], diff --git a/green_walking/lib/widgets/location_button.dart b/green_walking/lib/widgets/location_button.dart index 63b4088..7213896 100644 --- a/green_walking/lib/widgets/location_button.dart +++ b/green_walking/lib/widgets/location_button.dart @@ -47,7 +47,7 @@ class _LocationButtonState extends State { child: Padding( padding: const EdgeInsets.only(bottom: 18.0, right: 18.0), child: FloatingActionButton( - backgroundColor: theme.primaryColor, + backgroundColor: theme.colorScheme.primary, onPressed: _onPressed, child: ValueListenableBuilder( valueListenable: widget.trackUserLocation, @@ -63,7 +63,7 @@ class _LocationButtonState extends State { return Icon( icon, size: 27, - color: Colors.white, + color: theme.colorScheme.onPrimary, ); })), ), diff --git a/green_walking/lib/widgets/navigation_drawer.dart b/green_walking/lib/widgets/navigation_drawer.dart index e394ad6..358434d 100644 --- a/green_walking/lib/widgets/navigation_drawer.dart +++ b/green_walking/lib/widgets/navigation_drawer.dart @@ -21,14 +21,14 @@ class AppNavigationDrawer extends StatelessWidget { children: [ DrawerHeader( decoration: BoxDecoration( - color: theme.primaryColor, + color: theme.colorScheme.primary, ), child: Column(children: [ Row(children: [ Text( locale.appTitle, - style: const TextStyle( - color: Colors.white, + style: TextStyle( + color: theme.colorScheme.onPrimary, fontSize: 22, ), ), @@ -36,8 +36,8 @@ class AppNavigationDrawer extends StatelessWidget { Row( children: [ Text(locale.appSlogan, - style: const TextStyle( - color: Colors.white70, + style: TextStyle( + color: theme.colorScheme.onPrimary, )), ], ) diff --git a/green_walking/lib/widgets/search_result_card.dart b/green_walking/lib/widgets/search_result_card.dart index 22ea00f..bd8b304 100644 --- a/green_walking/lib/widgets/search_result_card.dart +++ b/green_walking/lib/widgets/search_result_card.dart @@ -49,7 +49,7 @@ class _TrailingWidget extends StatelessWidget { final List children = [ IconButton( - color: theme.primaryColor, + color: theme.colorScheme.primary, tooltip: locale.openLocationInDefaultAppSemanticLabel, icon: Icon(Icons.open_in_new, semanticLabel: locale.openLocationInDefaultAppSemanticLabel), onPressed: () => launchUrlString( diff --git a/green_walking/lib/widgets/user_consent_dialog.dart b/green_walking/lib/widgets/user_consent_dialog.dart index b748ef1..d165c0b 100644 --- a/green_walking/lib/widgets/user_consent_dialog.dart +++ b/green_walking/lib/widgets/user_consent_dialog.dart @@ -31,13 +31,13 @@ class UserConsentDialog extends StatelessWidget { child: ListBody( children: [ RichText( - text: TextSpan(style: TextStyle(color: theme.hintColor), children: [ + text: TextSpan(style: TextStyle(color: theme.colorScheme.secondary), children: [ TextSpan( text: '${locale.gdprDialogText} ', ), TextSpan( text: locale.gdprPrivacyPolicy, - style: TextStyle(color: theme.primaryColor), + style: TextStyle(color: theme.colorScheme.primary, fontWeight: FontWeight.bold), recognizer: TapGestureRecognizer() ..onTap = () { launchUrl(privacyPolicyUrl); @@ -45,7 +45,7 @@ class UserConsentDialog extends StatelessWidget { ), TextSpan( text: '.', - style: TextStyle(color: theme.hintColor), + style: TextStyle(color: theme.colorScheme.secondary), ), ]), ),