refactor: apply lint from analyzer

This commit is contained in:
validcube 2023-11-11 19:07:32 +07:00 committed by aAbed
parent d25d1efe9c
commit ad3a778fb9
40 changed files with 67 additions and 106 deletions

View file

@ -30,7 +30,7 @@ Future main() async {
} }
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key); const MyApp({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

View file

@ -12,11 +12,11 @@ import 'package:stacked_services/stacked_services.dart';
class DynamicThemeBuilder extends StatefulWidget { class DynamicThemeBuilder extends StatefulWidget {
const DynamicThemeBuilder({ const DynamicThemeBuilder({
Key? key, super.key,
required this.title, required this.title,
required this.home, required this.home,
required this.localizationsDelegates, required this.localizationsDelegates,
}) : super(key: key); });
final String title; final String title;
final Widget home; final Widget home;
final Iterable<LocalizationsDelegate> localizationsDelegates; final Iterable<LocalizationsDelegate> localizationsDelegates;

View file

@ -8,7 +8,7 @@ import 'package:revanced_manager/ui/widgets/shared/search_bar.dart';
import 'package:stacked/stacked.dart' hide SkeletonLoader; import 'package:stacked/stacked.dart' hide SkeletonLoader;
class AppSelectorView extends StatefulWidget { class AppSelectorView extends StatefulWidget {
const AppSelectorView({Key? key}) : super(key: key); const AppSelectorView({super.key});
@override @override
State<AppSelectorView> createState() => _AppSelectorViewState(); State<AppSelectorView> createState() => _AppSelectorViewState();
@ -114,7 +114,7 @@ class _AppSelectorViewState extends State<AppSelectorView> {
), ),
), ),
) )
.toList(), ,
...model ...model
.getFilteredAppsNames(_query) .getFilteredAppsNames(_query)
.map( .map(
@ -128,7 +128,7 @@ class _AppSelectorViewState extends State<AppSelectorView> {
}, },
), ),
) )
.toList(), ,
const SizedBox(height: 70.0), const SizedBox(height: 70.0),
], ],
), ),

View file

@ -7,7 +7,7 @@ import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';
class ContributorsView extends StatelessWidget { class ContributorsView extends StatelessWidget {
const ContributorsView({Key? key}) : super(key: key); const ContributorsView({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

View file

@ -9,7 +9,7 @@ import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';
class HomeView extends StatelessWidget { class HomeView extends StatelessWidget {
const HomeView({Key? key}) : super(key: key); const HomeView({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

View file

@ -8,7 +8,7 @@ import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';
class InstallerView extends StatelessWidget { class InstallerView extends StatelessWidget {
const InstallerView({Key? key}) : super(key: key); const InstallerView({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

View file

@ -6,7 +6,7 @@ import 'package:revanced_manager/ui/views/navigation/navigation_viewmodel.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';
class NavigationView extends StatelessWidget { class NavigationView extends StatelessWidget {
const NavigationView({Key? key}) : super(key: key); const NavigationView({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

View file

@ -38,11 +38,11 @@ class PatchOptionsViewModel extends BaseViewModel {
option.required && option.required &&
!savedOptions.any((sOption) => sOption.key == option.key), !savedOptions.any((sOption) => sOption.key == option.key),
) )
.toList(), ,
]; ];
} else { } else {
visibleOptions = [ visibleOptions = [
...options.where((option) => option.required).toList(), ...options.where((option) => option.required),
]; ];
} }
} }

View file

@ -9,7 +9,7 @@ import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';
class PatcherView extends StatelessWidget { class PatcherView extends StatelessWidget {
const PatcherView({Key? key}) : super(key: key); const PatcherView({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

View file

@ -7,7 +7,7 @@ import 'package:revanced_manager/ui/widgets/shared/search_bar.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';
class PatchesSelectorView extends StatefulWidget { class PatchesSelectorView extends StatefulWidget {
const PatchesSelectorView({Key? key}) : super(key: key); const PatchesSelectorView({super.key});
@override @override
State<PatchesSelectorView> createState() => _PatchesSelectorViewState(); State<PatchesSelectorView> createState() => _PatchesSelectorViewState();

View file

@ -13,7 +13,7 @@ import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';
class SettingsView extends StatelessWidget { class SettingsView extends StatelessWidget {
const SettingsView({Key? key}) : super(key: key); const SettingsView({super.key});
static const _settingsDivider = static const _settingsDivider =
Divider(thickness: 1.0, indent: 20.0, endIndent: 20.0); Divider(thickness: 1.0, indent: 20.0, endIndent: 20.0);

View file

@ -145,7 +145,7 @@ class SettingsViewModel extends BaseViewModel {
} }
Future<void>? showRequireSuggestedAppVersionDialog( Future<void>? showRequireSuggestedAppVersionDialog(
BuildContext context, bool value) { BuildContext context, bool value,) {
if (!value) { if (!value) {
return showDialog( return showDialog(
context: context, context: context,

View file

@ -9,9 +9,9 @@ import 'package:stacked/stacked.dart';
class AppInfoView extends StatelessWidget { class AppInfoView extends StatelessWidget {
const AppInfoView({ const AppInfoView({
Key? key, super.key,
required this.app, required this.app,
}) : super(key: key); });
final PatchedApplication app; final PatchedApplication app;
@override @override

View file

@ -3,7 +3,7 @@ import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
import 'package:skeletons/skeletons.dart'; import 'package:skeletons/skeletons.dart';
class AppSkeletonLoader extends StatelessWidget { class AppSkeletonLoader extends StatelessWidget {
const AppSkeletonLoader({Key? key}) : super(key: key); const AppSkeletonLoader({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

View file

@ -5,7 +5,7 @@ import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
class InstalledAppItem extends StatefulWidget { class InstalledAppItem extends StatefulWidget {
const InstalledAppItem({ const InstalledAppItem({
Key? key, super.key,
required this.name, required this.name,
required this.pkgName, required this.pkgName,
required this.icon, required this.icon,
@ -13,7 +13,7 @@ class InstalledAppItem extends StatefulWidget {
required this.suggestedVersion, required this.suggestedVersion,
required this.installedVersion, required this.installedVersion,
this.onTap, this.onTap,
}) : super(key: key); });
final String name; final String name;
final String pkgName; final String pkgName;
final Uint8List icon; final Uint8List icon;

View file

@ -4,12 +4,12 @@ import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
class NotInstalledAppItem extends StatefulWidget { class NotInstalledAppItem extends StatefulWidget {
const NotInstalledAppItem({ const NotInstalledAppItem({
Key? key, super.key,
required this.name, required this.name,
required this.patchesCount, required this.patchesCount,
required this.suggestedVersion, required this.suggestedVersion,
this.onTap, this.onTap,
}) : super(key: key); });
final String name; final String name;
final int patchesCount; final int patchesCount;
final String suggestedVersion; final String suggestedVersion;

View file

@ -7,10 +7,10 @@ import 'package:url_launcher/url_launcher.dart';
class ContributorsCard extends StatefulWidget { class ContributorsCard extends StatefulWidget {
const ContributorsCard({ const ContributorsCard({
Key? key, super.key,
required this.title, required this.title,
required this.contributors, required this.contributors,
}) : super(key: key); });
final String title; final String title;
final List<dynamic> contributors; final List<dynamic> contributors;

View file

@ -10,7 +10,7 @@ import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
//ignore: must_be_immutable //ignore: must_be_immutable
class InstalledAppsCard extends StatelessWidget { class InstalledAppsCard extends StatelessWidget {
InstalledAppsCard({Key? key}) : super(key: key); InstalledAppsCard({super.key});
List<PatchedApplication> apps = locator<HomeViewModel>().patchedInstalledApps; List<PatchedApplication> apps = locator<HomeViewModel>().patchedInstalledApps;
final ManagerAPI _managerAPI = locator<ManagerAPI>(); final ManagerAPI _managerAPI = locator<ManagerAPI>();

View file

@ -7,10 +7,10 @@ import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
class LatestCommitCard extends StatefulWidget { class LatestCommitCard extends StatefulWidget {
const LatestCommitCard({ const LatestCommitCard({
Key? key, super.key,
required this.model, required this.model,
required this.parentContext, required this.parentContext,
}) : super(key: key); });
final HomeViewModel model; final HomeViewModel model;
final BuildContext parentContext; final BuildContext parentContext;

View file

@ -7,9 +7,9 @@ import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
class AppSelectorCard extends StatelessWidget { class AppSelectorCard extends StatelessWidget {
const AppSelectorCard({ const AppSelectorCard({
Key? key, super.key,
required this.onPressed, required this.onPressed,
}) : super(key: key); });
final Function() onPressed; final Function() onPressed;
@override @override

View file

@ -7,9 +7,9 @@ import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
class PatchSelectorCard extends StatelessWidget { class PatchSelectorCard extends StatelessWidget {
const PatchSelectorCard({ const PatchSelectorCard({
Key? key, super.key,
required this.onPressed, required this.onPressed,
}) : super(key: key); });
final Function() onPressed; final Function() onPressed;
@override @override

View file

@ -10,7 +10,7 @@ import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
class PatchItem extends StatefulWidget { class PatchItem extends StatefulWidget {
PatchItem({ PatchItem({
Key? key, super.key,
required this.name, required this.name,
required this.simpleName, required this.simpleName,
required this.description, required this.description,
@ -23,7 +23,7 @@ class PatchItem extends StatefulWidget {
required this.onChanged, required this.onChanged,
required this.navigateToOptions, required this.navigateToOptions,
required this.isChangeEnabled, required this.isChangeEnabled,
}) : super(key: key); });
final String name; final String name;
final String simpleName; final String simpleName;
final String description; final String description;

View file

@ -4,7 +4,7 @@ import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:revanced_manager/utils/about_info.dart'; import 'package:revanced_manager/utils/about_info.dart';
class AboutWidget extends StatefulWidget { class AboutWidget extends StatefulWidget {
const AboutWidget({Key? key, this.padding}) : super(key: key); const AboutWidget({super.key, this.padding});
final EdgeInsetsGeometry? padding; final EdgeInsetsGeometry? padding;

View file

@ -2,10 +2,10 @@ import 'package:flutter/material.dart';
class CustomSwitch extends StatelessWidget { class CustomSwitch extends StatelessWidget {
const CustomSwitch({ const CustomSwitch({
Key? key, super.key,
required this.onChanged, required this.onChanged,
required this.value, required this.value,
}) : super(key: key); });
final ValueChanged<bool> onChanged; final ValueChanged<bool> onChanged;
final bool value; final bool value;

View file

@ -3,13 +3,13 @@ import 'package:revanced_manager/ui/widgets/settingsView/custom_switch.dart';
class CustomSwitchTile extends StatelessWidget { class CustomSwitchTile extends StatelessWidget {
const CustomSwitchTile({ const CustomSwitchTile({
Key? key, super.key,
required this.title, required this.title,
required this.subtitle, required this.subtitle,
required this.value, required this.value,
required this.onTap, required this.onTap,
this.padding, this.padding,
}) : super(key: key); });
final Widget title; final Widget title;
final Widget subtitle; final Widget subtitle;
final bool value; final bool value;

View file

@ -2,13 +2,13 @@ import 'package:flutter/material.dart';
class CustomTextField extends StatelessWidget { class CustomTextField extends StatelessWidget {
const CustomTextField({ const CustomTextField({
Key? key, super.key,
required this.inputController, required this.inputController,
required this.label, required this.label,
required this.hint, required this.hint,
this.leadingIcon, this.leadingIcon,
required this.onChanged, required this.onChanged,
}) : super(key: key); });
final TextEditingController inputController; final TextEditingController inputController;
final Widget label; final Widget label;
final String hint; final String hint;

View file

@ -29,7 +29,7 @@ class _SRequireSuggestedAppVersionState extends State<SRequireSuggestedAppVersio
subtitle: I18nText('settingsView.requireSuggestedAppVersionHint'), subtitle: I18nText('settingsView.requireSuggestedAppVersionHint'),
value: _settingsViewModel.isRequireSuggestedAppVersionEnabled(), value: _settingsViewModel.isRequireSuggestedAppVersionEnabled(),
onChanged: (value) async { onChanged: (value) async {
await _settingsViewModel.showRequireSuggestedAppVersionDialog(context, value); await _settingsViewModel.showRequireSuggestedAppVersionDialog(context, value,);
setState(() {}); setState(() {});
}, },
); );

View file

@ -3,10 +3,10 @@ import 'package:flutter_i18n/flutter_i18n.dart';
class SettingsSection extends StatelessWidget { class SettingsSection extends StatelessWidget {
const SettingsSection({ const SettingsSection({
Key? key, super.key,
required this.title, required this.title,
required this.children, required this.children,
}) : super(key: key); });
final String title; final String title;
final List<Widget> children; final List<Widget> children;

View file

@ -3,12 +3,12 @@ import 'package:flutter_i18n/flutter_i18n.dart';
class SettingsTileDialog extends StatelessWidget { class SettingsTileDialog extends StatelessWidget {
const SettingsTileDialog({ const SettingsTileDialog({
Key? key, super.key,
required this.title, required this.title,
required this.subtitle, required this.subtitle,
required this.onTap, required this.onTap,
this.padding, this.padding,
}) : super(key: key); });
final String title; final String title;
final String subtitle; final String subtitle;
final Function()? onTap; final Function()? onTap;

View file

@ -3,12 +3,12 @@ import 'package:url_launcher/url_launcher.dart';
class SocialMediaItem extends StatelessWidget { class SocialMediaItem extends StatelessWidget {
const SocialMediaItem({ const SocialMediaItem({
Key? key, super.key,
this.icon, this.icon,
required this.title, required this.title,
this.subtitle, this.subtitle,
this.url, this.url,
}) : super(key: key); });
final Widget? icon; final Widget? icon;
final Widget title; final Widget title;
final Widget? subtitle; final Widget? subtitle;

View file

@ -8,9 +8,9 @@ import 'package:revanced_manager/ui/widgets/shared/custom_icon.dart';
class SocialMediaWidget extends StatelessWidget { class SocialMediaWidget extends StatelessWidget {
const SocialMediaWidget({ const SocialMediaWidget({
Key? key, super.key,
this.padding, this.padding,
}) : super(key: key); });
final EdgeInsetsGeometry? padding; final EdgeInsetsGeometry? padding;
@override @override

View file

@ -8,12 +8,12 @@ import 'package:timeago/timeago.dart';
class ApplicationItem extends StatefulWidget { class ApplicationItem extends StatefulWidget {
const ApplicationItem({ const ApplicationItem({
Key? key, super.key,
required this.icon, required this.icon,
required this.name, required this.name,
required this.patchDate, required this.patchDate,
required this.onPressed, required this.onPressed,
}) : super(key: key); });
final Uint8List icon; final Uint8List icon;
final String name; final String name;
final DateTime patchDate; final DateTime patchDate;

View file

@ -2,13 +2,13 @@ import 'package:flutter/material.dart';
class CustomCard extends StatelessWidget { class CustomCard extends StatelessWidget {
const CustomCard({ const CustomCard({
Key? key, super.key,
this.isFilled = true, this.isFilled = true,
required this.child, required this.child,
this.onTap, this.onTap,
this.padding, this.padding,
this.backgroundColor, this.backgroundColor,
}) : super(key: key); });
final bool isFilled; final bool isFilled;
final Widget child; final Widget child;
final Function()? onTap; final Function()? onTap;

View file

@ -2,11 +2,11 @@ import 'package:flutter/material.dart';
class CustomChip extends StatelessWidget { class CustomChip extends StatelessWidget {
const CustomChip({ const CustomChip({
Key? key, super.key,
required this.label, required this.label,
this.isSelected = false, this.isSelected = false,
this.onSelected, this.onSelected,
}) : super(key: key); });
final Widget label; final Widget label;
final bool isSelected; final bool isSelected;
final Function(bool)? onSelected; final Function(bool)? onSelected;

View file

@ -2,12 +2,12 @@ import 'package:flutter/material.dart';
class CustomMaterialButton extends StatelessWidget { class CustomMaterialButton extends StatelessWidget {
const CustomMaterialButton({ const CustomMaterialButton({
Key? key, super.key,
required this.label, required this.label,
this.isFilled = true, this.isFilled = true,
this.isExpanded = false, this.isExpanded = false,
required this.onPressed, required this.onPressed,
}) : super(key: key); });
final Widget label; final Widget label;
final bool isFilled; final bool isFilled;
final bool isExpanded; final bool isExpanded;
@ -49,13 +49,13 @@ class CustomMaterialButton extends StatelessWidget {
// ignore: must_be_immutable // ignore: must_be_immutable
class TimerButton extends StatefulWidget { class TimerButton extends StatefulWidget {
TimerButton({ TimerButton({
Key? key, super.key,
required this.seconds, required this.seconds,
required this.isRunning, required this.isRunning,
required this.onTimerEnd, required this.onTimerEnd,
this.label = const Text(''), this.label = const Text(''),
this.isFilled = true, this.isFilled = true,
}) : super(key: key); });
Widget label; Widget label;
bool isFilled; bool isFilled;
int seconds; int seconds;

View file

@ -1,39 +0,0 @@
import 'package:flutter/material.dart';
class CustomPopupMenu extends StatelessWidget {
const CustomPopupMenu({
Key? key,
required this.onSelected,
required this.children,
}) : super(key: key);
final Function(dynamic) onSelected;
final Map<int, Widget> children;
@override
Widget build(BuildContext context) {
return Theme(
data: Theme.of(context).copyWith(useMaterial3: false),
child: PopupMenuButton<int>(
icon: Icon(
Icons.more_vert,
color: Theme.of(context).colorScheme.secondary,
),
onSelected: onSelected,
itemBuilder: (context) => children.entries
.map(
(entry) => PopupMenuItem<int>(
padding: const EdgeInsets.all(16.0).copyWith(right: 20),
value: entry.key,
child: entry.value,
),
)
.toList(),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(24),
),
color: Theme.of(context).colorScheme.secondaryContainer,
position: PopupMenuPosition.under,
),
);
}
}

View file

@ -2,13 +2,13 @@ import 'package:flutter/material.dart';
class CustomSliverAppBar extends StatelessWidget { class CustomSliverAppBar extends StatelessWidget {
const CustomSliverAppBar({ const CustomSliverAppBar({
Key? key, super.key,
required this.title, required this.title,
this.actions, this.actions,
this.bottom, this.bottom,
this.isMainView = false, this.isMainView = false,
this.onBackButtonPressed, this.onBackButtonPressed,
}) : super(key: key); });
final Widget title; final Widget title;
final List<Widget>? actions; final List<Widget>? actions;
final PreferredSizeWidget? bottom; final PreferredSizeWidget? bottom;

View file

@ -3,10 +3,10 @@ import 'package:flutter/material.dart';
class OpenContainerWrapper extends StatelessWidget { class OpenContainerWrapper extends StatelessWidget {
const OpenContainerWrapper({ const OpenContainerWrapper({
Key? key, super.key,
required this.openBuilder, required this.openBuilder,
required this.closedBuilder, required this.closedBuilder,
}) : super(key: key); });
final OpenContainerBuilder openBuilder; final OpenContainerBuilder openBuilder;
final CloseContainerBuilder closedBuilder; final CloseContainerBuilder closedBuilder;

View file

@ -2,12 +2,12 @@ import 'package:flutter/material.dart';
class SearchBar extends StatefulWidget { class SearchBar extends StatefulWidget {
const SearchBar({ const SearchBar({
Key? key, super.key,
required this.hintText, required this.hintText,
this.showSelectIcon = false, this.showSelectIcon = false,
this.onSelectAll, this.onSelectAll,
required this.onQueryChanged, required this.onQueryChanged,
}) : super(key: key); });
final String? hintText; final String? hintText;
final bool showSelectIcon; final bool showSelectIcon;
final Function(bool)? onSelectAll; final Function(bool)? onSelectAll;

View file

@ -86,7 +86,7 @@ dev_dependencies:
json_serializable: ^6.6.1 json_serializable: ^6.6.1
build_runner: any build_runner: any
flutter_launcher_icons: ^0.13.0 flutter_launcher_icons: ^0.13.0
flutter_lints: ^2.0.1 flutter_lints: ^3.0.1
flutter_test: flutter_test:
sdk: flutter sdk: flutter
injectable_generator: ^2.1.5 injectable_generator: ^2.1.5