diff --git a/lib/widgets/common/basic/outlined_text.dart b/lib/widgets/common/basic/outlined_text.dart index 7def450af..22630b843 100644 --- a/lib/widgets/common/basic/outlined_text.dart +++ b/lib/widgets/common/basic/outlined_text.dart @@ -8,6 +8,9 @@ class OutlinedText extends StatelessWidget { final Color outlineColor; final double outlineBlurSigma; final TextAlign? textAlign; + final bool? softWrap; + final TextOverflow? overflow; + final int? maxLines; static const widgetSpanAlignment = PlaceholderAlignment.middle; @@ -18,6 +21,9 @@ class OutlinedText extends StatelessWidget { Color? outlineColor, double? outlineBlurSigma, this.textAlign, + this.softWrap, + this.overflow, + this.maxLines, }) : outlineWidth = outlineWidth ?? 1, outlineColor = outlineColor ?? Colors.black, outlineBlurSigma = outlineBlurSigma ?? 0; @@ -49,6 +55,9 @@ class OutlinedText extends StatelessWidget { children: textSpans.map(_toStrokeSpan).toList(), ), textAlign: textAlign, + softWrap: softWrap, + overflow: overflow, + maxLines: maxLines, ), ), Text.rich( @@ -56,6 +65,9 @@ class OutlinedText extends StatelessWidget { children: hasOutline ? textSpans.map(_toFillSpan).toList() : textSpans, ), textAlign: textAlign, + softWrap: softWrap, + overflow: overflow, + maxLines: maxLines, ), ], ); diff --git a/lib/widgets/common/fx/highlight_decoration.dart b/lib/widgets/common/fx/highlight_decoration.dart index 8deec871b..b888fa5ff 100644 --- a/lib/widgets/common/fx/highlight_decoration.dart +++ b/lib/widgets/common/fx/highlight_decoration.dart @@ -24,7 +24,8 @@ class _HighlightDecorationPainter extends BoxPainter { final confHeight = size.height; final paintHeight = confHeight * .4; final rect = Rect.fromLTWH(offset.dx, offset.dy + confHeight - paintHeight, size.width, paintHeight); + final rrect = RRect.fromRectAndRadius(rect, Radius.circular(paintHeight)); final paint = Paint()..color = decoration.color; - canvas.drawRect(rect, paint); + canvas.drawRRect(rrect, paint); } } diff --git a/lib/widgets/common/identity/highlight_title.dart b/lib/widgets/common/identity/highlight_title.dart index 64e263e96..f87769c39 100644 --- a/lib/widgets/common/identity/highlight_title.dart +++ b/lib/widgets/common/identity/highlight_title.dart @@ -3,6 +3,7 @@ import 'dart:ui'; import 'package:aves/model/settings/enums/enums.dart'; import 'package:aves/model/settings/settings.dart'; import 'package:aves/theme/colors.dart'; +import 'package:aves/widgets/common/basic/outlined_text.dart'; import 'package:aves/widgets/common/fx/highlight_decoration.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -11,7 +12,7 @@ class HighlightTitle extends StatelessWidget { final String title; final Color? color; final double fontSize; - final bool enabled, selectable; + final bool enabled; final bool showHighlight; const HighlightTitle({ @@ -20,24 +21,23 @@ class HighlightTitle extends StatelessWidget { this.color, this.fontSize = 18, this.enabled = true, - this.selectable = false, this.showHighlight = true, }); static const disabledColor = Colors.grey; - static const shadows = [ - Shadow( - color: Colors.black, - offset: Offset(1, 1), - blurRadius: 2, - ) - ]; + static List shadows(BuildContext context) => [ + Shadow( + color: Theme.of(context).brightness == Brightness.dark ? Colors.black : Colors.white, + offset: const Offset(0, 1), + blurRadius: 2, + ) + ]; @override Widget build(BuildContext context) { final style = TextStyle( - shadows: Theme.of(context).brightness == Brightness.dark ? shadows : null, + shadows: shadows(context), fontSize: fontSize, letterSpacing: 1.0, fontFeatures: const [FontFeature.enable('smcp')], @@ -47,25 +47,25 @@ class HighlightTitle extends StatelessWidget { return Align( alignment: AlignmentDirectional.centerStart, child: Container( + padding: const EdgeInsets.symmetric(horizontal: 2), decoration: showHighlight && context.select((v) => v.themeColorMode == AvesThemeColorMode.polychrome) ? HighlightDecoration( color: enabled ? color ?? colors.fromString(title) : disabledColor, ) : null, margin: const EdgeInsets.symmetric(vertical: 4.0), - child: selectable - ? SelectableText( - title, - style: style, - maxLines: 1, - ) - : Text( - title, - style: style, - softWrap: false, - overflow: TextOverflow.fade, - maxLines: 1, - ), + child: OutlinedText( + textSpans: [ + TextSpan( + text: title, + style: style, + ), + ], + outlineColor: Theme.of(context).scaffoldBackgroundColor, + softWrap: false, + overflow: TextOverflow.fade, + maxLines: 1, + ), ), ); } diff --git a/lib/widgets/dialogs/entry_editors/remove_metadata_dialog.dart b/lib/widgets/dialogs/entry_editors/remove_metadata_dialog.dart index 027d69406..e694c8c6a 100644 --- a/lib/widgets/dialogs/entry_editors/remove_metadata_dialog.dart +++ b/lib/widgets/dialogs/entry_editors/remove_metadata_dialog.dart @@ -5,6 +5,7 @@ import 'package:aves/model/settings/settings.dart'; import 'package:aves/ref/brand_colors.dart'; import 'package:aves/theme/colors.dart'; import 'package:aves/theme/durations.dart'; +import 'package:aves/widgets/common/basic/outlined_text.dart'; import 'package:aves/widgets/common/extensions/build_context.dart'; import 'package:aves/widgets/common/fx/highlight_decoration.dart'; import 'package:aves/widgets/common/identity/highlight_title.dart'; @@ -100,15 +101,21 @@ class _RemoveEntryMetadataDialogState extends State { Widget _toTile(MetadataType type) { final text = type.getText(); - Widget child = Text( - text, - style: TextStyle( - shadows: Theme.of(context).brightness == Brightness.dark ? HighlightTitle.shadows : null, - ), + Widget child = OutlinedText( + textSpans: [ + TextSpan( + text: text, + style: TextStyle( + shadows: HighlightTitle.shadows(context), + ), + ), + ], + outlineColor: Theme.of(context).scaffoldBackgroundColor, ); if (context.select((v) => v.themeColorMode == AvesThemeColorMode.polychrome)) { final colors = context.watch(); - child = DecoratedBox( + child = Container( + padding: const EdgeInsets.symmetric(horizontal: 2), decoration: HighlightDecoration( color: colors.fromBrandColor(BrandColors.get(text)) ?? colors.fromString(text), ), diff --git a/lib/widgets/viewer/info/metadata/xmp_card.dart b/lib/widgets/viewer/info/metadata/xmp_card.dart index 5afd950b0..c4d00128c 100644 --- a/lib/widgets/viewer/info/metadata/xmp_card.dart +++ b/lib/widgets/viewer/info/metadata/xmp_card.dart @@ -92,7 +92,6 @@ class _XmpCardState extends State { Expanded( child: HighlightTitle( title: widget.title, - selectable: true, showHighlight: false, ), ), diff --git a/lib/widgets/viewer/info/metadata/xmp_namespaces.dart b/lib/widgets/viewer/info/metadata/xmp_namespaces.dart index 937bfda3f..14075d416 100644 --- a/lib/widgets/viewer/info/metadata/xmp_namespaces.dart +++ b/lib/widgets/viewer/info/metadata/xmp_namespaces.dart @@ -116,7 +116,6 @@ class XmpNamespace extends Equatable { child: HighlightTitle( title: displayTitle, color: context.select((v) => v.fromBrandColor(BrandColors.get(displayTitle))), - selectable: true, ), ), ...content