chore: Follow up chatlist appbar design

This commit is contained in:
Christian Pauly 2022-07-13 08:40:01 +02:00
parent b50355f33e
commit 7c6874ed65
1 changed files with 57 additions and 71 deletions

View File

@ -19,7 +19,6 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
return AppBar( return AppBar(
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
scrolledUnderElevation: selectMode == SelectMode.normal ? 0 : null,
leading: selectMode == SelectMode.normal leading: selectMode == SelectMode.normal
? null ? null
: IconButton( : IconButton(
@ -38,80 +37,67 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
controller.selectedRoomIds.length.toString(), controller.selectedRoomIds.length.toString(),
key: const ValueKey(SelectMode.select), key: const ValueKey(SelectMode.select),
) )
: Material( : TextField(
color: Theme.of(context).brightness == Brightness.light controller: controller.searchController,
? Colors.white textInputAction: TextInputAction.search,
: Colors.black, onChanged: controller.onSearchEnter,
borderRadius: const BorderRadius.only( decoration: InputDecoration(
topLeft: Radius.circular(AppConfig.borderRadius), border: const UnderlineInputBorder(
topRight: Radius.circular(AppConfig.borderRadius), borderSide: BorderSide.none,
), ),
elevation: 4, hintText: controller.activeSpacesEntry.getName(context),
shadowColor: prefixIcon: controller.isSearchMode
Theme.of(context).colorScheme.onBackground.withAlpha(64), ? IconButton(
child: TextField( tooltip: L10n.of(context)!.cancel,
controller: controller.searchController, icon: const Icon(Icons.close_outlined),
textInputAction: TextInputAction.search, onPressed: controller.cancelSearch,
onChanged: controller.onSearchEnter, color: Theme.of(context).colorScheme.onBackground,
decoration: InputDecoration( )
border: const UnderlineInputBorder( : IconButton(
borderSide: BorderSide.none), onPressed: Scaffold.of(context).openDrawer,
filled: false, icon: Icon(
hintText: controller.activeSpacesEntry.getName(context), Icons.menu,
prefixIcon: controller.isSearchMode
? IconButton(
tooltip: L10n.of(context)!.cancel,
icon: const Icon(Icons.close_outlined),
onPressed: controller.cancelSearch,
color: Theme.of(context).colorScheme.onBackground, 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, suffixIcon: Row(
children: controller.isSearchMode mainAxisSize: MainAxisSize.min,
? [ children: controller.isSearchMode
if (controller.isSearching) ? [
const CircularProgressIndicator.adaptive( if (controller.isSearching)
strokeWidth: 2, 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,
),
), ),
] TextButton(
: [ onPressed: controller.setServer,
IconButton( style: TextButton.styleFrom(
icon: Icon( textStyle: const TextStyle(fontSize: 12),
Icons.camera_alt_outlined,
color: Theme.of(context)
.colorScheme
.onBackground,
),
tooltip: L10n.of(context)!.addToStory,
onPressed: () =>
VRouter.of(context).to('/stories/create'),
), ),
ClientChooserButton(controller), child: Text(
const SizedBox(width: 12), 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),
],
), ),
), ),
), ),