From 2a7dba6f7f8213472077a3d0e96fba5d0209d33f Mon Sep 17 00:00:00 2001 From: ggurdin <46800240+ggurdin@users.noreply.github.com> Date: Wed, 2 Apr 2025 16:33:33 -0400 Subject: [PATCH] chore: wrap construct notification in safe area (#2328) --- .../chat/utils/unlocked_morphs_snackbar.dart | 136 +++++++++--------- .../word_zoom/lemma_meaning_widget.dart | 93 ++++++------ 2 files changed, 117 insertions(+), 112 deletions(-) diff --git a/lib/pangea/chat/utils/unlocked_morphs_snackbar.dart b/lib/pangea/chat/utils/unlocked_morphs_snackbar.dart index aeb72d548..0d0e3bc96 100644 --- a/lib/pangea/chat/utils/unlocked_morphs_snackbar.dart +++ b/lib/pangea/chat/utils/unlocked_morphs_snackbar.dart @@ -128,81 +128,83 @@ class ConstructNotificationOverlayState @override Widget build(BuildContext context) { - return Material( - type: MaterialType.transparency, - child: SizeTransition( - sizeFactor: _animation!, - axisAlignment: -1.0, - child: Container( - padding: const EdgeInsets.symmetric(vertical: 16.0), - decoration: BoxDecoration( - color: Theme.of(context).colorScheme.surface, - border: Border( - bottom: BorderSide( - color: Theme.of(context).colorScheme.onSurface.withAlpha(50), + return SafeArea( + child: Material( + type: MaterialType.transparency, + child: SizeTransition( + sizeFactor: _animation!, + axisAlignment: -1.0, + child: Container( + padding: const EdgeInsets.symmetric(vertical: 16.0), + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.surface, + border: Border( + bottom: BorderSide( + color: Theme.of(context).colorScheme.onSurface.withAlpha(50), + ), ), ), - ), - child: Row( - children: [ - const SizedBox( - width: 50.0, - height: 50.0, - ), - Expanded( - child: Wrap( - spacing: 16.0, - alignment: WrapAlignment.center, - crossAxisAlignment: WrapCrossAlignment.center, - children: [ - Text( - L10n.of(context).youUnlocked, - style: TextStyle( - fontSize: - FluffyThemes.isColumnMode(context) ? 32.0 : 16.0, - color: Theme.of(context).colorScheme.onSurface, - fontWeight: FontWeight.bold, + child: Row( + children: [ + const SizedBox( + width: 50.0, + height: 50.0, + ), + Expanded( + child: Wrap( + spacing: 16.0, + alignment: WrapAlignment.center, + crossAxisAlignment: WrapCrossAlignment.center, + children: [ + Text( + L10n.of(context).youUnlocked, + style: TextStyle( + fontSize: + FluffyThemes.isColumnMode(context) ? 32.0 : 16.0, + color: Theme.of(context).colorScheme.onSurface, + fontWeight: FontWeight.bold, + ), ), - ), - Row( - mainAxisSize: MainAxisSize.min, - spacing: 16.0, - children: [ - Flexible( - child: Text( - widget.copy ?? widget.construct.lemma, - style: TextStyle( - fontSize: FluffyThemes.isColumnMode(context) - ? 32.0 - : 16.0, - color: AppConfig.gold, - fontWeight: FontWeight.bold, + Row( + mainAxisSize: MainAxisSize.min, + spacing: 16.0, + children: [ + Flexible( + child: Text( + widget.copy ?? widget.construct.lemma, + style: TextStyle( + fontSize: FluffyThemes.isColumnMode(context) + ? 32.0 + : 16.0, + color: AppConfig.gold, + fontWeight: FontWeight.bold, + ), + overflow: TextOverflow.ellipsis, ), - overflow: TextOverflow.ellipsis, ), - ), - MorphIcon( - morphFeature: MorphFeaturesEnumExtension.fromString( - widget.construct.category, + MorphIcon( + morphFeature: MorphFeaturesEnumExtension.fromString( + widget.construct.category, + ), + morphTag: widget.construct.lemma, ), - morphTag: widget.construct.lemma, - ), - ], - ), - ], - ), - ), - Container( - alignment: Alignment.center, - width: 50.0, - child: IconButton( - icon: const Icon( - Icons.close, + ], + ), + ], ), - onPressed: _close, ), - ), - ], + Container( + alignment: Alignment.center, + width: 50.0, + child: IconButton( + icon: const Icon( + Icons.close, + ), + onPressed: _close, + ), + ), + ], + ), ), ), ), diff --git a/lib/pangea/toolbar/widgets/word_zoom/lemma_meaning_widget.dart b/lib/pangea/toolbar/widgets/word_zoom/lemma_meaning_widget.dart index 417dd9c95..92b489121 100644 --- a/lib/pangea/toolbar/widgets/word_zoom/lemma_meaning_widget.dart +++ b/lib/pangea/toolbar/widgets/word_zoom/lemma_meaning_widget.dart @@ -153,57 +153,60 @@ class LemmaMeaningWidgetState extends State { if (_editMode) { _controller.text = _lemmaInfo?.meaning ?? ""; - return Column( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - "${L10n.of(context).pangeaBotIsFallible} ${L10n.of(context).whatIsMeaning(_lemma, widget.constructUse.category)}", - textAlign: TextAlign.center, - style: const TextStyle(fontStyle: FontStyle.italic), - ), - const SizedBox(height: 10), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0), - child: TextField( - minLines: 1, - maxLines: 3, - controller: _controller, - decoration: InputDecoration( - hintText: _lemmaInfo?.meaning, + return Material( + type: MaterialType.transparency, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + "${L10n.of(context).pangeaBotIsFallible} ${L10n.of(context).whatIsMeaning(_lemma, widget.constructUse.category)}", + textAlign: TextAlign.center, + style: const TextStyle(fontStyle: FontStyle.italic), + ), + const SizedBox(height: 10), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0), + child: TextField( + minLines: 1, + maxLines: 3, + controller: _controller, + decoration: InputDecoration( + hintText: _lemmaInfo?.meaning, + ), ), ), - ), - const SizedBox(height: 10), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - ElevatedButton( - onPressed: () => _toggleEditMode(false), - style: ElevatedButton.styleFrom( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), + const SizedBox(height: 10), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ElevatedButton( + onPressed: () => _toggleEditMode(false), + style: ElevatedButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + padding: const EdgeInsets.symmetric(horizontal: 10), ), - padding: const EdgeInsets.symmetric(horizontal: 10), + child: Text(L10n.of(context).cancel), ), - child: Text(L10n.of(context).cancel), - ), - const SizedBox(width: 10), - ElevatedButton( - onPressed: () => _controller.text != _lemmaInfo?.meaning && - _controller.text.isNotEmpty - ? editLemmaMeaning(_controller.text) - : null, - style: ElevatedButton.styleFrom( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), + const SizedBox(width: 10), + ElevatedButton( + onPressed: () => _controller.text != _lemmaInfo?.meaning && + _controller.text.isNotEmpty + ? editLemmaMeaning(_controller.text) + : null, + style: ElevatedButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + padding: const EdgeInsets.symmetric(horizontal: 10), ), - padding: const EdgeInsets.symmetric(horizontal: 10), + child: Text(L10n.of(context).saveChanges), ), - child: Text(L10n.of(context).saveChanges), - ), - ], - ), - ], + ], + ), + ], + ), ); }