-
-
Notifications
You must be signed in to change notification settings - Fork 777
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add a toggle for alternative sources (#1686)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
- Loading branch information
1 parent
ce5088a
commit f89c742
Showing
11 changed files
with
116 additions
and
61 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// ignore_for_file: prefer_const_constructors | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:revanced_manager/gen/strings.g.dart'; | ||
import 'package:revanced_manager/ui/views/settings/settingsFragment/settings_manage_api_url.dart'; | ||
import 'package:revanced_manager/ui/widgets/settingsView/settings_section.dart'; | ||
import 'package:revanced_manager/ui/widgets/settingsView/settings_use_alternative_sources.dart'; | ||
|
||
class SDataSection extends StatelessWidget { | ||
const SDataSection({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return SettingsSection( | ||
title: t.settingsView.dataSectionTitle, | ||
children: const <Widget>[ | ||
SManageApiUrlUI(), | ||
SUseAlternativeSources(), | ||
], | ||
); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
lib/ui/widgets/settingsView/settings_use_alternative_sources.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:revanced_manager/gen/strings.g.dart'; | ||
import 'package:revanced_manager/ui/views/settings/settingsFragment/settings_manage_sources.dart'; | ||
import 'package:revanced_manager/ui/views/settings/settings_viewmodel.dart'; | ||
import 'package:revanced_manager/ui/widgets/shared/haptics/haptic_switch_list_tile.dart'; | ||
|
||
class SUseAlternativeSources extends StatefulWidget { | ||
const SUseAlternativeSources({super.key}); | ||
|
||
@override | ||
State<SUseAlternativeSources> createState() => _SUseAlternativeSourcesState(); | ||
} | ||
|
||
final _settingsViewModel = SettingsViewModel(); | ||
|
||
class _SUseAlternativeSourcesState extends State<SUseAlternativeSources> { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
HapticSwitchListTile( | ||
contentPadding: const EdgeInsets.symmetric(horizontal: 20.0), | ||
title: Text( | ||
t.settingsView.useAlternativeSources, | ||
style: const TextStyle( | ||
fontSize: 20, | ||
fontWeight: FontWeight.w500, | ||
), | ||
), | ||
subtitle: Text(t.settingsView.useAlternativeSourcesHint), | ||
value: _settingsViewModel.isUsingAlternativeSources(), | ||
onChanged: (value) { | ||
_settingsViewModel.useAlternativeSources(value); | ||
setState(() {}); | ||
}, | ||
), | ||
if (_settingsViewModel.isUsingAlternativeSources()) | ||
const SManageSourcesUI(), | ||
], | ||
); | ||
} | ||
} |