2
0
mirror of https://gitlab.com/famedly/fluffychat.git synced 2024-12-20 03:52:35 +01:00
fluffychat/lib/pages/views/settings_view.dart

82 lines
2.8 KiB
Dart
Raw Normal View History

2021-04-09 16:29:48 +02:00
import 'package:fluffychat/config/app_config.dart';
2020-10-04 17:01:54 +02:00
import 'package:fluffychat/utils/platform_infos.dart';
2020-01-01 19:10:13 +01:00
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
2020-01-04 09:40:38 +01:00
import 'package:url_launcher/url_launcher.dart';
2021-05-23 13:11:55 +02:00
import 'package:vrouter/vrouter.dart';
2020-01-01 19:10:13 +01:00
2021-05-22 08:53:52 +02:00
import '../../widgets/content_banner.dart';
import '../../config/app_config.dart';
2021-04-24 08:22:42 +02:00
import '../settings.dart';
2020-01-01 19:10:13 +01:00
2021-05-22 09:13:47 +02:00
class SettingsView extends StatelessWidget {
2021-04-24 08:22:42 +02:00
final SettingsController controller;
2020-06-25 16:29:06 +02:00
2021-05-22 09:13:47 +02:00
const SettingsView(this.controller, {Key key}) : super(key: key);
2021-01-18 08:38:19 +01:00
2020-01-01 19:10:13 +01:00
@override
Widget build(BuildContext context) {
2021-02-13 11:55:22 +01:00
return Scaffold(
body: NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) =>
<Widget>[
SliverAppBar(
expandedHeight: 300.0,
floating: true,
pinned: true,
2021-05-16 11:29:18 +02:00
title: Text(L10n.of(context).settings),
2021-02-13 11:55:22 +01:00
backgroundColor: Theme.of(context).appBarTheme.color,
flexibleSpace: FlexibleSpaceBar(
2021-05-31 19:33:40 +02:00
background: ContentBanner(
controller.profile?.avatarUrl,
onEdit: controller.setAvatarAction,
defaultIcon: Icons.account_circle_outlined,
),
2020-01-01 19:10:13 +01:00
),
),
2021-02-13 11:55:22 +01:00
],
body: ListView(
children: <Widget>[
ListTile(
2021-06-23 11:26:12 +02:00
leading: Icon(Icons.notifications_outlined),
2021-02-13 11:55:22 +01:00
title: Text(L10n.of(context).notifications),
2021-07-08 17:10:20 +02:00
onTap: () => VRouter.of(context).to('/settings/notifications'),
2020-09-21 17:50:01 +02:00
),
2021-02-13 11:55:22 +01:00
ListTile(
2021-06-23 11:26:12 +02:00
leading: Icon(Icons.chat_bubble_outline),
title: Text(L10n.of(context).chat),
2021-07-08 17:10:20 +02:00
onTap: () => VRouter.of(context).to('/settings/chat'),
2021-02-13 11:55:22 +01:00
),
ListTile(
2021-06-23 11:26:12 +02:00
leading: Icon(Icons.account_box_outlined),
title: Text(L10n.of(context).account),
2021-07-08 17:10:20 +02:00
onTap: () => VRouter.of(context).to('/settings/account'),
2021-02-13 11:55:22 +01:00
),
ListTile(
2021-06-23 11:26:12 +02:00
leading: Icon(Icons.security_outlined),
title: Text(L10n.of(context).security),
2021-07-08 17:10:20 +02:00
onTap: () => VRouter.of(context).to('/settings/security'),
2021-02-13 11:55:22 +01:00
),
Divider(thickness: 1),
ListTile(
2021-06-23 11:26:12 +02:00
leading: Icon(Icons.help_outlined),
2021-02-13 11:55:22 +01:00
title: Text(L10n.of(context).help),
onTap: () => launch(AppConfig.supportUrl),
),
ListTile(
2021-06-23 11:26:12 +02:00
leading: Icon(Icons.privacy_tip_outlined),
2021-02-13 11:55:22 +01:00
title: Text(L10n.of(context).privacy),
onTap: () => launch(AppConfig.privacyUrl),
),
ListTile(
2021-06-23 11:26:12 +02:00
leading: Icon(Icons.link_outlined),
2021-02-13 11:55:22 +01:00
title: Text(L10n.of(context).about),
onTap: () => PlatformInfos.showDialog(context),
),
],
2021-02-03 15:47:51 +01:00
),
2021-02-13 11:55:22 +01:00
),
2020-01-01 19:10:13 +01:00
);
}
}