fluffychat/lib/pages/settings/settings_view.dart

94 lines
3.4 KiB
Dart
Raw Normal View History

2021-11-13 21:21:13 +01:00
import 'package:flutter/cupertino.dart';
2020-01-01 19:10:13 +01:00
import 'package:flutter/material.dart';
2021-10-26 18:50:34 +02:00
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-10-26 18:50:34 +02:00
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/utils/platform_infos.dart';
import '../../config/app_config.dart';
2021-10-26 18:50:34 +02:00
import '../../widgets/content_banner.dart';
2021-11-09 21:32:16 +01: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-09-13 17:41:53 +02:00
backgroundColor: Theme.of(context).appBarTheme.backgroundColor,
2021-02-13 11:55:22 +01:00
flexibleSpace: FlexibleSpaceBar(
2021-05-31 19:33:40 +02:00
background: ContentBanner(
controller.profile?.avatarUrl,
onEdit: controller.setAvatarAction,
2021-11-13 21:21:13 +01:00
defaultIcon: CupertinoIcons.person_circle,
2021-05-31 19:33:40 +02:00
),
2020-01-01 19:10:13 +01:00
),
),
2021-02-13 11:55:22 +01:00
],
body: ListView(
children: <Widget>[
ListTile(
title: Text(L10n.of(context).changeTheme),
onTap: () => VRouter.of(context).to('/settings/style'),
2021-11-13 21:21:13 +01:00
leading: const Icon(CupertinoIcons.paintbrush),
),
2021-02-13 11:55:22 +01:00
ListTile(
2021-11-13 21:21:13 +01:00
leading: const Icon(CupertinoIcons.bell),
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-11-13 21:21:13 +01:00
leading: const Icon(CupertinoIcons.device_phone_portrait),
title: Text(L10n.of(context).devices),
onTap: () => VRouter.of(context).to('/settings/devices'),
),
ListTile(
leading: const Icon(CupertinoIcons.chat_bubble_2),
2021-06-23 11:26:12 +02:00
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-11-13 21:21:13 +01:00
leading: const Icon(CupertinoIcons.person),
2021-06-23 11:26:12 +02:00
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-11-13 21:21:13 +01:00
leading: const Icon(CupertinoIcons.shield),
2021-06-23 11:26:12 +02:00
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
),
2021-10-14 18:09:30 +02:00
const Divider(thickness: 1),
2021-02-13 11:55:22 +01:00
ListTile(
2021-11-13 21:21:13 +01:00
leading: const Icon(CupertinoIcons.question_circle),
2021-02-13 11:55:22 +01:00
title: Text(L10n.of(context).help),
onTap: () => launch(AppConfig.supportUrl),
),
ListTile(
2021-11-13 21:21:13 +01:00
leading: const Icon(CupertinoIcons.checkmark_shield),
2021-02-13 11:55:22 +01:00
title: Text(L10n.of(context).privacy),
onTap: () => launch(AppConfig.privacyUrl),
),
ListTile(
2021-11-13 21:21:13 +01:00
leading: const Icon(CupertinoIcons.info_circle),
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
);
}
}