From 7c6874ed65a65ce26ec8c941432485fab6309a62 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Wed, 13 Jul 2022 08:40:01 +0200 Subject: [PATCH] chore: Follow up chatlist appbar design --- lib/pages/chat_list/chat_list_header.dart | 128 ++++++++++------------ 1 file changed, 57 insertions(+), 71 deletions(-) diff --git a/lib/pages/chat_list/chat_list_header.dart b/lib/pages/chat_list/chat_list_header.dart index 0b1ebaa0..0b2b359f 100644 --- a/lib/pages/chat_list/chat_list_header.dart +++ b/lib/pages/chat_list/chat_list_header.dart @@ -19,7 +19,6 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget { return AppBar( automaticallyImplyLeading: false, - scrolledUnderElevation: selectMode == SelectMode.normal ? 0 : null, leading: selectMode == SelectMode.normal ? null : IconButton( @@ -38,80 +37,67 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget { controller.selectedRoomIds.length.toString(), key: const ValueKey(SelectMode.select), ) - : Material( - color: Theme.of(context).brightness == Brightness.light - ? Colors.white - : Colors.black, - borderRadius: const BorderRadius.only( - topLeft: Radius.circular(AppConfig.borderRadius), - topRight: Radius.circular(AppConfig.borderRadius), - ), - elevation: 4, - shadowColor: - Theme.of(context).colorScheme.onBackground.withAlpha(64), - child: TextField( - controller: controller.searchController, - textInputAction: TextInputAction.search, - onChanged: controller.onSearchEnter, - decoration: InputDecoration( - border: const UnderlineInputBorder( - borderSide: BorderSide.none), - filled: false, - hintText: controller.activeSpacesEntry.getName(context), - prefixIcon: controller.isSearchMode - ? IconButton( - tooltip: L10n.of(context)!.cancel, - icon: const Icon(Icons.close_outlined), - onPressed: controller.cancelSearch, + : TextField( + controller: controller.searchController, + textInputAction: TextInputAction.search, + onChanged: controller.onSearchEnter, + decoration: InputDecoration( + border: const UnderlineInputBorder( + borderSide: BorderSide.none, + ), + hintText: controller.activeSpacesEntry.getName(context), + prefixIcon: controller.isSearchMode + ? IconButton( + tooltip: L10n.of(context)!.cancel, + icon: const Icon(Icons.close_outlined), + onPressed: controller.cancelSearch, + color: Theme.of(context).colorScheme.onBackground, + ) + : IconButton( + onPressed: Scaffold.of(context).openDrawer, + icon: Icon( + Icons.menu, color: Theme.of(context).colorScheme.onBackground, - ) - : IconButton( - onPressed: Scaffold.of(context).openDrawer, - icon: Icon( - Icons.menu, - color: - Theme.of(context).colorScheme.onBackground, - ), ), - suffixIcon: Row( - mainAxisSize: MainAxisSize.min, - children: controller.isSearchMode - ? [ - if (controller.isSearching) - const 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, - ), + ), + suffixIcon: Row( + mainAxisSize: MainAxisSize.min, + children: controller.isSearchMode + ? [ + if (controller.isSearching) + const CircularProgressIndicator.adaptive( + strokeWidth: 2, ), - ] - : [ - IconButton( - icon: Icon( - Icons.camera_alt_outlined, - color: Theme.of(context) - .colorScheme - .onBackground, - ), - tooltip: L10n.of(context)!.addToStory, - onPressed: () => - VRouter.of(context).to('/stories/create'), + TextButton( + onPressed: controller.setServer, + style: TextButton.styleFrom( + textStyle: const TextStyle(fontSize: 12), ), - ClientChooserButton(controller), - const SizedBox(width: 12), - ], - ), + child: Text( + controller.searchServer ?? + Matrix.of(context) + .client + .homeserver! + .host, + maxLines: 2, + ), + ), + ] + : [ + IconButton( + icon: Icon( + Icons.camera_alt_outlined, + color: Theme.of(context) + .colorScheme + .onBackground, + ), + tooltip: L10n.of(context)!.addToStory, + onPressed: () => + VRouter.of(context).to('/stories/create'), + ), + ClientChooserButton(controller), + const SizedBox(width: 12), + ], ), ), ),