chore: Follow up new sliverappbar in chatlist

This commit is contained in:
Krille 2023-03-22 08:54:36 +01:00
parent d211dd4aeb
commit ede1e289ce
No known key found for this signature in database

View File

@ -19,10 +19,11 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
return SliverAppBar( return SliverAppBar(
floating: true, floating: true,
pinned: FluffyThemes.isColumnMode(context), pinned:
elevation: 0, FluffyThemes.isColumnMode(context) || selectMode != SelectMode.normal,
scrolledUnderElevation: 0, scrolledUnderElevation: selectMode == SelectMode.normal ? 0 : null,
backgroundColor: Colors.transparent, backgroundColor:
selectMode == SelectMode.normal ? Colors.transparent : null,
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
leading: selectMode == SelectMode.normal leading: selectMode == SelectMode.normal
? null ? null
@ -44,70 +45,61 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
) )
: SizedBox( : SizedBox(
height: 44, height: 44,
child: Material( child: TextField(
elevation: controller: controller.searchController,
Theme.of(context).appBarTheme.scrolledUnderElevation ?? textInputAction: TextInputAction.search,
4, onChanged: controller.onSearchEnter,
shadowColor: Theme.of(context).appBarTheme.shadowColor, decoration: InputDecoration(
borderRadius: BorderRadius.circular(AppConfig.borderRadius), border: UnderlineInputBorder(
child: TextField( borderSide: BorderSide.none,
controller: controller.searchController, borderRadius:
textInputAction: TextInputAction.search, BorderRadius.circular(AppConfig.borderRadius),
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),
),
), ),
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),
),
), ),
), ),
), ),