diff --git a/app/lib/common/widgets/hyperlink.dart b/app/lib/common/widgets/hyperlink.dart index d8bfa09d..16cbf135 100644 --- a/app/lib/common/widgets/hyperlink.dart +++ b/app/lib/common/widgets/hyperlink.dart @@ -1,21 +1,23 @@ import '../module.dart'; class Hyperlink extends StatelessWidget { - const Hyperlink({ required this.text, required this.onTap }); + const Hyperlink({ required this.text, required this.onTap, this.style }); final String text; final void Function() onTap; + final TextStyle? style; @override Widget build(BuildContext context) { + final linkStyle = TextStyle( + color: PharMeTheme.secondaryColor, + decoration: TextDecoration.underline, + decorationColor: PharMeTheme.secondaryColor, + ); return GestureDetector( onTap: onTap, child: Text( text, - style: TextStyle( - color: PharMeTheme.secondaryColor, - decoration: TextDecoration.underline, - decorationColor: PharMeTheme.secondaryColor, - ), + style: style != null ? style!.merge(linkStyle) : linkStyle, ), ); } diff --git a/app/lib/error/pages/error.dart b/app/lib/error/pages/error.dart index 12040f18..44cb5396 100644 --- a/app/lib/error/pages/error.dart +++ b/app/lib/error/pages/error.dart @@ -8,6 +8,14 @@ class ErrorPage extends StatelessWidget { final String error; + Text _errorText(String text, { TextStyle? style }) => Text( + text, + textAlign: TextAlign.center, + style: style != null + ? PharMeTheme.textTheme.bodyLarge!.merge(style) + : PharMeTheme.textTheme.bodyLarge, + ); + @override Widget build(BuildContext context) { return PopScope( @@ -17,35 +25,23 @@ class ErrorPage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - Text( + _errorText( context.l10n.error_title, style: PharMeTheme.textTheme.headlineMedium, - textAlign: TextAlign.center, - ), - SizedBox(height: PharMeTheme.mediumSpace), - RichText( - textAlign: TextAlign.center, - text: TextSpan( - style: PharMeTheme.textTheme.bodyLarge, - children: [ - TextSpan( - text: context.l10n.error_uncaught_message_first_part, - ), - TextSpan( - text: context.l10n.error_uncaught_message_bold_part, - style: TextStyle(fontWeight: FontWeight.bold), - ) - ], - ), ), SizedBox(height: PharMeTheme.mediumSpace), - Text( - context.l10n.error_uncaught_message_contact, - style: PharMeTheme.textTheme.bodyLarge, - textAlign: TextAlign.center, + _errorText(context.l10n.error_uncaught_message_first_part), + SizedBox(height: PharMeTheme.smallSpace), + _errorText( + context.l10n.error_uncaught_message_bold_part, + style: TextStyle(fontWeight: FontWeight.bold), ), + SizedBox(height: PharMeTheme.smallSpace), + _errorText(context.l10n.error_uncaught_message_contact), + SizedBox(height: PharMeTheme.smallSpace), Hyperlink( text: contactEmailAddress, + style: PharMeTheme.textTheme.bodyLarge, onTap: () => sendEmail( subject: context.l10n.error_mail_subject, body: context.l10n.error_mail_body(error),