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-08-10 14:30:28 +02:00
|
|
|
import 'package:revanced_manager/ui/views/settings/settings_viewmodel.dart';
|
2022-08-19 15:04:40 +02:00
|
|
|
import 'package:revanced_manager/ui/widgets/about_info_widget.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 {
|
|
|
|
const SettingsView({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return ViewModelBuilder<SettingsViewModel>.reactive(
|
2022-08-20 14:17:00 +02:00
|
|
|
disposeViewModel: false,
|
2022-08-10 14:30:28 +02:00
|
|
|
viewModelBuilder: () => SettingsViewModel(),
|
2022-08-20 14:17:00 +02:00
|
|
|
onModelReady: (model) => model.initialize(),
|
2022-08-10 14:30:28 +02:00
|
|
|
builder: (context, SettingsViewModel model, child) => Scaffold(
|
|
|
|
body: SafeArea(
|
|
|
|
child: Padding(
|
2022-08-19 15:04:40 +02:00
|
|
|
padding: const EdgeInsets.all(12.0),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
2022-08-10 14:30:28 +02:00
|
|
|
children: <Widget>[
|
2022-08-19 15:04:40 +02:00
|
|
|
const SizedBox(height: 12),
|
2022-08-10 14:30:28 +02:00
|
|
|
I18nText(
|
|
|
|
'settingsView.widgetTitle',
|
|
|
|
child: Text(
|
|
|
|
'',
|
2022-08-19 15:04:40 +02:00
|
|
|
style: GoogleFonts.inter(
|
|
|
|
fontSize: 28,
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
),
|
2022-08-10 14:30:28 +02:00
|
|
|
),
|
|
|
|
),
|
2022-08-19 15:04:40 +02:00
|
|
|
const SizedBox(height: 12),
|
2022-08-10 14:30:28 +02:00
|
|
|
ListTile(
|
2022-08-19 15:04:40 +02:00
|
|
|
title: I18nText(
|
|
|
|
'settingsView.themeLabel',
|
|
|
|
child: Text(
|
|
|
|
'',
|
|
|
|
style: kSettingItemTextStyle,
|
|
|
|
),
|
|
|
|
),
|
2022-08-10 14:30:28 +02:00
|
|
|
subtitle: I18nText('settingsView.themeHint'),
|
|
|
|
trailing: Switch(
|
2022-08-12 11:42:43 +02:00
|
|
|
value: isDark,
|
2022-08-10 14:30:28 +02:00
|
|
|
onChanged: (value) {
|
2022-08-12 11:42:43 +02:00
|
|
|
isDark = value;
|
2022-08-11 21:05:03 +02:00
|
|
|
getThemeManager(context).toggleDarkLightTheme();
|
2022-08-10 14:30:28 +02:00
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
2022-08-20 14:17:00 +02:00
|
|
|
ListTile(
|
|
|
|
title: I18nText(
|
|
|
|
'settingsView.rootModeLabel',
|
|
|
|
child: Text(
|
|
|
|
'',
|
|
|
|
style: kSettingItemTextStyle,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
subtitle: I18nText('settingsView.rootModeHint'),
|
|
|
|
trailing: GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
model.navigateToRootChecker();
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
horizontal: 16, vertical: 8),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(20),
|
|
|
|
border: Border.all(
|
|
|
|
width: 1,
|
|
|
|
color: Theme.of(context).colorScheme.secondary,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Text(
|
|
|
|
model.isRooted ? 'Rooted' : 'Not rooted',
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2022-08-10 14:30:28 +02:00
|
|
|
Container(
|
|
|
|
padding: const EdgeInsets.symmetric(
|
2022-08-11 21:05:03 +02:00
|
|
|
horizontal: 16.0,
|
|
|
|
vertical: 8.0,
|
|
|
|
),
|
2022-08-10 14:30:28 +02:00
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
I18nText(
|
|
|
|
'settingsView.languageLabel',
|
2022-08-19 15:04:40 +02:00
|
|
|
child: Text('', style: kSettingItemTextStyle),
|
2022-08-10 14:30:28 +02:00
|
|
|
),
|
|
|
|
DropdownButton(
|
|
|
|
value: 'en',
|
|
|
|
items: const [
|
|
|
|
DropdownMenuItem(
|
|
|
|
value: 'en',
|
|
|
|
child: Text('English'),
|
|
|
|
),
|
|
|
|
DropdownMenuItem(
|
|
|
|
value: 'fr',
|
|
|
|
child: Text('French'),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
onChanged: (value) {
|
|
|
|
value = value;
|
|
|
|
},
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
ListTile(
|
2022-08-19 15:04:40 +02:00
|
|
|
title: I18nText(
|
|
|
|
'settingsView.contributorsLabel',
|
|
|
|
child: Text('', style: kSettingItemTextStyle),
|
|
|
|
),
|
2022-08-12 20:07:16 +02:00
|
|
|
onTap: model.navigateToContributors,
|
2022-08-10 14:30:28 +02:00
|
|
|
),
|
2022-08-19 15:04:40 +02:00
|
|
|
const AboutWidget(),
|
2022-08-10 14:30:28 +02:00
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|