mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-12 04:37:37 +02:00
feat: overall UI rework in Settings View (#53)
This commit is contained in:
@ -3,11 +3,16 @@ import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:revanced_manager/constants.dart';
|
||||
import 'package:revanced_manager/theme.dart';
|
||||
import 'package:revanced_manager/ui/views/contributors/contributors_view.dart';
|
||||
import 'package:revanced_manager/ui/views/settings/settings_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/settingsView/about_info_widget.dart';
|
||||
import 'package:revanced_manager/ui/widgets/settingsView/custom_text_field.dart';
|
||||
import 'package:revanced_manager/ui/widgets/settingsView/settings_switch_item.dart';
|
||||
import 'package:revanced_manager/ui/widgets/settingsView/social_media_cards.dart';
|
||||
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';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:stacked_themes/stacked_themes.dart';
|
||||
|
||||
@ -22,149 +27,124 @@ class SettingsView extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<SettingsViewModel>.reactive(
|
||||
disposeViewModel: false,
|
||||
viewModelBuilder: () => SettingsViewModel(),
|
||||
onModelReady: (model) => model.initialize(),
|
||||
builder: (context, SettingsViewModel model, child) => Scaffold(
|
||||
body: CustomScrollView(
|
||||
slivers: <Widget>[
|
||||
SliverAppBar(
|
||||
pinned: true,
|
||||
snap: false,
|
||||
floating: false,
|
||||
expandedHeight: 100.0,
|
||||
automaticallyImplyLeading: false,
|
||||
backgroundColor: MaterialStateColor.resolveWith(
|
||||
(states) => states.contains(MaterialState.scrolledUnder)
|
||||
? isDark
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(context).navigationBarTheme.backgroundColor!
|
||||
: Theme.of(context).scaffoldBackgroundColor,
|
||||
),
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
titlePadding: const EdgeInsets.symmetric(
|
||||
vertical: 23.0,
|
||||
horizontal: 20.0,
|
||||
),
|
||||
title: I18nText(
|
||||
'settingsView.widgetTitle',
|
||||
child: Text(
|
||||
'',
|
||||
style: GoogleFonts.inter(
|
||||
color: Theme.of(context).textTheme.headline5!.color,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
CustomSliverAppBar(
|
||||
title: I18nText(
|
||||
'settingsView.widgetTitle',
|
||||
child: Text(
|
||||
'',
|
||||
style: GoogleFonts.inter(
|
||||
color: Theme.of(context).textTheme.headline5!.color,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 10.0,
|
||||
horizontal: 20.0,
|
||||
),
|
||||
sliver: SliverList(
|
||||
delegate: SliverChildListDelegate.fixed(
|
||||
<Widget>[
|
||||
SettingsSwitchItem(
|
||||
title: 'settingsView.themeLabel',
|
||||
subtitle: 'settingsView.themeHint',
|
||||
value: isDark,
|
||||
onTap: (value) {
|
||||
isDark = value;
|
||||
getThemeManager(context).toggleDarkLightTheme();
|
||||
},
|
||||
),
|
||||
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,
|
||||
SettingsSection(
|
||||
title: 'settingsView.appearanceSectionTitle',
|
||||
children: <Widget>[
|
||||
CustomSwitchTile(
|
||||
title: I18nText(
|
||||
'settingsView.themeLabel',
|
||||
child: Text(
|
||||
'',
|
||||
style: kSettingItemTextStyle,
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
model.isRooted ? 'Rooted' : 'Not rooted',
|
||||
),
|
||||
subtitle: I18nText('settingsView.themeHint'),
|
||||
value: isDark,
|
||||
onTap: (value) {
|
||||
isDark = value;
|
||||
getThemeManager(context).toggleDarkLightTheme();
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
CustomTextField(
|
||||
inputController: organizationController,
|
||||
label: 'settingsView.organizationLabel',
|
||||
hint: ghOrg,
|
||||
onChanged: (value) {
|
||||
ghOrg = value;
|
||||
},
|
||||
),
|
||||
CustomTextField(
|
||||
inputController: patchesSourceController,
|
||||
label: 'settingsView.patchesSourceLabel',
|
||||
hint: patchesRepo,
|
||||
onChanged: (value) {
|
||||
patchesRepo = value;
|
||||
},
|
||||
),
|
||||
CustomTextField(
|
||||
inputController: integrationsSourceController,
|
||||
label: 'settingsView.integrationsSourceLabel',
|
||||
hint: integrationsRepo,
|
||||
onChanged: (value) {
|
||||
integrationsRepo = value;
|
||||
},
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16.0,
|
||||
vertical: 8.0,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
I18nText(
|
||||
'settingsView.languageLabel',
|
||||
child: Text('', style: kSettingItemTextStyle),
|
||||
),
|
||||
DropdownButton(
|
||||
SettingsTileDialog(
|
||||
title: 'settingsView.languageLabel',
|
||||
subtitle: 'English',
|
||||
children: <Widget>[
|
||||
RadioListTile<String>(
|
||||
title: I18nText('settingsView.englishOption'),
|
||||
value: 'en',
|
||||
items: const [
|
||||
DropdownMenuItem(
|
||||
value: 'en',
|
||||
child: Text('English'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 'fr',
|
||||
child: Text('French'),
|
||||
),
|
||||
],
|
||||
groupValue: 'en',
|
||||
onChanged: (value) {
|
||||
value = value;
|
||||
model.updateLanguage(context, value);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
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,
|
||||
),
|
||||
],
|
||||
),
|
||||
ListTile(
|
||||
title: I18nText(
|
||||
'settingsView.contributorsLabel',
|
||||
child: Text('', style: kSettingItemTextStyle),
|
||||
),
|
||||
onTap: model.navigateToContributors,
|
||||
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(),
|
||||
],
|
||||
),
|
||||
const Divider(thickness: 1.0),
|
||||
const SettingsSection(
|
||||
title: 'settingsView.infoSectionTitle',
|
||||
children: <Widget>[
|
||||
AboutWidget(),
|
||||
],
|
||||
),
|
||||
const SocialMediaCards(),
|
||||
const AboutWidget(),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
Reference in New Issue
Block a user