Settings sliverAppBar
This commit is contained in:
parent
617a09c05d
commit
6bff85a858
|
@ -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: !loading
|
child: Opacity(
|
||||||
? mxContent.mxc?.isNotEmpty ?? false
|
opacity: 0.75,
|
||||||
? kIsWeb
|
child: !loading
|
||||||
? Image.network(
|
? mxContent.mxc?.isNotEmpty ?? false
|
||||||
src,
|
? kIsWeb
|
||||||
height: 200,
|
? Image.network(
|
||||||
fit: BoxFit.cover,
|
src,
|
||||||
)
|
height: 300,
|
||||||
: CachedNetworkImage(
|
fit: BoxFit.cover,
|
||||||
imageUrl: src,
|
)
|
||||||
height: 200,
|
: CachedNetworkImage(
|
||||||
fit: BoxFit.cover,
|
imageUrl: src,
|
||||||
)
|
height: 300,
|
||||||
: Icon(defaultIcon, size: 200)
|
fit: BoxFit.cover,
|
||||||
: Icon(defaultIcon, size: 200),
|
)
|
||||||
|
: Icon(defaultIcon, size: 300)
|
||||||
|
: Icon(defaultIcon, size: 300),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
if (this.onEdit != null)
|
if (this.onEdit != null)
|
||||||
Container(
|
Container(
|
||||||
|
|
|
@ -103,95 +103,108 @@ 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,
|
||||||
profile?.avatarUrl ?? MxContent(""),
|
pinned: true,
|
||||||
defaultIcon: Icons.account_circle,
|
backgroundColor: Theme.of(context).appBarTheme.color,
|
||||||
loading: profile == null,
|
flexibleSpace: FlexibleSpaceBar(
|
||||||
onEdit: kIsWeb ? null : () => setAvatarAction(context),
|
title: Text(I18n.of(context).settings,
|
||||||
),
|
style: TextStyle(color: Colors.black)),
|
||||||
ListTile(
|
background: ContentBanner(
|
||||||
title: Text(
|
profile?.avatarUrl ?? MxContent(""),
|
||||||
I18n.of(context).account,
|
height: 300,
|
||||||
style: TextStyle(
|
defaultIcon: Icons.account_circle,
|
||||||
color: Theme.of(context).primaryColor,
|
loading: profile == null,
|
||||||
fontWeight: FontWeight.bold,
|
onEdit: () => setAvatarAction(context),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ListTile(
|
|
||||||
trailing: Icon(Icons.edit),
|
|
||||||
title: Text(I18n.of(context).editDisplayname),
|
|
||||||
subtitle: Text(profile?.displayname ?? client.userID.localpart),
|
|
||||||
onTap: () => setDisplaynameAction(context),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
trailing: Icon(Icons.exit_to_app),
|
|
||||||
title: Text(I18n.of(context).logout),
|
|
||||||
onTap: () => logoutAction(context),
|
|
||||||
),
|
|
||||||
Divider(thickness: 1),
|
|
||||||
ListTile(
|
|
||||||
title: Text(
|
|
||||||
I18n.of(context).about,
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).primaryColor,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
title: Container(
|
|
||||||
alignment: Alignment.centerLeft,
|
|
||||||
child: Image.asset("assets/kofi.png", width: 200),
|
|
||||||
),
|
|
||||||
onTap: () => launch("https://ko-fi.com/V7V315112"),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
leading: Icon(Icons.donut_large),
|
|
||||||
title: Text("Liberapay " + I18n.of(context).donate),
|
|
||||||
onTap: () =>
|
|
||||||
launch("https://liberapay.com/KrilleChritzelius/donate"),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
leading: Icon(Icons.help),
|
|
||||||
title: Text(I18n.of(context).help),
|
|
||||||
onTap: () => launch(
|
|
||||||
"https://gitlab.com/ChristianPauly/fluffychat-flutter/issues"),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
leading: Icon(Icons.account_circle),
|
|
||||||
title: Text(I18n.of(context).accountInformations),
|
|
||||||
onTap: () => Navigator.of(context).push(
|
|
||||||
AppRoute.defaultRoute(
|
|
||||||
context,
|
|
||||||
AppInfoView(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
leading: Icon(Icons.list),
|
|
||||||
title: Text(I18n.of(context).changelog),
|
|
||||||
onTap: () => launch(
|
|
||||||
"https://gitlab.com/ChristianPauly/fluffychat-flutter/blob/master/CHANGELOG.md"),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
leading: Icon(Icons.link),
|
|
||||||
title: Text(I18n.of(context).license),
|
|
||||||
onTap: () => launch(
|
|
||||||
"https://gitlab.com/ChristianPauly/fluffychat-flutter/raw/master/LICENSE"),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
leading: Icon(Icons.code),
|
|
||||||
title: Text(I18n.of(context).sourceCode),
|
|
||||||
onTap: () =>
|
|
||||||
launch("https://gitlab.com/ChristianPauly/fluffychat-flutter"),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
|
body: ListView(
|
||||||
|
children: <Widget>[
|
||||||
|
ListTile(
|
||||||
|
title: Text(
|
||||||
|
I18n.of(context).account,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).primaryColor,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
trailing: Icon(Icons.edit),
|
||||||
|
title: Text(I18n.of(context).editDisplayname),
|
||||||
|
subtitle: Text(profile?.displayname ?? client.userID.localpart),
|
||||||
|
onTap: () => setDisplaynameAction(context),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
trailing: Icon(Icons.exit_to_app),
|
||||||
|
title: Text(I18n.of(context).logout),
|
||||||
|
onTap: () => logoutAction(context),
|
||||||
|
),
|
||||||
|
Divider(thickness: 1),
|
||||||
|
ListTile(
|
||||||
|
title: Text(
|
||||||
|
I18n.of(context).about,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).primaryColor,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
title: Container(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: Image.asset("assets/kofi.png", width: 200),
|
||||||
|
),
|
||||||
|
onTap: () => launch("https://ko-fi.com/V7V315112"),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
leading: Icon(Icons.donut_large),
|
||||||
|
title: Text("Liberapay " + I18n.of(context).donate),
|
||||||
|
onTap: () =>
|
||||||
|
launch("https://liberapay.com/KrilleChritzelius/donate"),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
leading: Icon(Icons.help),
|
||||||
|
title: Text(I18n.of(context).help),
|
||||||
|
onTap: () => launch(
|
||||||
|
"https://gitlab.com/ChristianPauly/fluffychat-flutter/issues"),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
leading: Icon(Icons.account_circle),
|
||||||
|
title: Text(I18n.of(context).accountInformations),
|
||||||
|
onTap: () => Navigator.of(context).push(
|
||||||
|
AppRoute.defaultRoute(
|
||||||
|
context,
|
||||||
|
AppInfoView(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
leading: Icon(Icons.list),
|
||||||
|
title: Text(I18n.of(context).changelog),
|
||||||
|
onTap: () => launch(
|
||||||
|
"https://gitlab.com/ChristianPauly/fluffychat-flutter/blob/master/CHANGELOG.md"),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
leading: Icon(Icons.link),
|
||||||
|
title: Text(I18n.of(context).license),
|
||||||
|
onTap: () => launch(
|
||||||
|
"https://gitlab.com/ChristianPauly/fluffychat-flutter/raw/master/LICENSE"),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
leading: Icon(Icons.code),
|
||||||
|
title: Text(I18n.of(context).sourceCode),
|
||||||
|
onTap: () => launch(
|
||||||
|
"https://gitlab.com/ChristianPauly/fluffychat-flutter"),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue