From 780d3cbbc24f30d0f4e502e3b5912a0c224fc1eb Mon Sep 17 00:00:00 2001 From: Rafael <1024481@stud.hs-mannheim.de> Date: Tue, 18 Jun 2024 02:24:42 +0200 Subject: [PATCH] Adjusted ColorScheme: replaced custom grey with standard blue. --- lib/components/feedback_dialog.dart | 25 ++++++++----------------- lib/components/my_button.dart | 5 +++-- lib/components/my_textfield.dart | 25 +++++++++++-------------- lib/components/user_tile_chats.dart | 2 +- lib/components/user_tile_likes.dart | 1 + lib/forms/matched_screen.dart | 9 ++++++--- lib/forms/profile_category_form.dart | 11 +++++++++-- lib/pages/edit_profile_page.dart | 3 ++- lib/pages/home_page.dart | 8 +++++--- lib/pages/settings_page.dart | 2 +- lib/themes/dark_mode.dart | 11 ++++------- lib/themes/light_mode.dart | 11 ++++------- lib/utils/helper_dialogs.dart | 13 ++++++++++--- 13 files changed, 65 insertions(+), 61 deletions(-) diff --git a/lib/components/feedback_dialog.dart b/lib/components/feedback_dialog.dart index 5c33590..9fcf214 100644 --- a/lib/components/feedback_dialog.dart +++ b/lib/components/feedback_dialog.dart @@ -15,7 +15,6 @@ class _FeedbackDialogState extends State { final TextEditingController _feedbackController = TextEditingController(); final GlobalKey _formKey = GlobalKey(); - // get instance of firestore and auth final FirebaseFirestore _firestore = FirebaseFirestore.instance; final AuthService _authService = AuthService(); @@ -53,24 +52,14 @@ class _FeedbackDialogState extends State { child: const Text('Cancel'), onPressed: () => Navigator.pop(context), ), - TextButton( - style: TextButton.styleFrom( - backgroundColor: Theme.of(context).colorScheme.secondary, - ), - child: const Text( - 'Send feedback', - style: TextStyle( - color: Colors.blue, - ), - ), + ElevatedButton( + child: const Text('Send feedback'), onPressed: () async { - // Only if the input form is valid (the user has entered text) if (_formKey.currentState!.validate()) { String message; bool error = false; try { - // Get a reference to the feedbacks collection final collection = _firestore.collection(Constants.dbCollectionFeedbacks); @@ -90,10 +79,12 @@ class _FeedbackDialogState extends State { // Show a snackBar with the result if (context.mounted) { - ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text(message), - backgroundColor: error ? Colors.red : Colors.green, - )); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text(message), + backgroundColor: error ? Colors.red : Colors.green, + ), + ); Navigator.pop(context); } } diff --git a/lib/components/my_button.dart b/lib/components/my_button.dart index 82d3d97..401ad3d 100644 --- a/lib/components/my_button.dart +++ b/lib/components/my_button.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'text_bold.dart'; class MyButton extends StatelessWidget { final void Function()? onTap; @@ -16,13 +17,13 @@ class MyButton extends StatelessWidget { onTap: onTap, child: Container( decoration: BoxDecoration( - color: Theme.of(context).colorScheme.secondary, + color: Theme.of(context).colorScheme.secondaryContainer, borderRadius: BorderRadius.circular(8), ), padding: const EdgeInsets.all(16), margin: const EdgeInsets.symmetric(horizontal: 25), child: Center( - child: Text(text, style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),), + child: TextBold(text: text), ), ), ); diff --git a/lib/components/my_textfield.dart b/lib/components/my_textfield.dart index 0378ccd..bf1afcb 100644 --- a/lib/components/my_textfield.dart +++ b/lib/components/my_textfield.dart @@ -23,20 +23,17 @@ class MyTextField extends StatelessWidget { controller: controller, focusNode: focusNode, decoration: InputDecoration( - enabledBorder: OutlineInputBorder( - borderSide: - BorderSide(color: Theme.of(context).colorScheme.tertiary), - ), - focusedBorder: OutlineInputBorder( - borderSide: - BorderSide(color: Theme.of(context).colorScheme.primary), - ), - fillColor: Theme.of(context).colorScheme.secondary, - filled: true, - hintText: hintText, - hintStyle: TextStyle( - color: Theme.of(context).colorScheme.primary, - )), + enabledBorder: OutlineInputBorder( + borderSide: + BorderSide(color: Theme.of(context).colorScheme.tertiary), + ), + focusedBorder: OutlineInputBorder( + borderSide: + BorderSide(color: Theme.of(context).colorScheme.primary), + ), + filled: true, + hintText: hintText, + ), ), ); } diff --git a/lib/components/user_tile_chats.dart b/lib/components/user_tile_chats.dart index a076ed7..ec2392e 100644 --- a/lib/components/user_tile_chats.dart +++ b/lib/components/user_tile_chats.dart @@ -26,7 +26,7 @@ class UserTileChats extends StatelessWidget { onTap: onTap, child: Container( decoration: BoxDecoration( - color: Theme.of(context).colorScheme.secondary, + color: Theme.of(context).colorScheme.secondaryContainer, borderRadius: BorderRadius.circular(12), ), margin: const EdgeInsets.symmetric(vertical: 5, horizontal: 25), diff --git a/lib/components/user_tile_likes.dart b/lib/components/user_tile_likes.dart index bf9458e..d5250f8 100644 --- a/lib/components/user_tile_likes.dart +++ b/lib/components/user_tile_likes.dart @@ -64,6 +64,7 @@ class _UserTileLikesState extends State { : null); return Card( + color: Theme.of(context).colorScheme.onInverseSurface, margin: const EdgeInsets.all(8.0), child: ListTile( leading: Column( diff --git a/lib/forms/matched_screen.dart b/lib/forms/matched_screen.dart index 58946f1..62743c3 100644 --- a/lib/forms/matched_screen.dart +++ b/lib/forms/matched_screen.dart @@ -36,21 +36,24 @@ class MatchedScreen extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - // imageUrl cant be null or empty with NetworkImage CircleAvatar( - backgroundColor: Colors.blueGrey[300], backgroundImage: (currentUserImageUrl.isEmpty) ? null : NetworkImage(currentUserImageUrl), radius: 50, + child: (currentUserImageUrl.isEmpty) + ? const Icon(Icons.person, size: 50) + : null, ), const SizedBox(width: 24), CircleAvatar( - backgroundColor: Colors.blueGrey[300], backgroundImage: (otherUserImageUrl.isEmpty) ? null : NetworkImage(otherUserImageUrl), radius: 50, + child: (otherUserImageUrl.isEmpty) + ? const Icon(Icons.person, size: 50) + : null, ), ], ), diff --git a/lib/forms/profile_category_form.dart b/lib/forms/profile_category_form.dart index 1e40ef4..9379469 100644 --- a/lib/forms/profile_category_form.dart +++ b/lib/forms/profile_category_form.dart @@ -106,11 +106,18 @@ class ProfileCategoryFormState extends State> { ScaffoldMessenger.of(context) .showSnackBar( SnackBar( - content: Text(message), - backgroundColor: Colors.red, + content: Text( + message, + style: TextStyle( + fontSize: 16, + color: Theme.of(context).colorScheme.onErrorContainer, + ), + ), + backgroundColor: Theme.of(context).colorScheme.errorContainer, //duration: Duration(seconds: 2), action: SnackBarAction( label: 'Dismiss', + textColor: Theme.of(context).colorScheme.primary, onPressed: () { ScaffoldMessenger.of(context).hideCurrentSnackBar(); _isSnackBarVisible = false; diff --git a/lib/pages/edit_profile_page.dart b/lib/pages/edit_profile_page.dart index 8f54b07..f4d5b31 100644 --- a/lib/pages/edit_profile_page.dart +++ b/lib/pages/edit_profile_page.dart @@ -250,8 +250,9 @@ class EditProfilePageState extends State { right: 0, child: IconButton( icon: Ink( + padding: const EdgeInsets.all(4), decoration: ShapeDecoration( - color: Theme.of(context).colorScheme.primary, + color: Theme.of(context).colorScheme.surfaceContainer, shape: const CircleBorder(), ), child: const Icon(Icons.camera_alt), diff --git a/lib/pages/home_page.dart b/lib/pages/home_page.dart index 1cd43b1..761dba1 100644 --- a/lib/pages/home_page.dart +++ b/lib/pages/home_page.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; - import '../components/my_drawer.dart'; class HomePage extends StatelessWidget { @@ -87,12 +86,15 @@ class HomePage extends StatelessWidget { Icon( icon, size: 50, - color: Colors.white, + color: Theme.of(context).colorScheme.surface, ), const SizedBox(height: 10), Text( title, - style: const TextStyle(color: Colors.white, fontSize: 20), + style: TextStyle( + color: Theme.of(context).colorScheme.surface, + fontSize: 20, + ), ), ], ), diff --git a/lib/pages/settings_page.dart b/lib/pages/settings_page.dart index 3046b6c..7142f77 100644 --- a/lib/pages/settings_page.dart +++ b/lib/pages/settings_page.dart @@ -15,7 +15,7 @@ class SettingsPage extends StatelessWidget { ), body: Container( decoration: BoxDecoration( - color: Theme.of(context).colorScheme.secondary, + color: Theme.of(context).colorScheme.secondaryContainer, borderRadius: BorderRadius.circular(12), ), margin: const EdgeInsets.all(25), diff --git a/lib/themes/dark_mode.dart b/lib/themes/dark_mode.dart index 3c7cf3e..f84b56c 100644 --- a/lib/themes/dark_mode.dart +++ b/lib/themes/dark_mode.dart @@ -1,11 +1,8 @@ import 'package:flutter/material.dart'; ThemeData darkMode = ThemeData( - colorScheme: ColorScheme.dark( - surface: Colors.grey.shade900, - primary: Colors.grey.shade600, - secondary: Colors.grey.shade700, - tertiary: Colors.grey.shade800, - inversePrimary: Colors.grey.shade300, + colorScheme: ColorScheme.fromSeed( + brightness: Brightness.dark, + seedColor: Colors.blue, ), -); \ No newline at end of file +); diff --git a/lib/themes/light_mode.dart b/lib/themes/light_mode.dart index f48d9f4..11a7fd1 100644 --- a/lib/themes/light_mode.dart +++ b/lib/themes/light_mode.dart @@ -1,11 +1,8 @@ import 'package:flutter/material.dart'; ThemeData lightMode = ThemeData( - colorScheme: ColorScheme.light( - surface: Colors.grey.shade300, - primary: Colors.grey.shade500, - secondary: Colors.grey.shade200, - tertiary: Colors.white, - inversePrimary: Colors.grey.shade900, + colorScheme: ColorScheme.fromSeed( + brightness: Brightness.light, + seedColor: Colors.blue, ), -); \ No newline at end of file +); diff --git a/lib/utils/helper_dialogs.dart b/lib/utils/helper_dialogs.dart index 4737d81..3e5965a 100644 --- a/lib/utils/helper_dialogs.dart +++ b/lib/utils/helper_dialogs.dart @@ -19,14 +19,21 @@ void showMsg(BuildContext context, String title, String content) { ); } -/// Show a red colored SnackBar with a [Dismiss] Button +/// Show an error colored SnackBar with a [Dismiss] Button void showErrorSnackBar(BuildContext context, String message) { ScaffoldMessenger.of(context).showSnackBar( SnackBar( - content: Text(message), - backgroundColor: Colors.red, + content: Text( + message, + style: TextStyle( + fontSize: 16, + color: Theme.of(context).colorScheme.onErrorContainer, + ), + ), + backgroundColor: Theme.of(context).colorScheme.errorContainer, action: SnackBarAction( label: 'Dismiss', + textColor: Theme.of(context).colorScheme.primary, onPressed: () { ScaffoldMessenger.of(context).hideCurrentSnackBar(); },