mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2025-05-17 22:46:27 +08:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
31756884b6 | |||
0a2a495ab0 | |||
8300cc4071 | |||
9f58757caf | |||
5d296038b7 | |||
9f85450c6c |
@ -69,7 +69,8 @@
|
||||
},
|
||||
"patchesSelectorView": {
|
||||
"searchBarHint": "Search patches",
|
||||
"doneButton": "Done"
|
||||
"doneButton": "Done",
|
||||
"noPatchesFound": "No patches found for the selected app."
|
||||
},
|
||||
"patchItem": {
|
||||
"unsupportedWarningButton": "Unsupported version",
|
||||
|
@ -13,7 +13,7 @@ class GithubAPI {
|
||||
final Dio _dio = Dio();
|
||||
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
|
||||
final Options _cacheOptions = buildCacheOptions(
|
||||
const Duration(hours: 1),
|
||||
const Duration(days: 1),
|
||||
maxStale: const Duration(days: 7),
|
||||
);
|
||||
final Map<String, String> repoAppPath = {
|
||||
|
@ -13,7 +13,7 @@ class RevancedAPI {
|
||||
final Dio _dio = Dio();
|
||||
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
|
||||
final Options _cacheOptions = buildCacheOptions(
|
||||
const Duration(hours: 1),
|
||||
const Duration(days: 1),
|
||||
maxStale: const Duration(days: 7),
|
||||
);
|
||||
|
||||
|
@ -3,6 +3,7 @@ import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:revanced_manager/ui/views/installer/installer_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart';
|
||||
import 'package:revanced_manager/ui/widgets/installerView/gradient_progress_indicator.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_popup_menu.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart';
|
||||
@ -57,14 +58,9 @@ class InstallerView extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
bottom: PreferredSize(
|
||||
preferredSize: const Size(double.infinity, 1.0),
|
||||
child: LinearProgressIndicator(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
backgroundColor:
|
||||
Theme.of(context).colorScheme.primaryContainer,
|
||||
value: model.progress,
|
||||
),
|
||||
),
|
||||
preferredSize: const Size(double.infinity, 1.0),
|
||||
child:
|
||||
GradientProgressIndicator(progress: model.progress!)),
|
||||
),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
|
@ -1,6 +1,7 @@
|
||||
// ignore_for_file: use_build_context_synchronously
|
||||
import 'package:dynamic_themes/dynamic_themes.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:revanced_manager/services/root_api.dart';
|
||||
@ -15,14 +16,21 @@ class NavigationViewModel extends IndexTrackingViewModel {
|
||||
void initialize(BuildContext context) async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
if (prefs.getBool('useDarkTheme') == null) {
|
||||
if (MediaQuery.of(context).platformBrightness == Brightness.light) {
|
||||
await prefs.setBool('useDarkTheme', false);
|
||||
DynamicTheme.of(context)!.setTheme(0);
|
||||
} else {
|
||||
await prefs.setBool('useDarkTheme', true);
|
||||
DynamicTheme.of(context)!.setTheme(1);
|
||||
}
|
||||
bool isDark =
|
||||
MediaQuery.of(context).platformBrightness != Brightness.light;
|
||||
await prefs.setBool('useDarkTheme', isDark);
|
||||
await DynamicTheme.of(context)!.setTheme(isDark ? 1 : 0);
|
||||
}
|
||||
SystemChrome.setSystemUIOverlayStyle(
|
||||
SystemUiOverlayStyle(
|
||||
systemNavigationBarColor:
|
||||
DynamicTheme.of(context)!.theme.colorScheme.surface,
|
||||
systemNavigationBarIconBrightness:
|
||||
DynamicTheme.of(context)!.theme.brightness == Brightness.light
|
||||
? Brightness.dark
|
||||
: Brightness.light,
|
||||
),
|
||||
);
|
||||
RootAPI().hasRootPermissions();
|
||||
Permission.requestInstallPackages.request();
|
||||
Permission.ignoreBatteryOptimizations.request();
|
||||
|
@ -55,9 +55,16 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
|
||||
const SizedBox(height: 12),
|
||||
Expanded(
|
||||
child: model.patches.isEmpty
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
? Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Center(
|
||||
child: I18nText(
|
||||
'patchesSelectorView.noPatchesFound',
|
||||
child: Text(
|
||||
'',
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: ListView(
|
||||
|
@ -3,6 +3,7 @@ import 'dart:io';
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:dynamic_themes/dynamic_themes.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:logcat/logcat.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
@ -50,10 +51,16 @@ class SettingsViewModel extends BaseViewModel {
|
||||
await _managerAPI.setUseDynamicTheme(value);
|
||||
int currentTheme = DynamicTheme.of(context)!.themeId;
|
||||
if (currentTheme.isEven) {
|
||||
DynamicTheme.of(context)!.setTheme(value ? 2 : 0);
|
||||
await DynamicTheme.of(context)!.setTheme(value ? 2 : 0);
|
||||
} else {
|
||||
DynamicTheme.of(context)!.setTheme(value ? 3 : 1);
|
||||
await DynamicTheme.of(context)!.setTheme(value ? 3 : 1);
|
||||
}
|
||||
SystemChrome.setSystemUIOverlayStyle(
|
||||
SystemUiOverlayStyle(
|
||||
systemNavigationBarColor:
|
||||
DynamicTheme.of(context)!.theme.colorScheme.surface,
|
||||
),
|
||||
);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
@ -65,10 +72,18 @@ class SettingsViewModel extends BaseViewModel {
|
||||
await _managerAPI.setUseDarkTheme(value);
|
||||
int currentTheme = DynamicTheme.of(context)!.themeId;
|
||||
if (currentTheme < 2) {
|
||||
DynamicTheme.of(context)!.setTheme(value ? 1 : 0);
|
||||
await DynamicTheme.of(context)!.setTheme(value ? 1 : 0);
|
||||
} else {
|
||||
DynamicTheme.of(context)!.setTheme(value ? 3 : 2);
|
||||
await DynamicTheme.of(context)!.setTheme(value ? 3 : 2);
|
||||
}
|
||||
SystemChrome.setSystemUIOverlayStyle(
|
||||
SystemUiOverlayStyle(
|
||||
systemNavigationBarColor:
|
||||
DynamicTheme.of(context)!.theme.colorScheme.surface,
|
||||
systemNavigationBarIconBrightness:
|
||||
value ? Brightness.light : Brightness.dark,
|
||||
),
|
||||
);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,32 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class GradientProgressIndicator extends StatefulWidget {
|
||||
final double? progress;
|
||||
const GradientProgressIndicator({required this.progress, super.key});
|
||||
|
||||
@override
|
||||
State<GradientProgressIndicator> createState() =>
|
||||
_GradientProgressIndicatorState();
|
||||
}
|
||||
|
||||
class _GradientProgressIndicatorState extends State<GradientProgressIndicator> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 500),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Theme.of(context).colorScheme.primary,
|
||||
Theme.of(context).colorScheme.secondary,
|
||||
],
|
||||
),
|
||||
),
|
||||
height: 5,
|
||||
width: MediaQuery.of(context).size.width * widget.progress!,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@ import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||
import 'package:expandable/expandable.dart';
|
||||
import 'package:timeago/timeago.dart';
|
||||
|
||||
class ApplicationItem extends StatelessWidget {
|
||||
class ApplicationItem extends StatefulWidget {
|
||||
final Uint8List icon;
|
||||
final String name;
|
||||
final DateTime patchDate;
|
||||
@ -24,10 +24,39 @@ class ApplicationItem extends StatelessWidget {
|
||||
required this.onPressed,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<ApplicationItem> createState() => _ApplicationItemState();
|
||||
}
|
||||
|
||||
class _ApplicationItemState extends State<ApplicationItem>
|
||||
with TickerProviderStateMixin {
|
||||
late AnimationController _animationController;
|
||||
|
||||
@override
|
||||
initState() {
|
||||
super.initState();
|
||||
_animationController = AnimationController(
|
||||
vsync: this,
|
||||
duration: const Duration(milliseconds: 300),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_animationController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ExpandableController expController = ExpandableController();
|
||||
return ExpandablePanel(
|
||||
controller: expController,
|
||||
theme: const ExpandableThemeData(
|
||||
inkWellBorderRadius: BorderRadius.all(Radius.circular(16)),
|
||||
tapBodyToCollapse: false,
|
||||
tapBodyToExpand: false,
|
||||
tapHeaderToExpand: false,
|
||||
hasIcon: false,
|
||||
animationDuration: Duration(milliseconds: 450),
|
||||
),
|
||||
@ -36,32 +65,44 @@ class ApplicationItem extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: 60,
|
||||
child: Image.memory(icon, height: 39, width: 39),
|
||||
child: Image.memory(widget.icon, height: 39, width: 39),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
name,
|
||||
widget.name,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
Text(format(patchDate)),
|
||||
Text(format(widget.patchDate)),
|
||||
],
|
||||
),
|
||||
const Spacer(),
|
||||
RotationTransition(
|
||||
turns: Tween(begin: 0.0, end: 0.50).animate(_animationController),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
expController.toggle();
|
||||
_animationController.isCompleted
|
||||
? _animationController.reverse()
|
||||
: _animationController.forward();
|
||||
},
|
||||
icon: const Icon(Icons.arrow_drop_down),
|
||||
),
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
CustomMaterialButton(
|
||||
label: isUpdatableApp
|
||||
label: widget.isUpdatableApp
|
||||
? I18nText('applicationItem.patchButton')
|
||||
: I18nText('applicationItem.infoButton'),
|
||||
onPressed: onPressed,
|
||||
onPressed: widget.onPressed,
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -82,7 +123,7 @@ class ApplicationItem extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text('\u2022 ${changelog.join('\n\u2022 ')}'),
|
||||
Text('\u2022 ${widget.changelog.join('\n\u2022 ')}'),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -4,7 +4,7 @@ homepage: https://github.com/revanced/revanced-manager
|
||||
|
||||
publish_to: 'none'
|
||||
|
||||
version: 0.0.5+5
|
||||
version: 0.0.7+7
|
||||
|
||||
environment:
|
||||
sdk: ">=2.17.5 <3.0.0"
|
||||
|
Reference in New Issue
Block a user