Settings sliverAppBar

This commit is contained in:
Christian Pauly 2020-02-16 10:42:59 +01:00
parent 617a09c05d
commit 6bff85a858
2 changed files with 117 additions and 101 deletions

View File

@ -43,7 +43,7 @@ class ContentBanner extends StatelessWidget {
) )
: null, : null,
child: Container( child: Container(
height: 200, height: 300,
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).secondaryHeaderColor, color: Theme.of(context).secondaryHeaderColor,
@ -55,21 +55,24 @@ class ContentBanner extends StatelessWidget {
right: 0, right: 0,
top: 0, top: 0,
bottom: 0, bottom: 0,
child: Opacity(
opacity: 0.75,
child: !loading child: !loading
? mxContent.mxc?.isNotEmpty ?? false ? mxContent.mxc?.isNotEmpty ?? false
? kIsWeb ? kIsWeb
? Image.network( ? Image.network(
src, src,
height: 200, height: 300,
fit: BoxFit.cover, fit: BoxFit.cover,
) )
: CachedNetworkImage( : CachedNetworkImage(
imageUrl: src, imageUrl: src,
height: 200, height: 300,
fit: BoxFit.cover, fit: BoxFit.cover,
) )
: Icon(defaultIcon, size: 200) : Icon(defaultIcon, size: 300)
: Icon(defaultIcon, size: 200), : Icon(defaultIcon, size: 300),
),
), ),
if (this.onEdit != null) if (this.onEdit != null)
Container( Container(

View File

@ -103,17 +103,29 @@ class _SettingsState extends State<Settings> {
if (mounted) setState(() => profile = p); if (mounted) setState(() => profile = p);
}); });
return Scaffold( return Scaffold(
appBar: AppBar( body: NestedScrollView(
title: Text(I18n.of(context).settings), headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) =>
), <Widget>[
body: ListView( SliverAppBar(
children: <Widget>[ expandedHeight: 300.0,
ContentBanner( floating: true,
pinned: true,
backgroundColor: Theme.of(context).appBarTheme.color,
flexibleSpace: FlexibleSpaceBar(
title: Text(I18n.of(context).settings,
style: TextStyle(color: Colors.black)),
background: ContentBanner(
profile?.avatarUrl ?? MxContent(""), profile?.avatarUrl ?? MxContent(""),
height: 300,
defaultIcon: Icons.account_circle, defaultIcon: Icons.account_circle,
loading: profile == null, loading: profile == null,
onEdit: kIsWeb ? null : () => setAvatarAction(context), onEdit: () => setAvatarAction(context),
), ),
),
),
],
body: ListView(
children: <Widget>[
ListTile( ListTile(
title: Text( title: Text(
I18n.of(context).account, I18n.of(context).account,
@ -188,11 +200,12 @@ class _SettingsState extends State<Settings> {
ListTile( ListTile(
leading: Icon(Icons.code), leading: Icon(Icons.code),
title: Text(I18n.of(context).sourceCode), title: Text(I18n.of(context).sourceCode),
onTap: () => onTap: () => launch(
launch("https://gitlab.com/ChristianPauly/fluffychat-flutter"), "https://gitlab.com/ChristianPauly/fluffychat-flutter"),
), ),
], ],
), ),
),
); );
} }
} }