From ede1e289ce1a5be945b332153fd876d36b61fff0 Mon Sep 17 00:00:00 2001 From: Krille Date: Wed, 22 Mar 2023 08:54:36 +0100 Subject: [PATCH] chore: Follow up new sliverappbar in chatlist --- lib/pages/chat_list/chat_list_header.dart | 126 ++++++++++------------ 1 file changed, 59 insertions(+), 67 deletions(-) diff --git a/lib/pages/chat_list/chat_list_header.dart b/lib/pages/chat_list/chat_list_header.dart index 1439736d..774f7c3c 100644 --- a/lib/pages/chat_list/chat_list_header.dart +++ b/lib/pages/chat_list/chat_list_header.dart @@ -19,10 +19,11 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget { return SliverAppBar( floating: true, - pinned: FluffyThemes.isColumnMode(context), - elevation: 0, - scrolledUnderElevation: 0, - backgroundColor: Colors.transparent, + pinned: + FluffyThemes.isColumnMode(context) || selectMode != SelectMode.normal, + scrolledUnderElevation: selectMode == SelectMode.normal ? 0 : null, + backgroundColor: + selectMode == SelectMode.normal ? Colors.transparent : null, automaticallyImplyLeading: false, leading: selectMode == SelectMode.normal ? null @@ -44,70 +45,61 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget { ) : SizedBox( height: 44, - child: Material( - elevation: - Theme.of(context).appBarTheme.scrolledUnderElevation ?? - 4, - shadowColor: Theme.of(context).appBarTheme.shadowColor, - borderRadius: BorderRadius.circular(AppConfig.borderRadius), - child: TextField( - controller: controller.searchController, - textInputAction: TextInputAction.search, - onChanged: controller.onSearchEnter, - decoration: InputDecoration( - border: UnderlineInputBorder( - borderSide: BorderSide.none, - borderRadius: - BorderRadius.circular(AppConfig.borderRadius), - ), - hintText: L10n.of(context)!.search, - floatingLabelBehavior: FloatingLabelBehavior.never, - prefixIcon: controller.isSearchMode - ? IconButton( - tooltip: L10n.of(context)!.cancel, - icon: const Icon(Icons.close_outlined), - onPressed: controller.cancelSearch, - color: - Theme.of(context).colorScheme.onBackground, - ) - : Icon( - Icons.search_outlined, - color: - Theme.of(context).colorScheme.onBackground, - ), - suffixIcon: controller.isSearchMode - ? controller.isSearching - ? const Padding( - padding: EdgeInsets.symmetric( - vertical: 10.0, - horizontal: 12, - ), - child: SizedBox.square( - dimension: 24, - child: CircularProgressIndicator.adaptive( - strokeWidth: 2, - ), - ), - ) - : TextButton( - onPressed: controller.setServer, - style: TextButton.styleFrom( - textStyle: const TextStyle(fontSize: 12), - ), - child: Text( - controller.searchServer ?? - Matrix.of(context) - .client - .homeserver! - .host, - maxLines: 2, - ), - ) - : SizedBox( - width: 0, - child: ClientChooserButton(controller), - ), + child: TextField( + controller: controller.searchController, + textInputAction: TextInputAction.search, + onChanged: controller.onSearchEnter, + decoration: InputDecoration( + border: UnderlineInputBorder( + borderSide: BorderSide.none, + borderRadius: + BorderRadius.circular(AppConfig.borderRadius), ), + hintText: L10n.of(context)!.search, + floatingLabelBehavior: FloatingLabelBehavior.never, + prefixIcon: controller.isSearchMode + ? IconButton( + tooltip: L10n.of(context)!.cancel, + icon: const Icon(Icons.close_outlined), + onPressed: controller.cancelSearch, + color: Theme.of(context).colorScheme.onBackground, + ) + : Icon( + Icons.search_outlined, + color: Theme.of(context).colorScheme.onBackground, + ), + suffixIcon: controller.isSearchMode + ? controller.isSearching + ? const Padding( + padding: EdgeInsets.symmetric( + vertical: 10.0, + horizontal: 12, + ), + child: SizedBox.square( + dimension: 24, + child: CircularProgressIndicator.adaptive( + strokeWidth: 2, + ), + ), + ) + : TextButton( + onPressed: controller.setServer, + style: TextButton.styleFrom( + textStyle: const TextStyle(fontSize: 12), + ), + child: Text( + controller.searchServer ?? + Matrix.of(context) + .client + .homeserver! + .host, + maxLines: 2, + ), + ) + : SizedBox( + width: 0, + child: ClientChooserButton(controller), + ), ), ), ),