fluffychat/lib/pages/settings/settings_view.dart

97 lines
3.6 KiB
Dart
Raw Normal View History

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
2022-01-29 12:35:03 +01: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,
2022-01-29 12:35:03 +01: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(
2022-01-29 12:35:03 +01:00
mxContent: controller.profile?.avatarUrl,
2021-05-31 19:33:40 +02:00
onEdit: controller.setAvatarAction,
2022-07-08 10:13:44 +02:00
defaultIcon: Icons.account_circle_outlined,
2021-05-31 19:33:40 +02:00
),
2020-01-01 19:10:13 +01:00
),
),
2021-02-13 11:55:22 +01:00
],
2021-11-14 13:24:01 +01:00
body: ListTileTheme(
2022-07-07 18:50:13 +02:00
iconColor: Theme.of(context).colorScheme.onBackground,
2021-11-14 13:24:01 +01:00
child: ListView(
children: <Widget>[
ListTile(
leading: const Icon(Icons.format_paint_outlined),
2022-01-29 12:35:03 +01:00
title: Text(L10n.of(context)!.changeTheme),
2021-11-14 13:24:01 +01:00
onTap: () => VRouter.of(context).to('/settings/style'),
),
const Divider(thickness: 1),
ListTile(
leading: const Icon(Icons.notifications_outlined),
2022-01-29 12:35:03 +01:00
title: Text(L10n.of(context)!.notifications),
2021-11-14 13:24:01 +01:00
onTap: () => VRouter.of(context).to('/settings/notifications'),
),
ListTile(
leading: const Icon(Icons.devices_outlined),
2022-01-29 12:35:03 +01:00
title: Text(L10n.of(context)!.devices),
2021-11-14 13:24:01 +01:00
onTap: () => VRouter.of(context).to('/settings/devices'),
),
ListTile(
leading: const Icon(Icons.chat_bubble_outline_outlined),
2022-01-29 12:35:03 +01:00
title: Text(L10n.of(context)!.chat),
2021-11-14 13:24:01 +01:00
onTap: () => VRouter.of(context).to('/settings/chat'),
),
ListTile(
leading: const Icon(Icons.account_circle_outlined),
2022-01-29 12:35:03 +01:00
title: Text(L10n.of(context)!.account),
2021-11-14 13:24:01 +01:00
onTap: () => VRouter.of(context).to('/settings/account'),
),
ListTile(
leading: const Icon(Icons.shield_outlined),
2022-01-29 12:35:03 +01:00
title: Text(L10n.of(context)!.security),
2021-11-14 13:24:01 +01:00
onTap: () => VRouter.of(context).to('/settings/security'),
),
const Divider(thickness: 1),
ListTile(
leading: const Icon(Icons.help_outline_outlined),
2022-01-29 12:35:03 +01:00
title: Text(L10n.of(context)!.help),
2021-11-14 13:24:01 +01:00
onTap: () => launch(AppConfig.supportUrl),
),
ListTile(
leading: const Icon(Icons.shield_sharp),
2022-01-29 12:35:03 +01:00
title: Text(L10n.of(context)!.privacy),
2021-11-14 13:24:01 +01:00
onTap: () => launch(AppConfig.privacyUrl),
),
ListTile(
leading: const Icon(Icons.info_outline_rounded),
2022-01-29 12:35:03 +01:00
title: Text(L10n.of(context)!.about),
2021-11-14 13:24:01 +01:00
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
);
}
}