SliverAppBar in ChatDetails

This commit is contained in:
Christian Pauly 2020-02-16 10:48:20 +01:00
parent 6bff85a858
commit 4ed9316552
1 changed files with 266 additions and 251 deletions

View File

@ -158,8 +158,13 @@ class _ChatDetailsState extends State<ChatDetails> {
activeChat: widget.room.id, activeChat: widget.room.id,
), ),
secondScaffold: Scaffold( secondScaffold: Scaffold(
appBar: AppBar( body: NestedScrollView(
title: Text(widget.room.getLocalizedDisplayname(context)), headerSliverBuilder:
(BuildContext context, bool innerBoxIsScrolled) => <Widget>[
SliverAppBar(
expandedHeight: 300.0,
floating: true,
pinned: true,
actions: <Widget>[ actions: <Widget>[
if (widget.room.canonicalAlias?.isNotEmpty ?? false) if (widget.room.canonicalAlias?.isNotEmpty ?? false)
IconButton( IconButton(
@ -174,19 +179,23 @@ class _ChatDetailsState extends State<ChatDetails> {
), ),
ChatSettingsPopupMenu(widget.room, false) ChatSettingsPopupMenu(widget.room, false)
], ],
title: Text(widget.room.getLocalizedDisplayname(context),
style: TextStyle(color: Colors.black)),
backgroundColor: Theme.of(context).appBarTheme.color,
flexibleSpace: FlexibleSpaceBar(
background: ContentBanner(widget.room.avatar,
onEdit: widget.room.canSendEvent("m.room.avatar") && !kIsWeb
? () => setAvatarAction(context)
: null),
), ),
),
],
body: ListView.builder( body: ListView.builder(
itemCount: members.length + 1 + (canRequestMoreMembers ? 1 : 0), itemCount: members.length + 1 + (canRequestMoreMembers ? 1 : 0),
itemBuilder: (BuildContext context, int i) => i == 0 itemBuilder: (BuildContext context, int i) => i == 0
? Column( ? Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[ children: <Widget>[
ContentBanner(widget.room.avatar,
onEdit:
widget.room.canSendEvent("m.room.avatar") && !kIsWeb
? () => setAvatarAction(context)
: null),
Divider(height: 1),
topicEditMode topicEditMode
? ListTile( ? ListTile(
title: TextField( title: TextField(
@ -215,7 +224,8 @@ class _ChatDetailsState extends State<ChatDetails> {
child: Icon(Icons.edit), child: Icon(Icons.edit),
) )
: null, : null,
title: Text("${I18n.of(context).groupDescription}:", title: Text(
"${I18n.of(context).groupDescription}:",
style: TextStyle( style: TextStyle(
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
fontWeight: FontWeight.bold)), fontWeight: FontWeight.bold)),
@ -252,10 +262,12 @@ class _ChatDetailsState extends State<ChatDetails> {
), ),
title: TextField( title: TextField(
textInputAction: TextInputAction.done, textInputAction: TextInputAction.done,
onSubmitted: (s) => setDisplaynameAction(context, s), onSubmitted: (s) =>
setDisplaynameAction(context, s),
decoration: InputDecoration( decoration: InputDecoration(
border: InputBorder.none, border: InputBorder.none,
labelText: I18n.of(context).changeTheNameOfTheGroup, labelText:
I18n.of(context).changeTheNameOfTheGroup,
labelStyle: TextStyle(color: Colors.black), labelStyle: TextStyle(color: Colors.black),
hintText: hintText:
widget.room.getLocalizedDisplayname(context), widget.room.getLocalizedDisplayname(context),
@ -292,8 +304,8 @@ class _ChatDetailsState extends State<ChatDetails> {
backgroundColor: Colors.white, backgroundColor: Colors.white,
foregroundColor: Colors.grey, foregroundColor: Colors.grey,
child: Icon(Icons.public)), child: Icon(Icons.public)),
title: title: Text(
Text(I18n.of(context).whoIsAllowedToJoinThisGroup), I18n.of(context).whoIsAllowedToJoinThisGroup),
subtitle: Text( subtitle: Text(
widget.room.joinRules.getLocalizedString(context), widget.room.joinRules.getLocalizedString(context),
), ),
@ -372,9 +384,11 @@ class _ChatDetailsState extends State<ChatDetails> {
foregroundColor: Colors.grey, foregroundColor: Colors.grey,
child: Icon(Icons.info_outline), child: Icon(Icons.info_outline),
), ),
title: Text(I18n.of(context).areGuestsAllowedToJoin), title:
Text(I18n.of(context).areGuestsAllowedToJoin),
subtitle: Text( subtitle: Text(
widget.room.guestAccess.getLocalizedString(context), widget.room.guestAccess
.getLocalizedString(context),
), ),
), ),
onSelected: (GuestAccess guestAccess) => onSelected: (GuestAccess guestAccess) =>
@ -449,6 +463,7 @@ class _ChatDetailsState extends State<ChatDetails> {
), ),
), ),
), ),
),
); );
} }
} }