fluffychat/lib/pages/views/settings_view.dart

83 lines
2.9 KiB
Dart
Raw Normal View History

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