2022-08-10 14:30:28 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
2022-08-19 15:04:40 +02:00
|
|
|
import 'package:google_fonts/google_fonts.dart';
|
2022-08-10 14:30:28 +02:00
|
|
|
import 'package:revanced_manager/ui/views/settings/settings_viewmodel.dart';
|
2022-09-02 15:35:25 +02:00
|
|
|
import 'package:revanced_manager/ui/widgets/settingsView/about_widget.dart';
|
|
|
|
import 'package:revanced_manager/ui/widgets/settingsView/custom_switch_tile.dart';
|
|
|
|
import 'package:revanced_manager/ui/widgets/settingsView/settings_tile_dialog.dart';
|
|
|
|
import 'package:revanced_manager/ui/widgets/settingsView/settings_section.dart';
|
|
|
|
import 'package:revanced_manager/ui/widgets/settingsView/social_media_widget.dart';
|
|
|
|
import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart';
|
2022-08-10 14:30:28 +02:00
|
|
|
import 'package:stacked/stacked.dart';
|
|
|
|
|
|
|
|
class SettingsView extends StatelessWidget {
|
2022-09-07 03:37:25 +02:00
|
|
|
const SettingsView({Key? key}) : super(key: key);
|
2022-08-10 14:30:28 +02:00
|
|
|
|
2022-09-19 10:39:25 +02:00
|
|
|
static const _settingsDivider =
|
|
|
|
Divider(thickness: 1.0, indent: 20.0, endIndent: 20.0);
|
|
|
|
|
2022-08-10 14:30:28 +02:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return ViewModelBuilder<SettingsViewModel>.reactive(
|
|
|
|
viewModelBuilder: () => SettingsViewModel(),
|
2022-09-12 18:30:44 +02:00
|
|
|
builder: (context, model, child) => Scaffold(
|
2022-08-24 14:22:36 +02:00
|
|
|
body: CustomScrollView(
|
|
|
|
slivers: <Widget>[
|
2022-09-02 15:35:25 +02:00
|
|
|
CustomSliverAppBar(
|
2022-09-19 17:24:31 +02:00
|
|
|
isMainView: true,
|
2022-09-02 15:35:25 +02:00
|
|
|
title: I18nText(
|
|
|
|
'settingsView.widgetTitle',
|
|
|
|
child: Text(
|
|
|
|
'',
|
|
|
|
style: GoogleFonts.inter(
|
2022-09-05 04:32:36 +02:00
|
|
|
color: Theme.of(context).textTheme.headline6!.color,
|
2022-08-20 14:17:00 +02:00
|
|
|
),
|
2022-08-24 14:22:36 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2022-09-19 10:39:25 +02:00
|
|
|
SliverList(
|
|
|
|
delegate: SliverChildListDelegate.fixed(
|
|
|
|
<Widget>[
|
|
|
|
SettingsSection(
|
|
|
|
title: 'settingsView.appearanceSectionTitle',
|
|
|
|
children: <Widget>[
|
|
|
|
CustomSwitchTile(
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
|
|
|
title: I18nText(
|
|
|
|
'settingsView.darkThemeLabel',
|
|
|
|
child: const Text(
|
|
|
|
'',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 20,
|
|
|
|
fontWeight: FontWeight.w500,
|
2022-08-21 17:46:42 +02:00
|
|
|
),
|
2022-08-24 14:22:36 +02:00
|
|
|
),
|
2022-09-05 04:32:36 +02:00
|
|
|
),
|
2022-09-19 10:39:25 +02:00
|
|
|
subtitle: I18nText('settingsView.darkThemeHint'),
|
|
|
|
value: model.getDarkThemeStatus(),
|
|
|
|
onTap: (value) => model.setUseDarkTheme(
|
|
|
|
context,
|
|
|
|
value,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
FutureBuilder<int>(
|
|
|
|
future: model.getSdkVersion(),
|
|
|
|
builder: (context, snapshot) => Visibility(
|
|
|
|
visible: snapshot.hasData &&
|
|
|
|
snapshot.data! >= ANDROID_12_SDK_VERSION,
|
|
|
|
child: CustomSwitchTile(
|
|
|
|
padding:
|
|
|
|
const EdgeInsets.symmetric(horizontal: 20.0),
|
|
|
|
title: I18nText(
|
|
|
|
'settingsView.dynamicThemeLabel',
|
|
|
|
child: const Text(
|
|
|
|
'',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 20,
|
|
|
|
fontWeight: FontWeight.w500,
|
2022-09-08 13:09:12 +02:00
|
|
|
),
|
|
|
|
),
|
2022-09-19 10:39:25 +02:00
|
|
|
),
|
|
|
|
subtitle: I18nText('settingsView.dynamicThemeHint'),
|
|
|
|
value: model.getDynamicThemeStatus(),
|
|
|
|
onTap: (value) => model.setUseDynamicTheme(
|
|
|
|
context,
|
|
|
|
value,
|
2022-09-05 04:32:36 +02:00
|
|
|
),
|
|
|
|
),
|
2022-08-21 17:46:42 +02:00
|
|
|
),
|
2022-09-19 10:39:25 +02:00
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
SettingsTileDialog(
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
|
|
|
title: 'settingsView.languageLabel',
|
|
|
|
subtitle: 'English',
|
|
|
|
onTap: () => model.showLanguagesDialog(context),
|
|
|
|
),
|
2022-09-19 10:56:51 +02:00
|
|
|
_settingsDivider,
|
2022-09-19 10:39:25 +02:00
|
|
|
SettingsSection(
|
|
|
|
title: 'settingsView.teamSectionTitle',
|
|
|
|
children: <Widget>[
|
|
|
|
ListTile(
|
|
|
|
contentPadding:
|
|
|
|
const EdgeInsets.symmetric(horizontal: 20.0),
|
|
|
|
title: I18nText(
|
|
|
|
'settingsView.contributorsLabel',
|
|
|
|
child: const Text(
|
|
|
|
'',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 20,
|
|
|
|
fontWeight: FontWeight.w500,
|
2022-09-02 15:35:25 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2022-09-19 10:39:25 +02:00
|
|
|
subtitle: I18nText('settingsView.contributorsHint'),
|
|
|
|
onTap: () => model.navigateToContributors(),
|
|
|
|
),
|
|
|
|
const SocialMediaWidget(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 20.0),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
_settingsDivider,
|
2022-09-20 00:31:21 +02:00
|
|
|
SettingsSection(
|
|
|
|
title: 'settingsView.advancedSectionTitle',
|
|
|
|
children: <Widget>[
|
|
|
|
SettingsTileDialog(
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
|
|
|
title: 'settingsView.apiURLLabel',
|
|
|
|
subtitle: 'settingsView.apiURLHint',
|
|
|
|
onTap: () => model.showApiUrlDialog(context),
|
|
|
|
),
|
|
|
|
SettingsTileDialog(
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
|
|
|
title: 'settingsView.sourcesLabel',
|
|
|
|
subtitle: 'settingsView.sourcesLabelHint',
|
|
|
|
onTap: () => model.showSourcesDialog(context),
|
|
|
|
),
|
2022-11-01 10:56:15 +01:00
|
|
|
CustomSwitchTile(
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
|
|
|
title: I18nText(
|
|
|
|
'settingsView.experimentalPatchesLabel',
|
|
|
|
child: const Text(
|
|
|
|
'',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 20,
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
subtitle:
|
|
|
|
I18nText('settingsView.experimentalPatchesHint'),
|
|
|
|
value: model.areExperimentalPatchesEnabled(),
|
|
|
|
onTap: (value) =>
|
|
|
|
model.useExperimentalPatches(value)),
|
2022-10-16 20:52:07 +02:00
|
|
|
ListTile(
|
|
|
|
contentPadding:
|
|
|
|
const EdgeInsets.symmetric(horizontal: 20.0),
|
|
|
|
title: I18nText(
|
|
|
|
'settingsView.deleteKeystoreLabel',
|
|
|
|
child: const Text(
|
|
|
|
'',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 20,
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
subtitle: I18nText('settingsView.deleteKeystoreHint'),
|
|
|
|
onTap: () => model.deleteKeystore,
|
|
|
|
),
|
2022-10-16 21:11:20 +02:00
|
|
|
ListTile(
|
|
|
|
contentPadding:
|
|
|
|
const EdgeInsets.symmetric(horizontal: 20.0),
|
|
|
|
title: I18nText(
|
|
|
|
'settingsView.deleteTempDirLabel',
|
|
|
|
child: const Text(
|
|
|
|
'',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 20,
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
subtitle: I18nText('settingsView.deleteTempDirHint'),
|
|
|
|
onTap: () => model.deleteTempDir(),
|
|
|
|
),
|
2022-10-16 22:28:50 +02:00
|
|
|
ListTile(
|
|
|
|
contentPadding:
|
|
|
|
const EdgeInsets.symmetric(horizontal: 20.0),
|
|
|
|
title: I18nText(
|
|
|
|
'settingsView.deleteLogsLabel',
|
|
|
|
child: const Text(
|
|
|
|
'',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 20,
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
subtitle: I18nText('settingsView.deleteLogsHint'),
|
|
|
|
onTap: () => model.deleteLogs(),
|
|
|
|
),
|
2022-09-20 00:31:21 +02:00
|
|
|
],
|
|
|
|
),
|
|
|
|
_settingsDivider,
|
2022-10-19 15:23:13 +02:00
|
|
|
// SettingsSection(
|
|
|
|
// title: 'settingsView.logsSectionTitle',
|
|
|
|
// children: <Widget>[
|
|
|
|
// CustomSwitchTile(
|
|
|
|
// padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
|
|
|
// title: I18nText(
|
|
|
|
// 'settingsView.sentryLabel',
|
|
|
|
// child: const Text(
|
|
|
|
// '',
|
|
|
|
// style: TextStyle(
|
|
|
|
// fontSize: 20,
|
|
|
|
// fontWeight: FontWeight.w500,
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// subtitle: I18nText('settingsView.sentryHint'),
|
|
|
|
// value: model.isSentryEnabled(),
|
|
|
|
// onTap: (value) => model.useSentry(value),
|
|
|
|
// ),
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// _settingsDivider,
|
2022-09-19 10:39:25 +02:00
|
|
|
SettingsSection(
|
|
|
|
title: 'settingsView.infoSectionTitle',
|
|
|
|
children: <Widget>[
|
|
|
|
ListTile(
|
|
|
|
contentPadding:
|
|
|
|
const EdgeInsets.symmetric(horizontal: 20.0),
|
|
|
|
title: I18nText(
|
|
|
|
'settingsView.logsLabel',
|
|
|
|
child: const Text(
|
|
|
|
'',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 20,
|
|
|
|
fontWeight: FontWeight.w500,
|
2022-09-13 18:46:22 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2022-09-19 10:39:25 +02:00
|
|
|
subtitle: I18nText('settingsView.logsHint'),
|
|
|
|
onTap: () => model.exportLogcatLogs(),
|
|
|
|
),
|
|
|
|
const AboutWidget(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 20.0),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
2022-08-21 17:46:42 +02:00
|
|
|
),
|
2022-08-10 14:30:28 +02:00
|
|
|
),
|
2022-08-24 14:22:36 +02:00
|
|
|
],
|
2022-08-10 14:30:28 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|