From 3df29a2e3005bf5f66f891cc81b2650a3576766d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Ma=C3=B1osa?= Date: Fri, 9 Feb 2024 00:27:42 +0100 Subject: [PATCH] =?UTF-8?q?feat(word=5Fpage):=20=E2=9C=A8=20show=20`AppBar?= =?UTF-8?q?`=20elevation=20when=20scrolled=20underneath?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/src/pages/bookmark_collection_page.dart | 1 + lib/src/pages/collections_page.dart | 5 +- lib/src/pages/home_page.dart | 5 +- lib/src/pages/word_page.dart | 64 ++++++++++++--------- 4 files changed, 46 insertions(+), 29 deletions(-) diff --git a/lib/src/pages/bookmark_collection_page.dart b/lib/src/pages/bookmark_collection_page.dart index afd3fe2..925d713 100644 --- a/lib/src/pages/bookmark_collection_page.dart +++ b/lib/src/pages/bookmark_collection_page.dart @@ -26,6 +26,7 @@ class BookmarkCollectionPage extends StatelessWidget { collection.name, style: const TextStyle( fontVariations: [FontVariation.weight(600)], + overflow: TextOverflow.fade, ), ), backgroundColor: theme.canvasColor, diff --git a/lib/src/pages/collections_page.dart b/lib/src/pages/collections_page.dart index 5a02097..f5a81ea 100644 --- a/lib/src/pages/collections_page.dart +++ b/lib/src/pages/collections_page.dart @@ -23,7 +23,10 @@ class CollectionsPage extends StatelessWidget { appBar: AppBar( title: Text( appLocalizations.myCollections, - style: const TextStyle(fontVariations: [FontVariation.weight(600)]), + style: const TextStyle( + fontVariations: [FontVariation.weight(600)], + overflow: TextOverflow.fade, + ), ), backgroundColor: theme.canvasColor, surfaceTintColor: theme.canvasColor, diff --git a/lib/src/pages/home_page.dart b/lib/src/pages/home_page.dart index b5f0487..b429ccd 100644 --- a/lib/src/pages/home_page.dart +++ b/lib/src/pages/home_page.dart @@ -21,7 +21,10 @@ class HomePage extends StatelessWidget { appBar: AppBar( title: const Text( 'El meu DIEC', - style: TextStyle(fontVariations: [FontVariation.weight(600)]), + style: TextStyle( + fontVariations: [FontVariation.weight(600)], + overflow: TextOverflow.fade, + ), ), backgroundColor: theme.canvasColor, surfaceTintColor: theme.canvasColor, diff --git a/lib/src/pages/word_page.dart b/lib/src/pages/word_page.dart index 4c460af..9482a87 100644 --- a/lib/src/pages/word_page.dart +++ b/lib/src/pages/word_page.dart @@ -15,36 +15,46 @@ class WordPage extends StatelessWidget { Widget build(BuildContext context) { final theme = Theme.of(context); - return Scaffold( - appBar: AppBar( - title: SelectableText( - word.word, - maxLines: 1, - style: theme.textTheme.displaySmall!.copyWith(fontSize: 32), + return ClipRRect( + borderRadius: const BorderRadiusDirectional.only( + topStart: Radius.circular(30), + topEnd: Radius.circular(30), + ), + child: Scaffold( + appBar: AppBar( + scrolledUnderElevation: 6, + elevation: 2, + title: SelectableText( + word.word, + maxLines: 1, + style: theme.textTheme.displaySmall!.copyWith( + fontSize: 32, + // See https://github.com/flutter/flutter/issues/80434 + overflow: TextOverflow.fade, + ), + ), + backgroundColor: Colors.transparent, + leading: IconButton.filledTonal( + onPressed: () => Navigator.of(context).pop(), + icon: const Icon(Icons.close), + ), + centerTitle: true, + actions: [ + BookmarkButton(word: word, isTonalFilled: true), + IconButton.filledTonal( + onPressed: () => Share.shareUri(const DIECRoutes().wordUri(word)), + icon: const Icon(Icons.ios_share_rounded), + ), + const SizedBox(width: 4), + ], + toolbarHeight: 72, ), backgroundColor: Colors.transparent, - surfaceTintColor: Colors.transparent, - shadowColor: Colors.transparent, - leading: IconButton.filledTonal( - onPressed: () => Navigator.of(context).pop(), - icon: const Icon(Icons.close), - ), - centerTitle: true, - actions: [ - BookmarkButton(word: word, isTonalFilled: true), - IconButton.filledTonal( - onPressed: () => Share.shareUri(const DIECRoutes().wordUri(word)), - icon: const Icon(Icons.ios_share_rounded), + body: SingleChildScrollView( + child: Padding( + padding: const EdgeInsetsDirectional.all(20), + child: DefinitionEntrySenses(word: word), ), - const SizedBox(width: 4), - ], - toolbarHeight: 72, - ), - backgroundColor: Colors.transparent, - body: SingleChildScrollView( - child: Padding( - padding: const EdgeInsetsDirectional.all(20), - child: DefinitionEntrySenses(word: word), ), ), );