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';
|
|
|
|
import 'package:revanced_manager/constants.dart';
|
2022-08-12 11:42:43 +02:00
|
|
|
import 'package:revanced_manager/theme.dart';
|
2022-09-02 15:35:25 +02:00
|
|
|
import 'package:revanced_manager/ui/views/contributors/contributors_view.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/settingsView/sources_widget.dart';
|
|
|
|
import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart';
|
|
|
|
import 'package:revanced_manager/ui/widgets/shared/open_container_wrapper.dart';
|
2022-08-10 14:30:28 +02:00
|
|
|
import 'package:stacked/stacked.dart';
|
2022-08-11 21:05:03 +02:00
|
|
|
import 'package:stacked_themes/stacked_themes.dart';
|
2022-08-10 14:30:28 +02:00
|
|
|
|
|
|
|
class SettingsView extends StatelessWidget {
|
2022-08-21 17:46:42 +02:00
|
|
|
final TextEditingController organizationController = TextEditingController();
|
|
|
|
final TextEditingController patchesSourceController = TextEditingController();
|
|
|
|
final TextEditingController integrationsSourceController =
|
|
|
|
TextEditingController();
|
|
|
|
|
|
|
|
SettingsView({Key? key}) : super(key: key);
|
2022-08-10 14:30:28 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return ViewModelBuilder<SettingsViewModel>.reactive(
|
|
|
|
viewModelBuilder: () => SettingsViewModel(),
|
|
|
|
builder: (context, SettingsViewModel model, child) => Scaffold(
|
2022-08-24 14:22:36 +02:00
|
|
|
body: CustomScrollView(
|
|
|
|
slivers: <Widget>[
|
2022-09-02 15:35:25 +02:00
|
|
|
CustomSliverAppBar(
|
|
|
|
title: I18nText(
|
|
|
|
'settingsView.widgetTitle',
|
|
|
|
child: Text(
|
|
|
|
'',
|
|
|
|
style: GoogleFonts.inter(
|
|
|
|
color: Theme.of(context).textTheme.headline5!.color,
|
|
|
|
fontWeight: FontWeight.w500,
|
2022-08-20 14:17:00 +02:00
|
|
|
),
|
2022-08-24 14:22:36 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SliverPadding(
|
2022-09-02 15:35:25 +02:00
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
vertical: 10.0,
|
|
|
|
horizontal: 20.0,
|
|
|
|
),
|
2022-08-24 14:22:36 +02:00
|
|
|
sliver: SliverList(
|
|
|
|
delegate: SliverChildListDelegate.fixed(
|
|
|
|
<Widget>[
|
2022-09-02 15:35:25 +02:00
|
|
|
SettingsSection(
|
|
|
|
title: 'settingsView.appearanceSectionTitle',
|
|
|
|
children: <Widget>[
|
|
|
|
CustomSwitchTile(
|
|
|
|
title: I18nText(
|
|
|
|
'settingsView.themeLabel',
|
|
|
|
child: Text(
|
|
|
|
'',
|
|
|
|
style: kSettingItemTextStyle,
|
2022-08-21 17:46:42 +02:00
|
|
|
),
|
2022-08-24 14:22:36 +02:00
|
|
|
),
|
2022-09-02 15:35:25 +02:00
|
|
|
subtitle: I18nText('settingsView.themeHint'),
|
|
|
|
value: isDark,
|
|
|
|
onTap: (value) {
|
|
|
|
isDark = value;
|
|
|
|
getThemeManager(context).toggleDarkLightTheme();
|
|
|
|
},
|
2022-08-21 17:46:42 +02:00
|
|
|
),
|
2022-09-02 15:35:25 +02:00
|
|
|
],
|
2022-08-24 14:22:36 +02:00
|
|
|
),
|
2022-09-02 15:35:25 +02:00
|
|
|
SettingsTileDialog(
|
|
|
|
title: 'settingsView.languageLabel',
|
|
|
|
subtitle: 'English',
|
|
|
|
children: <Widget>[
|
|
|
|
RadioListTile<String>(
|
|
|
|
title: I18nText('settingsView.englishOption'),
|
2022-08-24 14:22:36 +02:00
|
|
|
value: 'en',
|
2022-09-02 15:35:25 +02:00
|
|
|
groupValue: 'en',
|
2022-08-24 14:22:36 +02:00
|
|
|
onChanged: (value) {
|
2022-09-02 15:35:25 +02:00
|
|
|
model.updateLanguage(context, value);
|
|
|
|
Navigator.of(context).pop();
|
2022-08-24 14:22:36 +02:00
|
|
|
},
|
|
|
|
),
|
2022-09-02 15:35:25 +02:00
|
|
|
RadioListTile<String>(
|
|
|
|
title: I18nText('settingsView.frenchOption'),
|
|
|
|
value: 'fr',
|
|
|
|
groupValue: 'en',
|
|
|
|
onChanged: (value) {
|
|
|
|
model.updateLanguage(context, value);
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
},
|
|
|
|
),
|
|
|
|
]),
|
|
|
|
const Divider(thickness: 1.0),
|
|
|
|
SettingsSection(
|
|
|
|
title: 'settingsView.patcherSectionTitle',
|
|
|
|
children: <Widget>[
|
|
|
|
ListTile(
|
|
|
|
contentPadding: EdgeInsets.zero,
|
|
|
|
title: I18nText(
|
|
|
|
'settingsView.rootModeLabel',
|
|
|
|
child: Text(
|
|
|
|
'',
|
|
|
|
style: kSettingItemTextStyle,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
subtitle: I18nText('settingsView.rootModeHint'),
|
|
|
|
onTap: () => model.navigateToRootChecker(),
|
|
|
|
),
|
|
|
|
SourcesWidget(
|
|
|
|
title: 'settingsView.sourcesLabel',
|
|
|
|
organizationController: organizationController,
|
|
|
|
patchesSourceController: patchesSourceController,
|
|
|
|
integrationsSourceController:
|
|
|
|
integrationsSourceController,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
const Divider(thickness: 1.0),
|
|
|
|
SettingsSection(
|
|
|
|
title: 'settingsView.teamSectionTitle',
|
|
|
|
children: <Widget>[
|
|
|
|
OpenContainerWrapper(
|
|
|
|
openBuilder: (_, __) => const ContributorsView(),
|
|
|
|
closedBuilder: (_, openContainer) => ListTile(
|
|
|
|
contentPadding: EdgeInsets.zero,
|
|
|
|
title: I18nText(
|
|
|
|
'settingsView.contributorsLabel',
|
|
|
|
child: Text('', style: kSettingItemTextStyle),
|
|
|
|
),
|
|
|
|
subtitle: I18nText('settingsView.contributorsHint'),
|
|
|
|
onTap: openContainer,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SocialMediaWidget(),
|
|
|
|
],
|
2022-08-24 14:22:36 +02:00
|
|
|
),
|
2022-09-02 15:35:25 +02:00
|
|
|
const Divider(thickness: 1.0),
|
|
|
|
const SettingsSection(
|
|
|
|
title: 'settingsView.infoSectionTitle',
|
|
|
|
children: <Widget>[
|
|
|
|
AboutWidget(),
|
|
|
|
],
|
2022-08-24 14:22:36 +02:00
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
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
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|