From 6c274f05f3aa10e6c44c0ec2709448585e613b65 Mon Sep 17 00:00:00 2001 From: violet-dev Date: Sat, 14 Oct 2023 15:45:52 +0900 Subject: [PATCH] search: Add msg search button on search_page --- lib/pages/search/search_page.dart | 74 ++++++++++++++++++++++++------- 1 file changed, 58 insertions(+), 16 deletions(-) diff --git a/lib/pages/search/search_page.dart b/lib/pages/search/search_page.dart index b3b8f321b..832794442 100644 --- a/lib/pages/search/search_page.dart +++ b/lib/pages/search/search_page.dart @@ -24,6 +24,7 @@ import 'package:violet/locale/locale.dart' as trans; import 'package:violet/log/log.dart'; import 'package:violet/model/article_list_item.dart'; import 'package:violet/other/dialogs.dart'; +import 'package:violet/pages/main/info/lab/search_message.dart'; import 'package:violet/pages/search/search_bar_page.dart'; import 'package:violet/pages/search/search_page_controller.dart'; import 'package:violet/pages/search/search_page_modify.dart'; @@ -163,6 +164,7 @@ class _SearchPageState extends ThemeSwitchableState searchBar: Stack( children: [ searchBar(), + msgsearch(), align(), ], ), @@ -361,26 +363,23 @@ class _SearchPageState extends ThemeSwitchableState ); return Container( - padding: const EdgeInsets.fromLTRB(8, 8, 72, 0), + padding: const EdgeInsets.fromLTRB(8, 8, 72 * 2, 0), child: SizedBox( height: 64, - child: Hero( - tag: 'searchbar${ModalBottomSheetContext.getCount()}', - child: Card( - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.all( - Radius.circular(4.0), - ), - ), - elevation: !Settings.themeFlat ? 100 : 0, - clipBehavior: Clip.antiAliasWithSaveLayer, - child: Stack( - children: [ - searchBar, - searchBarOverlay, - ], + child: Card( + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.all( + Radius.circular(4.0), ), ), + elevation: !Settings.themeFlat ? 100 : 0, + clipBehavior: Clip.antiAliasWithSaveLayer, + child: Stack( + children: [ + searchBar, + searchBarOverlay, + ], + ), ), ), ); @@ -423,6 +422,49 @@ class _SearchPageState extends ThemeSwitchableState } } + msgsearch() { + final width = MediaQuery.of(context).size.width; + + final msgsearchOverlay = InkWell( + onTap: () { + PlatformNavigator.navigateSlide(context, const LabSearchMessage()); + }, + child: const SizedBox( + height: 64, + width: 64, + child: Stack( + alignment: Alignment.center, + children: [ + Icon( + MdiIcons.commentSearch, + color: Colors.grey, + ), + ], + ), + ), + ); + + final msgsearchBody = Card( + color: Palette.themeColor, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(4.0))), + elevation: !Settings.themeFlat ? 100 : 0, + clipBehavior: Clip.antiAliasWithSaveLayer, + child: msgsearchOverlay, + ); + + return Container( + padding: EdgeInsets.fromLTRB(width - 8 - 64 - 8 - 64, 8, 8, 0), + child: SizedBox( + height: 64, + child: Hero( + tag: 'msgsearch${ModalBottomSheetContext.getCount()}', + child: msgsearchBody, + ), + ), + ); + } + align() { final width = MediaQuery.of(context).size.width;