diff --git a/frontend/lib/about/about_page.dart b/frontend/lib/about/about_page.dart index b43a8a3ec..abda07e1b 100644 --- a/frontend/lib/about/about_page.dart +++ b/frontend/lib/about/about_page.dart @@ -30,6 +30,8 @@ class AboutPageState extends State { @override Widget build(BuildContext context) { + final textTheme = Theme.of(context).textTheme; + final colorTheme = Theme.of(context).colorScheme; final config = Configuration.of(context); final t = context.t; return FutureBuilder( @@ -58,10 +60,10 @@ class AboutPageState extends State { ), ), Center( - child: Text(packageInfo.appName, style: Theme.of(context).textTheme.headlineSmall), + child: Text(packageInfo.appName, style: textTheme.headlineSmall), ), Center( - child: Text(packageInfo.version, style: Theme.of(context).textTheme.bodyMedium), + child: Text(packageInfo.version, style: TextStyle(color: colorTheme.tertiary)), ), const SizedBox(height: 20), const Divider( @@ -74,18 +76,15 @@ class AboutPageState extends State { child: Column( children: [ Center( - child: Text(t.about.publisher, style: Theme.of(context).textTheme.titleSmall), + child: Text(t.about.publisher, style: textTheme.titleSmall), ), Padding( padding: const EdgeInsets.only(left: 10, right: 10, top: 16, bottom: 16), - child: Text(buildConfig.publisherAddress, style: Theme.of(context).textTheme.bodyLarge), + child: Text(buildConfig.publisherAddress), ), Text( t.about.moreInformation, - style: Theme.of(context) - .textTheme - .bodyMedium - ?.merge(TextStyle(color: Theme.of(context).colorScheme.secondary)), + style: textTheme.bodyLarge?.apply(color: colorTheme.secondary), ), ], ), diff --git a/frontend/lib/about/backend_switch_dialog.dart b/frontend/lib/about/backend_switch_dialog.dart index da67b1d6c..ccc292432 100644 --- a/frontend/lib/about/backend_switch_dialog.dart +++ b/frontend/lib/about/backend_switch_dialog.dart @@ -20,6 +20,7 @@ class BackendSwitchDialogState extends State { @override Widget build(BuildContext context) { + final theme = Theme.of(context); return SimpleDialog( children: [ Padding( @@ -27,10 +28,10 @@ class BackendSwitchDialogState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text('Switch Endpoint', style: Theme.of(context).textTheme.headlineMedium), + Text('Switch Endpoint', style: theme.textTheme.titleLarge), IconButton( icon: const Icon(Icons.close), - color: Theme.of(context).appBarTheme.backgroundColor, + color: theme.appBarTheme.backgroundColor, alignment: Alignment.topRight, onPressed: () { Navigator.of(context, rootNavigator: true).pop(); @@ -44,7 +45,7 @@ class BackendSwitchDialogState extends State { child: Column( children: [ Text('Current Endpoint: \n${Configuration.of(context).graphqlUrl}', - style: Theme.of(context).textTheme.bodyMedium), + style: theme.textTheme.bodyLarge?.apply(color: theme.hintColor)), Padding( padding: EdgeInsets.only(top: 10, bottom: 10), child: TextField( @@ -60,10 +61,7 @@ class BackendSwitchDialogState extends State { ), password.toLowerCase() == widget.passwordToUnlock ? ElevatedButton( - style: ElevatedButton.styleFrom( - padding: EdgeInsets.symmetric(horizontal: 50, vertical: 20), - textStyle: TextStyle(fontSize: 14, fontWeight: FontWeight.bold)), - child: const Text('Switch API'), + child: Text('Switch API'), onPressed: () => switchBackendUrl(context), ) : Container(), diff --git a/frontend/lib/about/dev_settings_view.dart b/frontend/lib/about/dev_settings_view.dart index 0dd5b70c9..50f7acd05 100644 --- a/frontend/lib/about/dev_settings_view.dart +++ b/frontend/lib/about/dev_settings_view.dart @@ -3,7 +3,7 @@ import 'dart:developer'; import 'package:base32/base32.dart'; import 'package:ehrenamtskarte/app.dart'; -import 'package:ehrenamtskarte/build_config/build_config.dart'; +import 'package:ehrenamtskarte/build_config/build_config.dart' show buildConfig; import 'package:ehrenamtskarte/configuration/configuration.dart'; import 'package:ehrenamtskarte/configuration/settings_model.dart'; import 'package:ehrenamtskarte/identification/card_detail_view/self_verify_card.dart'; @@ -49,6 +49,7 @@ class DevSettingsView extends StatelessWidget { final settings = Provider.of(context); final client = GraphQLProvider.of(context).value; final userCodeModel = Provider.of(context); + final textTheme = Theme.of(context).textTheme; return Padding( padding: const EdgeInsets.all(15.0), child: Column( @@ -89,8 +90,9 @@ class DevSettingsView extends StatelessWidget { onTap: () { showDialog( context: context, - builder: (context) => - SimpleDialog(title: const Text('Settings'), children: [Text(settings.toString())]), + builder: (context) => SimpleDialog(title: const Text('Settings'), children: [ + Text(settings.toString(), style: textTheme.bodySmall), + ]), ); }, ), @@ -128,6 +130,7 @@ class DevSettingsView extends StatelessWidget { showDialog( context: context, builder: (BuildContext context) { + final theme = Theme.of(context); final base64Controller = TextEditingController(); return AlertDialog( scrollable: true, @@ -153,6 +156,7 @@ class DevSettingsView extends StatelessWidget { ), actions: [ TextButton( + style: theme.textButtonTheme.style, child: const Text('Activate Card'), onPressed: () { GoRouter.of(context).push('/$activationRouteName/code#${base64Controller.text}'); diff --git a/frontend/lib/about/language_change.dart b/frontend/lib/about/language_change.dart index 7e91c0fb2..13458a623 100644 --- a/frontend/lib/about/language_change.dart +++ b/frontend/lib/about/language_change.dart @@ -11,12 +11,11 @@ class LanguageChange extends StatelessWidget { @override Widget build(BuildContext context) { + final theme = Theme.of(context); return Column(children: [ ...buildConfig.appLocales.map((item) => DecoratedBox( decoration: BoxDecoration( - color: LocaleSettings.currentLocale.languageCode == item - ? Theme.of(context).colorScheme.surfaceVariant - : null), + color: LocaleSettings.currentLocale.languageCode == item ? theme.colorScheme.surfaceVariant : null), child: ListTile( title: Text( nativeLanguageNames[item]!, @@ -36,9 +35,7 @@ class LanguageChange extends StatelessWidget { Navigator.pop(context); messengerState.showSnackBar( SnackBar( - backgroundColor: Theme.of(context).colorScheme.primary, - content: - Text(t.about.languageChangeSuccessful, style: TextStyle(color: Theme.of(context).colorScheme.background)), + content: Text(t.about.languageChangeSuccessful), ), ); } diff --git a/frontend/lib/about/license_page.dart b/frontend/lib/about/license_page.dart index 0802bdce8..470f73fb9 100644 --- a/frontend/lib/about/license_page.dart +++ b/frontend/lib/about/license_page.dart @@ -21,6 +21,7 @@ class CustomLicensePage extends StatelessWidget { @override Widget build(BuildContext context) { final t = context.t; + final theme = Theme.of(context); return FutureBuilder>( future: LicenseRegistry.licenses.toList(), builder: (BuildContext context, AsyncSnapshot> snapshot) { @@ -61,8 +62,8 @@ class CustomLicensePage extends StatelessWidget { final license = result[index]; final paragraphs = license.licenseParagraphs; return ListTile( - title: Text(license.packageName), - subtitle: Text(t.about.numberLicenses(n: paragraphs.length)), + title: Text(license.packageName, style: theme.textTheme.titleSmall), + subtitle: Text(t.about.numberLicenses(n: paragraphs.length), style: theme.textTheme.bodyMedium), onTap: () { Navigator.push( context, diff --git a/frontend/lib/about/section.dart b/frontend/lib/about/section.dart index 652727715..20abeb97c 100644 --- a/frontend/lib/about/section.dart +++ b/frontend/lib/about/section.dart @@ -8,17 +8,13 @@ class Section extends StatelessWidget { @override Widget build(BuildContext context) { + final theme = Theme.of(context); return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( - padding: EdgeInsets.only(top: 16, left: 16, right: 16), - child: Text(headline, - style: Theme.of(context) - .textTheme - .bodySmall - ?.merge(TextStyle(color: Theme.of(context).colorScheme.secondary))), - ), + padding: EdgeInsets.only(top: 16, left: 16, right: 16), + child: Text(headline, style: theme.textTheme.bodySmall?.apply(color: theme.colorScheme.secondary))), Column(children: children), const SizedBox(height: 10), ], diff --git a/frontend/lib/activation/deeplink_activation.dart b/frontend/lib/activation/deeplink_activation.dart index 490fc90ad..21551a183 100644 --- a/frontend/lib/activation/deeplink_activation.dart +++ b/frontend/lib/activation/deeplink_activation.dart @@ -129,7 +129,6 @@ class _DeepLinkActivationState extends State { // TODO 1656: Improve error handling!! ScaffoldMessenger.of(context).showSnackBar( SnackBar( - backgroundColor: Theme.of(context).colorScheme.primary, content: Text(t.common.unknownError), ), ); @@ -165,6 +164,7 @@ class _WarningText extends StatelessWidget { @override Widget build(BuildContext context) { + final theme = Theme.of(context); final String cardsInUse = userCodeModel.userCodes.length.toString(); final String maxCardAmount = buildConfig.maxCardAmount.toString(); final text = switch (status) { @@ -180,8 +180,8 @@ class _WarningText extends StatelessWidget { padding: EdgeInsets.symmetric(vertical: 8), child: Column( children: [ - Icon(Icons.warning, color: Theme.of(context).colorScheme.secondary), - Text(text, textAlign: TextAlign.center) + Icon(Icons.warning, color: theme.colorScheme.secondary), + Text(text, textAlign: TextAlign.center, style: theme.textTheme.bodyMedium) ], )); } diff --git a/frontend/lib/configuration/settings_model.dart b/frontend/lib/configuration/settings_model.dart index 83eeacda3..5a4ed399b 100644 --- a/frontend/lib/configuration/settings_model.dart +++ b/frontend/lib/configuration/settings_model.dart @@ -63,7 +63,7 @@ class SettingsModel extends ChangeNotifier { } String hideVerificationInfoKey = 'hideVerificationInfo'; - bool get hideVerificationInfo => _getBool(hideVerificationInfoKey) ?? true; + bool get hideVerificationInfo => _getBool(hideVerificationInfoKey) ?? false; Future setHideVerificationInfo({required bool enabled}) async { bool? currentlyHideVerificationInfo = hideVerificationInfo; diff --git a/frontend/lib/identification/activation_workflow/activation_error_dialog.dart b/frontend/lib/identification/activation_workflow/activation_error_dialog.dart index 33796c3a6..bf82076e7 100644 --- a/frontend/lib/identification/activation_workflow/activation_error_dialog.dart +++ b/frontend/lib/identification/activation_workflow/activation_error_dialog.dart @@ -9,13 +9,14 @@ class ActivationErrorDialog extends StatelessWidget { @override Widget build(BuildContext context) { + final theme = Theme.of(context); final t = context.t; return AlertDialog( title: Text(t.identification.activationError), content: SingleChildScrollView( child: ListBody( children: [ - Text(message), + Text(message, style: theme.textTheme.bodyMedium), ], ), ), diff --git a/frontend/lib/identification/activation_workflow/activation_existing_card_dialog.dart b/frontend/lib/identification/activation_workflow/activation_existing_card_dialog.dart index bfb1eec2e..2610cff94 100644 --- a/frontend/lib/identification/activation_workflow/activation_existing_card_dialog.dart +++ b/frontend/lib/identification/activation_workflow/activation_existing_card_dialog.dart @@ -7,19 +7,19 @@ class ActivationExistingCardDialog extends StatelessWidget { @override Widget build(BuildContext context) { + final theme = Theme.of(context); return AlertDialog( - title: const Text('Diese Karte existiert bereits', style: TextStyle(fontSize: 18)), + title: Text('Diese Karte existiert bereits'), content: SingleChildScrollView( child: ListBody( - children: const [ - Text( - 'Diese Karte ist bereits auf ihrem Gerät aktiv.', - ), + children: [ + Text('Diese Karte ist bereits auf ihrem Gerät aktiv.'), ], ), ), actions: [ TextButton( + style: theme.textButtonTheme.style, child: Text(context.t.common.ok), onPressed: () { Navigator.of(context).pop(); diff --git a/frontend/lib/identification/activation_workflow/activation_overwrite_existing_dialog.dart b/frontend/lib/identification/activation_workflow/activation_overwrite_existing_dialog.dart index 433c3b348..5c2128de8 100644 --- a/frontend/lib/identification/activation_workflow/activation_overwrite_existing_dialog.dart +++ b/frontend/lib/identification/activation_workflow/activation_overwrite_existing_dialog.dart @@ -9,7 +9,7 @@ class ActivationOverwriteExistingDialog extends StatelessWidget { Widget build(BuildContext context) { final t = context.t; return AlertDialog( - title: Text(t.identification.activateCurrentDeviceTitle, style: TextStyle(fontSize: 18)), + title: Text(t.identification.activateCurrentDeviceTitle), content: SingleChildScrollView( child: ListBody( children: [ diff --git a/frontend/lib/identification/card_detail_view/card_detail_view.dart b/frontend/lib/identification/card_detail_view/card_detail_view.dart index 48016207d..5a6fe74e9 100644 --- a/frontend/lib/identification/card_detail_view/card_detail_view.dart +++ b/frontend/lib/identification/card_detail_view/card_detail_view.dart @@ -166,7 +166,6 @@ class QrCodeAndStatus extends StatelessWidget { Widget build(BuildContext context) { final CardStatus status = CardStatus.from(userCode); final t = context.t; - return Padding( padding: const EdgeInsets.symmetric(horizontal: 4), child: Column( @@ -208,7 +207,6 @@ class QrCodeAndStatus extends StatelessWidget { onPressed: onMoreActionsPressed, child: Text( t.common.moreActions, - style: TextStyle(color: Theme.of(context).colorScheme.secondary), ), ), ) @@ -228,7 +226,7 @@ class _PaddedText extends StatelessWidget { return Container( padding: const EdgeInsets.only(bottom: 4), constraints: const BoxConstraints(maxWidth: 300), - child: Text(text, textAlign: TextAlign.center), + child: Text(text, textAlign: TextAlign.center, style: Theme.of(context).textTheme.bodyLarge), ); } } diff --git a/frontend/lib/identification/card_detail_view/more_actions_dialog.dart b/frontend/lib/identification/card_detail_view/more_actions_dialog.dart index 571bac288..24a121c74 100644 --- a/frontend/lib/identification/card_detail_view/more_actions_dialog.dart +++ b/frontend/lib/identification/card_detail_view/more_actions_dialog.dart @@ -26,6 +26,7 @@ class MoreActionsDialog extends StatelessWidget { final String maxCardAmount = buildConfig.maxCardAmount.toString(); final bool cardLimitIsReached = hasReachedCardLimit(userCodeModel.userCodes); final t = context.t; + final theme = Theme.of(context); return AlertDialog( contentPadding: const EdgeInsets.only(top: 12), @@ -35,7 +36,7 @@ class MoreActionsDialog extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ ListTile( - title: Text(t.identification.moreActionsApplyTitle), + title: Text(t.identification.moreActionsApplyTitle, style: TextStyle(fontWeight: FontWeight.bold)), subtitle: Text(t.identification.moreActionsApplyDescription), leading: const Icon(Icons.assignment, size: 36), onTap: () { @@ -44,7 +45,7 @@ class MoreActionsDialog extends StatelessWidget { }, ), ListTile( - title: Text(t.identification.moreActionsVerifyTitle), + title: Text(t.identification.moreActionsVerifyTitle, style: TextStyle(fontWeight: FontWeight.bold)), subtitle: Text(t.identification.moreActionsVerifyDescription), leading: const Icon(Icons.verified, size: 36), onTap: () { @@ -55,10 +56,12 @@ class MoreActionsDialog extends StatelessWidget { ListTile( enabled: !cardLimitIsReached, title: Text('${t.identification.moreActionsActivateTitle} ($cardsInUse/$maxCardAmount)', - style: TextStyle(color: Theme.of(context).colorScheme.onBackground)), - subtitle: Text(cardLimitIsReached - ? t.identification.moreActionsActivateLimitDescription - : t.identification.moreActionsActivateDescription), + style: TextStyle(color: cardLimitIsReached ? theme.hintColor : null, fontWeight: FontWeight.bold)), + subtitle: Text( + cardLimitIsReached + ? t.identification.moreActionsActivateLimitDescription + : t.identification.moreActionsActivateDescription, + style: TextStyle(color: cardLimitIsReached ? theme.hintColor : null)), leading: Icon(Icons.add_card, size: 36), onTap: () { Navigator.pop(context); @@ -66,7 +69,7 @@ class MoreActionsDialog extends StatelessWidget { }, ), ListTile( - title: Text(t.identification.moreActionsRemoveTitle), + title: Text(t.identification.moreActionsRemoveTitle, style: TextStyle(fontWeight: FontWeight.bold)), subtitle: Text(t.identification.moreActionsRemoveDescription), leading: const Icon(Icons.delete, size: 36), onTap: () { diff --git a/frontend/lib/identification/card_detail_view/verification_code_view.dart b/frontend/lib/identification/card_detail_view/verification_code_view.dart index 91ca85761..6b1444cd5 100644 --- a/frontend/lib/identification/card_detail_view/verification_code_view.dart +++ b/frontend/lib/identification/card_detail_view/verification_code_view.dart @@ -50,6 +50,7 @@ class VerificationCodeViewState extends State { Widget build(BuildContext context) { final otpCode = _otpCode; final userCode = widget.userCode; + final colorTheme = Theme.of(context).colorScheme; final time = DateTime.now().millisecondsSinceEpoch; final animationDuration = otpCode.validUntilMilliSeconds - time; @@ -77,10 +78,8 @@ class VerificationCodeViewState extends State { version: qr.QrVersions.auto, gapless: false, dataModuleStyle: qr.QrDataModuleStyle( - dataModuleShape: qr.QrDataModuleShape.square, - color: Theme.of(context).textTheme.bodyMedium?.color), - eyeStyle: qr.QrEyeStyle( - eyeShape: qr.QrEyeShape.square, color: Theme.of(context).textTheme.bodyMedium?.color), + dataModuleShape: qr.QrDataModuleShape.square, color: colorTheme.tertiary), + eyeStyle: qr.QrEyeStyle(eyeShape: qr.QrEyeShape.square, color: colorTheme.tertiary), ), ), Positioned.fill( diff --git a/frontend/lib/identification/connection_failed_dialog.dart b/frontend/lib/identification/connection_failed_dialog.dart index 8dd205809..39d164918 100644 --- a/frontend/lib/identification/connection_failed_dialog.dart +++ b/frontend/lib/identification/connection_failed_dialog.dart @@ -15,7 +15,7 @@ class ConnectionFailedDialog extends StatelessWidget { title: t.common.connectionFailed, icon: Icons.signal_cellular_connected_no_internet_4_bar, iconColor: Theme.of(context).colorScheme.onBackground, - child: Text(reason), + child: Text(reason, style: Theme.of(context).textTheme.bodyMedium), ); } diff --git a/frontend/lib/identification/id_card/card_content.dart b/frontend/lib/identification/id_card/card_content.dart index e441339cb..fcb6bd011 100644 --- a/frontend/lib/identification/id_card/card_content.dart +++ b/frontend/lib/identification/id_card/card_content.dart @@ -92,7 +92,9 @@ class CardContent extends StatelessWidget { final startDate = _formattedStartDate; return LayoutBuilder( builder: (context, constraints) { + final theme = Theme.of(context); final scaleFactor = constraints.maxWidth / 300; + final bodyTextStyle = theme.textTheme.bodyMedium?.apply(fontSizeFactor: scaleFactor, color: textColor); final currentRegion = region; final headerLeftTitle = buildConfig.cardBranding.headerTitleLeft.isEmpty && currentRegion != null ? '${currentRegion.prefix} ${currentRegion.name}' @@ -187,7 +189,7 @@ class CardContent extends StatelessWidget { alignment: Alignment.topLeft, child: Text( cardInfo.fullName, - style: TextStyle(fontSize: 14 * scaleFactor, color: textColor), + style: bodyTextStyle, textAlign: TextAlign.start, ), ), @@ -199,13 +201,13 @@ class CardContent extends StatelessWidget { if (formattedBirthday != null) Text( formattedBirthday, - style: TextStyle(fontSize: 14 * scaleFactor, color: textColor), + style: bodyTextStyle, textAlign: TextAlign.start, ), if (passId != null) Text( passId, - style: TextStyle(fontSize: 14 * scaleFactor, color: textColor), + style: bodyTextStyle, textAlign: TextAlign.end, ), ], @@ -215,10 +217,9 @@ class CardContent extends StatelessWidget { padding: const EdgeInsets.only(top: 3.0), child: Text( _getCardValidityDate(context, startDate, _getFormattedExpirationDate(context)), - style: TextStyle( - fontSize: 14 * scaleFactor, - color: - isExpired || isNotYetValid ? Theme.of(context).colorScheme.error : textColor), + style: theme.textTheme.bodyMedium?.apply( + fontSizeFactor: scaleFactor, + color: isExpired || isNotYetValid ? theme.colorScheme.error : textColor), textAlign: TextAlign.start, ), ), diff --git a/frontend/lib/identification/id_card/card_header_logo.dart b/frontend/lib/identification/id_card/card_header_logo.dart index 1443076dc..62463f913 100644 --- a/frontend/lib/identification/id_card/card_header_logo.dart +++ b/frontend/lib/identification/id_card/card_header_logo.dart @@ -1,6 +1,6 @@ import 'package:ehrenamtskarte/build_config/build_config.dart'; import 'package:ehrenamtskarte/util/color_utils.dart'; -import 'package:flutter/widgets.dart'; +import 'package:flutter/material.dart'; Color textColor = getColorFromHex(buildConfig.cardBranding.headerTextColor); int fontSize = buildConfig.cardBranding.headerTextFontSize; @@ -33,7 +33,8 @@ class CardHeaderLogo extends StatelessWidget { Text( title, maxLines: 3, - style: TextStyle(fontSize: fontSize * scaleFactor, color: textColor), + style: + TextStyle(fontSize: fontSize * scaleFactor, color: textColor, fontFamily: buildConfig.theme.fontFamily), textAlign: TextAlign.start, ) ], diff --git a/frontend/lib/identification/identification_page.dart b/frontend/lib/identification/identification_page.dart index 4f5422d92..1288219c8 100644 --- a/frontend/lib/identification/identification_page.dart +++ b/frontend/lib/identification/identification_page.dart @@ -37,7 +37,10 @@ class IdentificationPageState extends State { builder: (context, userCodeModel, child) { if (!userCodeModel.isInitialized) { if (userCodeModel.initializationFailed) { - return SafeArea(child: Center(child: Text(context.t.common.unknownError, textAlign: TextAlign.center))); + return SafeArea( + child: Center( + child: Text(context.t.common.unknownError, + textAlign: TextAlign.center, style: Theme.of(context).textTheme.bodyMedium))); } return Container(); } diff --git a/frontend/lib/identification/info_dialog.dart b/frontend/lib/identification/info_dialog.dart index 9b8d2e0e3..b96d38f51 100644 --- a/frontend/lib/identification/info_dialog.dart +++ b/frontend/lib/identification/info_dialog.dart @@ -23,11 +23,14 @@ class InfoDialog extends StatelessWidget { return AlertDialog( title: ListTile( leading: Icon(icon, color: iconColor ?? theme.colorScheme.primaryContainer, size: 30), - title: Text(title, style: theme.textTheme.headlineSmall), + title: Text(title), ), content: child, actions: [ - TextButton(onPressed: () => Navigator.of(context, rootNavigator: true).pop(), child: Text(t.common.ok)) + TextButton( + onPressed: () => Navigator.of(context, rootNavigator: true).pop(), + child: Text(t.common.ok), + ), ], ); } diff --git a/frontend/lib/identification/no_card_view.dart b/frontend/lib/identification/no_card_view.dart index c8c65d89e..5766b0c5b 100644 --- a/frontend/lib/identification/no_card_view.dart +++ b/frontend/lib/identification/no_card_view.dart @@ -91,7 +91,7 @@ class _TapableCardWithArea extends StatelessWidget { Expanded( child: Text( title, - style: Theme.of(context).textTheme.titleLarge, + style: theme.textTheme.titleLarge, textAlign: TextAlign.left, ), ), @@ -100,7 +100,7 @@ class _TapableCardWithArea extends StatelessWidget { const SizedBox(height: 16), Text( description, - style: Theme.of(context).textTheme.bodyMedium, + style: theme.textTheme.bodyLarge?.apply(color: theme.hintColor), textAlign: TextAlign.left, ), Align( diff --git a/frontend/lib/identification/qr_code_scanner/qr_code_camera_permission_dialog.dart b/frontend/lib/identification/qr_code_scanner/qr_code_camera_permission_dialog.dart index 0c3add04f..ed44ef8d9 100644 --- a/frontend/lib/identification/qr_code_scanner/qr_code_camera_permission_dialog.dart +++ b/frontend/lib/identification/qr_code_scanner/qr_code_camera_permission_dialog.dart @@ -8,13 +8,14 @@ class QrCodeCameraPermissionDialog extends StatelessWidget { @override Widget build(BuildContext context) { + final theme = Theme.of(context); final t = context.t; return AlertDialog( - title: Text(t.identification.cameraAccessRequired, style: TextStyle(fontSize: 18)), + title: Text(t.identification.cameraAccessRequired), content: SingleChildScrollView( child: ListBody( children: [ - Text(t.identification.cameraAccessRequiredSettings), + Text(t.identification.cameraAccessRequiredSettings, style: theme.textTheme.bodyMedium), ], ), ), diff --git a/frontend/lib/identification/qr_code_scanner/qr_code_scanner.dart b/frontend/lib/identification/qr_code_scanner/qr_code_scanner.dart index 98813ceac..754ddbd21 100644 --- a/frontend/lib/identification/qr_code_scanner/qr_code_scanner.dart +++ b/frontend/lib/identification/qr_code_scanner/qr_code_scanner.dart @@ -63,6 +63,7 @@ class _QRViewState extends State { } final controller = hasCameraIssues ? _controllerPredefinedCameraResolution : _controller; final t = context.t; + final theme = Theme.of(context); return Stack( children: [ Column( @@ -85,7 +86,7 @@ class _QRViewState extends State { decoration: ShapeDecoration( shape: QrScannerOverlayShape( borderRadius: 10, - borderColor: Theme.of(context).colorScheme.secondary, + borderColor: theme.colorScheme.secondary, borderLength: 30, borderWidth: 10, cutOutSize: _calculateScanArea(context), @@ -103,7 +104,7 @@ class _QRViewState extends State { children: [ Container( margin: const EdgeInsets.all(8), - child: Text(t.identification.scanQRCode), + child: Text(t.identification.scanQRCode, style: theme.textTheme.bodyLarge), ), QrCodeScannerControls(controller: controller) ], diff --git a/frontend/lib/identification/qr_code_scanner/qr_code_scanner_controls.dart b/frontend/lib/identification/qr_code_scanner/qr_code_scanner_controls.dart index 1c7bdca70..b8538b0d3 100644 --- a/frontend/lib/identification/qr_code_scanner/qr_code_scanner_controls.dart +++ b/frontend/lib/identification/qr_code_scanner/qr_code_scanner_controls.dart @@ -10,6 +10,7 @@ class QrCodeScannerControls extends StatelessWidget { @override Widget build(BuildContext context) { + final theme = Theme.of(context); final t = context.t; return Row( mainAxisAlignment: MainAxisAlignment.center, @@ -23,7 +24,7 @@ class QrCodeScannerControls extends StatelessWidget { valueListenable: controller.torchState, builder: (ctx, state, child) => Text( state == TorchState.on ? t.identification.flashOff : t.identification.flashOn, - style: const TextStyle(fontSize: 16), + style: theme.textTheme.titleSmall?.apply(color: theme.colorScheme.primary), ), ), ), @@ -36,7 +37,7 @@ class QrCodeScannerControls extends StatelessWidget { valueListenable: controller.cameraFacingState, builder: (ctx, state, child) => Text( state == CameraFacing.back ? t.identification.selfieCamera : t.identification.standardCamera, - style: const TextStyle(fontSize: 16), + style: theme.textTheme.titleSmall?.apply(color: theme.colorScheme.primary), ), ), ), diff --git a/frontend/lib/identification/util/activate_card.dart b/frontend/lib/identification/util/activate_card.dart index 57d94635c..d3eca15ad 100644 --- a/frontend/lib/identification/util/activate_card.dart +++ b/frontend/lib/identification/util/activate_card.dart @@ -66,7 +66,6 @@ Future activateCard( if (context.mounted) { messengerState.showSnackBar( SnackBar( - backgroundColor: Theme.of(context).colorScheme.primary, content: Text(t.deeplinkActivation.activationSuccessful), ), ); diff --git a/frontend/lib/identification/verification_workflow/dialogs/negative_verification_result_dialog.dart b/frontend/lib/identification/verification_workflow/dialogs/negative_verification_result_dialog.dart index 06569d1fe..8fc59d0de 100644 --- a/frontend/lib/identification/verification_workflow/dialogs/negative_verification_result_dialog.dart +++ b/frontend/lib/identification/verification_workflow/dialogs/negative_verification_result_dialog.dart @@ -15,7 +15,7 @@ class NegativeVerificationResultDialog extends StatelessWidget { title: t.identification.notVerified, icon: Icons.error, iconColor: Colors.red, - child: Text(reason), + child: Text(reason, style: Theme.of(context).textTheme.bodyMedium), ); } diff --git a/frontend/lib/identification/verification_workflow/dialogs/positive_verification_result_dialog.dart b/frontend/lib/identification/verification_workflow/dialogs/positive_verification_result_dialog.dart index a923b6413..4b084ae75 100644 --- a/frontend/lib/identification/verification_workflow/dialogs/positive_verification_result_dialog.dart +++ b/frontend/lib/identification/verification_workflow/dialogs/positive_verification_result_dialog.dart @@ -38,12 +38,13 @@ class PositiveVerificationResultDialogState extends State[ @@ -60,7 +61,7 @@ class PositiveVerificationResultDialogState extends State[ - TextButton(child: const Text('Abbrechen'), onPressed: () => Navigator.of(context).pop(false)), - TextButton(child: const Text('Löschen'), onPressed: () => removeCard(context)), + TextButton( + child: const Text('Abbrechen'), + onPressed: () => Navigator.of(context).pop(false), + ), + TextButton( + child: const Text('Löschen'), + onPressed: () => removeCard(context), + ), ], ); } diff --git a/frontend/lib/identification/verification_workflow/dialogs/verification_info_dialog.dart b/frontend/lib/identification/verification_workflow/dialogs/verification_info_dialog.dart index a13613c33..34634571e 100644 --- a/frontend/lib/identification/verification_workflow/dialogs/verification_info_dialog.dart +++ b/frontend/lib/identification/verification_workflow/dialogs/verification_info_dialog.dart @@ -11,6 +11,7 @@ class VerificationInfoDialog extends StatelessWidget { Widget build(BuildContext context) { final settings = Provider.of(context); final t = context.t; + final theme = Theme.of(context); return AlertDialog( title: Text(t.identification.verifyInfoTitle), content: SingleChildScrollView( @@ -18,17 +19,17 @@ class VerificationInfoDialog extends StatelessWidget { children: [ _EnumeratedListItem( index: 0, - child: Text(t.identification.scanCode), + child: Text(t.identification.scanCode, style: theme.textTheme.bodyLarge), ), - _EnumeratedListItem(index: 1, child: Text(t.identification.checkingCode)), + _EnumeratedListItem(index: 1, child: Text(t.identification.checkingCode, style: theme.textTheme.bodyLarge)), _EnumeratedListItem( index: 2, - child: Text(t.identification.compareWithID), + child: Text(t.identification.compareWithID, style: theme.textTheme.bodyLarge), ), SizedBox(height: 12), Text( t.identification.internetRequired, - style: TextStyle(fontWeight: FontWeight.bold), + style: theme.textTheme.titleSmall, ), ], ), @@ -70,16 +71,17 @@ class _EnumeratedListItem extends StatelessWidget { @override Widget build(BuildContext context) { + final theme = Theme.of(context); return Padding( padding: const EdgeInsets.symmetric(vertical: 8.0), child: Row( children: [ CircleAvatar( - backgroundColor: Theme.of(context).colorScheme.primary, + backgroundColor: theme.colorScheme.primary, child: Text( '${index + 1}', style: TextStyle( - color: Theme.of(context).colorScheme.background, + color: theme.colorScheme.background, fontWeight: FontWeight.bold, ), ), diff --git a/frontend/lib/identification/verification_workflow/verification_qr_scanner_page.dart b/frontend/lib/identification/verification_workflow/verification_qr_scanner_page.dart index 56be53221..59afa0676 100644 --- a/frontend/lib/identification/verification_workflow/verification_qr_scanner_page.dart +++ b/frontend/lib/identification/verification_workflow/verification_qr_scanner_page.dart @@ -32,6 +32,7 @@ class VerificationQrScannerPage extends StatelessWidget { final config = Configuration.of(context); final settings = Provider.of(context); final currentUserCode = userCode; + final theme = Theme.of(context); return Column( children: [ CustomAppBar( @@ -39,7 +40,7 @@ class VerificationQrScannerPage extends StatelessWidget { actions: [ IconButton( icon: const Icon(Icons.help), - color: Theme.of(context).appBarTheme.foregroundColor, + color: theme.appBarTheme.foregroundColor, onPressed: () async { await settings.setHideVerificationInfo(enabled: false); if (context.mounted) await VerificationInfoDialog.show(context); diff --git a/frontend/lib/intro_slides/intro_screen.dart b/frontend/lib/intro_slides/intro_screen.dart index c6852ccd5..25e4c3ea8 100644 --- a/frontend/lib/intro_slides/intro_screen.dart +++ b/frontend/lib/intro_slides/intro_screen.dart @@ -29,7 +29,6 @@ class IntroScreen extends StatelessWidget { renderDoneBtn: Text(t.common.done), renderNextBtn: Text(t.common.next), renderPrevBtn: Text(t.common.previous), - doneButtonStyle: Theme.of(context).textButtonTheme.style, indicatorConfig: IndicatorConfig( colorActiveIndicator: theme.colorScheme.primary, colorIndicator: Colors.grey, diff --git a/frontend/lib/location/dialogs.dart b/frontend/lib/location/dialogs.dart index ce40a59f5..deee39ade 100644 --- a/frontend/lib/location/dialogs.dart +++ b/frontend/lib/location/dialogs.dart @@ -12,8 +12,14 @@ class LocationServiceDialog extends StatelessWidget { title: Text(t.location.activateLocationAccess), content: Text(t.location.activateLocationAccessSettings), actions: [ - TextButton(child: Text(t.common.cancel), onPressed: () => Navigator.of(context).pop(false)), - TextButton(child: Text(t.common.openSettings), onPressed: () => Navigator.of(context).pop(true)) + TextButton( + child: Text(t.common.cancel), + onPressed: () => Navigator.of(context).pop(false), + ), + TextButton( + child: Text(t.common.openSettings), + onPressed: () => Navigator.of(context).pop(true), + ) ], ); } @@ -27,16 +33,26 @@ class RationaleDialog extends StatelessWidget { @override Widget build(BuildContext context) { final t = context.t; + final theme = Theme.of(context); return AlertDialog( title: Text(t.location.locationPermission), content: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, - children: [Text(_rationale), Text(t.location.askPermissionsAgain)], + children: [ + Text(_rationale, style: theme.textTheme.bodyLarge), + Text(t.location.askPermissionsAgain, style: theme.textTheme.bodyLarge) + ], ), actions: [ - TextButton(child: Text(t.location.grantPermission), onPressed: () => Navigator.of(context).pop(true)), - TextButton(child: Text(t.common.cancel), onPressed: () => Navigator.of(context).pop(false)) + TextButton( + child: Text(t.location.grantPermission), + onPressed: () => Navigator.of(context).pop(true), + ), + TextButton( + child: Text(t.common.cancel), + onPressed: () => Navigator.of(context).pop(false), + ) ], ); } diff --git a/frontend/lib/map/map/attribution_dialog_item.dart b/frontend/lib/map/map/attribution_dialog_item.dart index 30aa526aa..7209680ec 100644 --- a/frontend/lib/map/map/attribution_dialog_item.dart +++ b/frontend/lib/map/map/attribution_dialog_item.dart @@ -16,6 +16,7 @@ class AttributionDialogItem extends StatelessWidget { @override Widget build(BuildContext context) { + final theme = Theme.of(context); return SimpleDialogOption( onPressed: onPressed, child: Row( @@ -26,7 +27,7 @@ class AttributionDialogItem extends StatelessWidget { Flexible( child: Container( padding: const EdgeInsetsDirectional.only(start: 8.0), - child: Text(text, style: TextStyle(color: color)), + child: Text(text, style: theme.textTheme.bodySmall?.apply(color: color)), ), ), ], diff --git a/frontend/lib/search/filter_bar.dart b/frontend/lib/search/filter_bar.dart index 1601e3608..9f97212cb 100644 --- a/frontend/lib/search/filter_bar.dart +++ b/frontend/lib/search/filter_bar.dart @@ -1,5 +1,5 @@ import 'package:collection/collection.dart'; -import 'package:ehrenamtskarte/build_config/build_config.dart'; +import 'package:ehrenamtskarte/build_config/build_config.dart' show buildConfig; import 'package:ehrenamtskarte/category_assets.dart'; import 'package:ehrenamtskarte/search/filter_bar_button.dart'; import 'package:flutter/material.dart'; @@ -14,7 +14,7 @@ class FilterBar extends StatelessWidget { @override Widget build(BuildContext context) { final t = context.t; - + final theme = Theme.of(context); final sortedCategories = [...categoryAssets(context).where((category) => category.id != 9)]; sortedCategories.sort((a, b) => a.shortName.length.compareTo(b.shortName.length)); sortedCategories.add(categoryAssets(context).where((category) => category.id == 9).single); @@ -29,7 +29,7 @@ class FilterBar extends StatelessWidget { child: Row( children: [ Text(t.search.filterByCategories.toUpperCase(), - maxLines: 1, style: const TextStyle(color: Colors.grey)), + maxLines: 1, style: theme.textTheme.bodyMedium?.apply(color: theme.hintColor)), const Expanded(child: Padding(padding: EdgeInsets.only(left: 8), child: Divider(thickness: 0.7))) ], ), diff --git a/frontend/lib/search/filter_bar_button.dart b/frontend/lib/search/filter_bar_button.dart index c0286e9a5..e2b0e3ccd 100644 --- a/frontend/lib/search/filter_bar_button.dart +++ b/frontend/lib/search/filter_bar_button.dart @@ -87,7 +87,7 @@ class _FilterBarButtonState extends State with SingleTickerProv builder: (context, child) { final color = Color.lerp(theme.colorScheme.background, selectedColor, colorTween.value); return ConstrainedBox( - constraints: BoxConstraints.tightFor(width: width, height: 70), + constraints: BoxConstraints.tightFor(width: width, height: 74), child: Card( margin: EdgeInsets.zero, color: color, @@ -102,24 +102,21 @@ class _FilterBarButtonState extends State with SingleTickerProv widget.onCategoryPress(widget.asset, isSelected); }); }, - child: Padding( - padding: const EdgeInsets.only(top: 4), - child: Column( - children: [ - SvgPicture.asset(widget.asset.icon, width: 40.0, semanticsLabel: widget.asset.name), - Expanded( - child: Container( - alignment: Alignment.center, - child: Text( - widget.asset.shortName, - maxLines: 2, - style: const TextStyle(fontSize: 10), - textAlign: TextAlign.center, - ), + child: Column( + children: [ + SvgPicture.asset(widget.asset.icon, width: 40.0, semanticsLabel: widget.asset.name), + Expanded( + child: Container( + alignment: Alignment.topCenter, + child: Text( + widget.asset.shortName, + maxLines: 2, + style: theme.textTheme.labelSmall, + textAlign: TextAlign.center, ), - ) - ], - ), + ), + ) + ], ), ), ), diff --git a/frontend/lib/search/results_loader.dart b/frontend/lib/search/results_loader.dart index c908febfc..114de1e23 100644 --- a/frontend/lib/search/results_loader.dart +++ b/frontend/lib/search/results_loader.dart @@ -151,13 +151,15 @@ class ResultsLoaderState extends State { Widget _buildErrorWithRetry(BuildContext context) { final t = context.t; + final theme = Theme.of(context); return Center( child: Column( mainAxisSize: MainAxisSize.min, children: [ const Icon(Icons.warning, size: 60, color: Colors.orange), - Text(t.common.checkConnection), + Text(t.common.checkConnection, style: theme.textTheme.bodyMedium), OutlinedButton( + style: theme.textButtonTheme.style, onPressed: _pagingController.retryLastFailedRequest, child: Text(t.common.tryAgain), ) @@ -168,12 +170,13 @@ class ResultsLoaderState extends State { Widget _buildNoItemsFoundIndicator(BuildContext context) { final t = context.t; + final theme = Theme.of(context); return Center( child: Column( mainAxisSize: MainAxisSize.min, children: [ - Icon(Icons.search_off, size: 60, color: Theme.of(context).disabledColor), - Text(t.search.noAcceptingStoresFound), + Icon(Icons.search_off, size: 60, color: theme.disabledColor), + Text(t.search.noAcceptingStoresFound, style: theme.textTheme.bodyMedium), ], ), ); diff --git a/frontend/lib/search/search_page.dart b/frontend/lib/search/search_page.dart index 37f5b5b80..e535ab5d6 100644 --- a/frontend/lib/search/search_page.dart +++ b/frontend/lib/search/search_page.dart @@ -33,6 +33,7 @@ class _SearchPageState extends State { @override Widget build(BuildContext context) { final t = context.t; + final theme = Theme.of(context); return Stack( children: [ CustomScrollView( @@ -50,7 +51,7 @@ class _SearchPageState extends State { children: [ Text( '${t.search.searchResults.toUpperCase()} ${_sortingMode == SortingMode.byDistance ? t.search.nearby : t.search.alphabetically}', - style: const TextStyle(color: Colors.grey), + style: theme.textTheme.bodyMedium?.apply(color: theme.hintColor), ), const Expanded(child: Padding(padding: EdgeInsets.only(left: 8), child: Divider())) ], diff --git a/frontend/lib/store_widgets/accepting_store_summary.dart b/frontend/lib/store_widgets/accepting_store_summary.dart index bb1424060..fca45412e 100644 --- a/frontend/lib/store_widgets/accepting_store_summary.dart +++ b/frontend/lib/store_widgets/accepting_store_summary.dart @@ -92,6 +92,7 @@ class StoreTextOverview extends StatelessWidget { @override Widget build(BuildContext context) { + final theme = Theme.of(context); final t = context.t; final location = store.location; return Expanded( @@ -103,14 +104,14 @@ class StoreTextOverview extends StatelessWidget { store.name ?? t.store.acceptingStore, maxLines: 1, overflow: TextOverflow.ellipsis, - style: Theme.of(context).textTheme.bodyLarge, + style: theme.textTheme.bodyLarge, ), const SizedBox(height: 4), Text( store.description ?? t.store.noDescriptionAvailable, maxLines: 1, overflow: TextOverflow.ellipsis, - style: Theme.of(context).textTheme.bodyMedium, + style: theme.textTheme.bodyLarge?.apply(color: theme.hintColor), ), if (showTownName && location != null) Text(location, maxLines: 1, overflow: TextOverflow.ellipsis) ], @@ -136,8 +137,10 @@ class DistanceText extends StatelessWidget { @override Widget build(BuildContext context) { + final theme = Theme.of(context); return Center( - child: Text(_formatDistance(distance), maxLines: 1, style: Theme.of(context).textTheme.bodyMedium), + child: + Text(_formatDistance(distance), maxLines: 1, style: theme.textTheme.bodyLarge?.apply(color: theme.hintColor)), ); } } diff --git a/frontend/lib/store_widgets/detail/contact_info_row.dart b/frontend/lib/store_widgets/detail/contact_info_row.dart index 4a4f831ee..a4dfe20d4 100644 --- a/frontend/lib/store_widgets/detail/contact_info_row.dart +++ b/frontend/lib/store_widgets/detail/contact_info_row.dart @@ -20,6 +20,7 @@ class ContactInfoRow extends StatelessWidget { @override Widget build(BuildContext context) { + final theme = Theme.of(context); if (_description.isEmpty) { return const SizedBox.shrink(); } @@ -31,7 +32,7 @@ class ContactInfoRow extends StatelessWidget { child: Container( width: 42, height: 42, - color: iconFillColor ?? Theme.of(context).colorScheme.primary, + color: iconFillColor ?? theme.colorScheme.primary, child: Icon( _icon, size: 28, @@ -44,6 +45,7 @@ class ContactInfoRow extends StatelessWidget { Expanded( child: Text( _description, + style: theme.textTheme.bodyMedium, ), ), ], diff --git a/frontend/lib/store_widgets/detail/detail_app_bar.dart b/frontend/lib/store_widgets/detail/detail_app_bar.dart index a92663f4a..b8a5ac0ba 100644 --- a/frontend/lib/store_widgets/detail/detail_app_bar.dart +++ b/frontend/lib/store_widgets/detail/detail_app_bar.dart @@ -60,6 +60,7 @@ class DetailAppBarBottom extends StatelessWidget { @override Widget build(BuildContext context) { + final textTheme = Theme.of(context).textTheme; return Container( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), alignment: Alignment.bottomLeft, @@ -68,13 +69,13 @@ class DetailAppBarBottom extends StatelessWidget { children: [ Text( categoryName ?? '', - style: Theme.of(context).textTheme.bodyMedium?.apply(color: textColorGrey), + style: textTheme.bodyLarge?.apply(color: textColorGrey), maxLines: 1, overflow: TextOverflow.ellipsis, ), Text( title ?? '', - style: Theme.of(context).textTheme.titleLarge?.apply(color: textColor), + style: textTheme.titleLarge?.apply(color: textColor), maxLines: 2, overflow: TextOverflow.ellipsis, ) @@ -106,8 +107,9 @@ class DetailAppBar extends StatelessWidget { final isFavorite = favoritesProvider.isFavorite(storeId); final accentColor = getDarkenedColorForCategory(context, categoryId); - final foregroundColor = Theme.of(context).appBarTheme.foregroundColor; - final backgroundColor = accentColor ?? Theme.of(context).colorScheme.primary; + final theme = Theme.of(context); + final foregroundColor = theme.appBarTheme.foregroundColor; + final backgroundColor = accentColor ?? theme.colorScheme.primary; final textColor = getReadableOnColor(backgroundColor); final textColorGrey = getReadableOnColorSecondary(backgroundColor); diff --git a/frontend/lib/store_widgets/detail/detail_content.dart b/frontend/lib/store_widgets/detail/detail_content.dart index 4911b8f3b..1f338804e 100644 --- a/frontend/lib/store_widgets/detail/detail_content.dart +++ b/frontend/lib/store_widgets/detail/detail_content.dart @@ -30,6 +30,7 @@ class DetailContent extends StatelessWidget { @override Widget build(BuildContext context) { final t = context.t; + final theme = Theme.of(context); final address = acceptingStore.address; final street = address.street; final location = '${address.postalCode} ${address.location}'; @@ -53,9 +54,9 @@ class DetailContent extends StatelessWidget { if (storeDescription != null) ...[ Text( storeDescription, - style: Theme.of(context).textTheme.bodyLarge, + style: theme.textTheme.bodyLarge, ), - Divider(thickness: 0.7, height: 48, color: Theme.of(context).primaryColorLight), + Divider(thickness: 0.7, height: 48, color: theme.primaryColorLight), ], Column( children: [ @@ -102,7 +103,7 @@ class DetailContent extends StatelessWidget { Divider( thickness: 0.7, height: 48, - color: Theme.of(context).primaryColorLight, + color: theme.primaryColorLight, ), ButtonBar( alignment: MainAxisAlignment.center, diff --git a/frontend/lib/store_widgets/removed_store_content.dart b/frontend/lib/store_widgets/removed_store_content.dart index e219c4329..c8742bb72 100644 --- a/frontend/lib/store_widgets/removed_store_content.dart +++ b/frontend/lib/store_widgets/removed_store_content.dart @@ -13,6 +13,7 @@ class RemovedStoreContent extends StatelessWidget { @override Widget build(BuildContext context) { + final theme = Theme.of(context); final favoritesProvider = Provider.of(context); return Expanded( child: Scaffold( @@ -24,17 +25,18 @@ class RemovedStoreContent extends StatelessWidget { children: [ Text( t.store.acceptingStoreNotAvailable, - style: Theme.of(context).textTheme.bodyLarge, + style: theme.textTheme.bodyLarge, ), Text( t.store.removeDescription, - style: Theme.of(context).textTheme.bodyLarge, + style: theme.textTheme.bodyLarge, ), - Divider(thickness: 0.7, height: 48, color: Theme.of(context).primaryColorLight), + Divider(thickness: 0.7, height: 48, color: theme.primaryColorLight), ButtonBar( alignment: MainAxisAlignment.center, children: [ OutlinedButton( + style: theme.textButtonTheme.style, child: Text(t.store.removeButtonText), onPressed: () async { await _removeFavorite(context, favoritesProvider); diff --git a/frontend/lib/store_widgets/removed_store_summary.dart b/frontend/lib/store_widgets/removed_store_summary.dart index 4f49a17a4..5957a65a5 100644 --- a/frontend/lib/store_widgets/removed_store_summary.dart +++ b/frontend/lib/store_widgets/removed_store_summary.dart @@ -20,6 +20,7 @@ class RemovedStoreSummary extends StatelessWidget { @override Widget build(BuildContext context) { + final theme = Theme.of(context); final t = context.t; return SafeArea( bottom: false, @@ -42,14 +43,14 @@ class RemovedStoreSummary extends StatelessWidget { storeName, maxLines: 1, overflow: TextOverflow.ellipsis, - style: Theme.of(context).textTheme.bodyLarge, + style: theme.textTheme.bodyLarge, ), const SizedBox(height: 4), Text( t.store.acceptingStoreNotAvailable, maxLines: 1, overflow: TextOverflow.ellipsis, - style: Theme.of(context).textTheme.bodyMedium?.copyWith(color: Colors.redAccent), + style: theme.textTheme.bodyLarge?.apply(color: Colors.redAccent), ), ], ), @@ -58,7 +59,7 @@ class RemovedStoreSummary extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 8), child: SizedBox( height: double.infinity, - child: Icon(Icons.keyboard_arrow_right, size: 30.0, color: Theme.of(context).disabledColor), + child: Icon(Icons.keyboard_arrow_right, size: 30.0, color: theme.disabledColor), ), ), ], diff --git a/frontend/lib/themes.dart b/frontend/lib/themes.dart index 29fa2c072..46c4c46e9 100644 --- a/frontend/lib/themes.dart +++ b/frontend/lib/themes.dart @@ -3,25 +3,49 @@ import 'package:ehrenamtskarte/util/color_utils.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +/// Typography classes +final titleLarge = const TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold); +final titleMedium = const TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold); +final titleSmall = const TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold); +final bodyLarge = const TextStyle(fontSize: 15.0, fontWeight: FontWeight.normal); +final bodyMedium = const TextStyle(fontSize: 14.0, fontWeight: FontWeight.normal); +final bodySmall = const TextStyle(fontSize: 12.0, fontWeight: FontWeight.normal); +final labelSmall = const TextStyle(fontSize: 10.0, fontWeight: FontWeight.normal); + ThemeData get lightTheme { + final textColor = Colors.black87; final defaultTypography = Typography.blackMountainView; final primaryColor = getColorFromHex(buildConfig.theme.primaryLight); + final backgroundColor = Colors.white; + final lightTheme = ThemeData( fontFamily: buildConfig.theme.fontFamily, colorScheme: ColorScheme.light( primary: primaryColor, secondary: primaryColor, - background: Colors.white, + background: backgroundColor, surfaceVariant: const Color(0xffefefef), surfaceTint: Colors.white54, error: const Color(0xffcc0000), + tertiary: const Color(0xFF505050), + ), + dialogTheme: DialogTheme( + titleTextStyle: titleLarge.apply(color: textColor), contentTextStyle: bodyLarge.apply(color: textColor)), + listTileTheme: ListTileThemeData( + titleTextStyle: bodyLarge.apply(color: textColor), + subtitleTextStyle: bodySmall.apply(color: textColor), ), + snackBarTheme: + SnackBarThemeData(backgroundColor: primaryColor, contentTextStyle: bodyLarge.apply(color: backgroundColor)), textTheme: defaultTypography.copyWith( - headlineMedium: defaultTypography.headlineMedium?.apply(color: Colors.black87), - headlineSmall: defaultTypography.headlineSmall?.apply(color: Colors.black87), - titleLarge: const TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold), - bodyLarge: const TextStyle(fontSize: 15.0, fontWeight: FontWeight.normal), - bodyMedium: const TextStyle(fontSize: 15.0, color: Color(0xFF505050)), + headlineSmall: defaultTypography.headlineSmall?.apply(color: textColor), + titleLarge: titleLarge, + titleMedium: titleMedium, + titleSmall: titleSmall, + bodyLarge: bodyLarge, + bodyMedium: bodyMedium, + bodySmall: bodySmall, + labelSmall: labelSmall, ), useMaterial3: true, ); @@ -34,15 +58,15 @@ ThemeData get lightTheme { color: Color(0xffeeeeee), ), appBarTheme: AppBarTheme( - systemOverlayStyle: SystemUiOverlayStyle.light, - backgroundColor: lightTheme.colorScheme.primary, - foregroundColor: Colors.white, - ), + systemOverlayStyle: SystemUiOverlayStyle.dark, + backgroundColor: lightTheme.colorScheme.primary, + foregroundColor: backgroundColor, + titleTextStyle: titleMedium), outlinedButtonTheme: OutlinedButtonThemeData( style: ButtonStyle(side: MaterialStatePropertyAll(BorderSide(color: primaryColor, width: 1))), ), checkboxTheme: CheckboxThemeData( - checkColor: const MaterialStatePropertyAll(Colors.black), + checkColor: MaterialStatePropertyAll(textColor), fillColor: MaterialStatePropertyAll(primaryColor), ), ); @@ -51,22 +75,32 @@ ThemeData get lightTheme { ThemeData get darkTheme { final defaultTypography = Typography.whiteMountainView; final primaryColor = getColorFromHex(buildConfig.theme.primaryDark); + final backgroundColor = const Color(0xff121212); + final theme = ThemeData( fontFamily: buildConfig.theme.fontFamily, colorScheme: ColorScheme.dark( primary: primaryColor, secondary: primaryColor, - background: const Color(0xff121212), + background: backgroundColor, surfaceVariant: const Color(0xff262626), surfaceTint: Colors.white, error: const Color(0xff8b0000), + tertiary: const Color(0xFFC6C4C4), ), + dialogTheme: DialogTheme(titleTextStyle: titleMedium, contentTextStyle: bodySmall), + listTileTheme: ListTileThemeData(titleTextStyle: bodyLarge, subtitleTextStyle: bodySmall), + snackBarTheme: + SnackBarThemeData(backgroundColor: primaryColor, contentTextStyle: bodyLarge.apply(color: backgroundColor)), textTheme: defaultTypography.copyWith( - headlineMedium: defaultTypography.headlineMedium?.apply(color: Colors.white), headlineSmall: defaultTypography.headlineSmall?.apply(color: Colors.white), - titleLarge: const TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold), - bodyLarge: const TextStyle(fontSize: 15.0, fontWeight: FontWeight.normal), - bodyMedium: const TextStyle(fontSize: 15.0, color: Color(0xFFC6C4C4)), + titleLarge: titleLarge, + titleMedium: titleMedium, + titleSmall: titleSmall, + bodyLarge: bodyLarge, + bodyMedium: bodyMedium, + bodySmall: bodySmall, + labelSmall: labelSmall, ), useMaterial3: true, ); @@ -78,7 +112,11 @@ ThemeData get darkTheme { dividerTheme: DividerThemeData( color: Color(0xFF505050), ), - appBarTheme: AppBarTheme(systemOverlayStyle: SystemUiOverlayStyle.light, color: theme.colorScheme.primary), + appBarTheme: AppBarTheme( + systemOverlayStyle: SystemUiOverlayStyle.light, + color: theme.colorScheme.primary, + foregroundColor: Colors.white, + titleTextStyle: titleMedium), outlinedButtonTheme: OutlinedButtonThemeData( style: ButtonStyle(side: MaterialStatePropertyAll(BorderSide(color: primaryColor, width: 1))), ), diff --git a/frontend/lib/util/messenger_utils.dart b/frontend/lib/util/messenger_utils.dart index c60601b06..29093cbdb 100644 --- a/frontend/lib/util/messenger_utils.dart +++ b/frontend/lib/util/messenger_utils.dart @@ -1,7 +1,8 @@ import 'package:flutter/material.dart'; void showSnackBar(BuildContext context, String message, [Color? backgroundColor]) { - final primaryColor = Theme.of(context).colorScheme.primary; + final theme = Theme.of(context); + final primaryColor = theme.colorScheme.primary; ScaffoldMessenger.of(context).showSnackBar( SnackBar( backgroundColor: backgroundColor ?? primaryColor, diff --git a/frontend/lib/widgets/app_bars.dart b/frontend/lib/widgets/app_bars.dart index 6295db2d0..5eda16f31 100644 --- a/frontend/lib/widgets/app_bars.dart +++ b/frontend/lib/widgets/app_bars.dart @@ -15,7 +15,8 @@ class CustomAppBar extends StatelessWidget { @override Widget build(BuildContext context) { - final foregroundColor = Theme.of(context).appBarTheme.foregroundColor; + final theme = Theme.of(context); + final foregroundColor = theme.appBarTheme.foregroundColor; return AppBar( leading: BackButton(color: foregroundColor), title: Text(title), @@ -63,11 +64,12 @@ class CustomSliverAppBar extends StatelessWidget { @override Widget build(BuildContext context) { - final foregroundColor = Theme.of(context).appBarTheme.foregroundColor; + final theme = Theme.of(context); + final foregroundColor = theme.appBarTheme.foregroundColor; return SliverAppBar( leading: BackButton(color: foregroundColor), iconTheme: IconThemeData(color: foregroundColor), - title: Text(title), + title: Text(title, style: theme.textTheme.titleMedium?.apply(color: theme.appBarTheme.foregroundColor)), pinned: true, ); } @@ -90,7 +92,8 @@ class SearchSliverAppBarState extends State { @override Widget build(BuildContext context) { final t = context.t; - final foregroundColor = Theme.of(context).appBarTheme.foregroundColor; + final theme = Theme.of(context); + final foregroundColor = theme.appBarTheme.foregroundColor; return SliverAppBar( title: TextField( onTapOutside: (PointerDownEvent event) { @@ -101,10 +104,10 @@ class SearchSliverAppBarState extends State { focusNode: focusNode, decoration: InputDecoration.collapsed( hintText: t.search.searchHint, - hintStyle: TextStyle(color: foregroundColor?.withOpacity(0.8)), + hintStyle: theme.textTheme.bodyLarge?.apply(color: foregroundColor), ), cursorColor: foregroundColor, - style: TextStyle(color: foregroundColor), + style: theme.textTheme.bodyLarge?.apply(color: foregroundColor), ), pinned: true, actionsIconTheme: IconThemeData(color: foregroundColor), @@ -113,7 +116,7 @@ class SearchSliverAppBarState extends State { IconButton(icon: const Icon(Icons.clear), onPressed: _clearInput, color: foregroundColor), Padding( padding: const EdgeInsets.only(right: 15.0), - child: Icon(Icons.search, color: foregroundColor?.withOpacity(0.50)), + child: Icon(Icons.search, color: foregroundColor?.withOpacity(0.9)), ), ], ); diff --git a/frontend/lib/widgets/error_message.dart b/frontend/lib/widgets/error_message.dart index b27e05d86..6b5bf1dd1 100644 --- a/frontend/lib/widgets/error_message.dart +++ b/frontend/lib/widgets/error_message.dart @@ -11,7 +11,7 @@ class ErrorMessage extends StatelessWidget { children: [ const Icon(Icons.warning, color: Colors.orange), const SizedBox(width: 10), - Expanded(child: Text(_message)), + Expanded(child: Text(_message, style: Theme.of(context).textTheme.bodyMedium)), const Icon(Icons.replay) ], ); diff --git a/frontend/lib/widgets/extended_floating_action_button.dart b/frontend/lib/widgets/extended_floating_action_button.dart index 1ccde72e4..30f815edf 100644 --- a/frontend/lib/widgets/extended_floating_action_button.dart +++ b/frontend/lib/widgets/extended_floating_action_button.dart @@ -12,8 +12,9 @@ class ExtendedFloatingActionButton extends StatelessWidget { @override Widget build(BuildContext context) { + final theme = Theme.of(context); return FloatingActionButton.extended( - backgroundColor: Theme.of(context).colorScheme.surfaceVariant, + backgroundColor: theme.colorScheme.surfaceVariant, elevation: 1, onPressed: onPressed, icon: AnimatedSwitcher( @@ -23,12 +24,12 @@ class ExtendedFloatingActionButton extends StatelessWidget { : Icon( icon, size: 24, - color: Theme.of(context).colorScheme.secondary, + color: theme.colorScheme.secondary, ), ), label: Text( label, - style: TextStyle(color: Theme.of(context).hintColor), + style: theme.textTheme.bodyMedium?.apply(color: theme.hintColor), ), ); }