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 {
const MyApp({Key? key}) : super(key: key);
const MyApp({super.key});
@override
Widget build(BuildContext context) {

View file

@ -12,11 +12,11 @@ import 'package:stacked_services/stacked_services.dart';
class DynamicThemeBuilder extends StatefulWidget {
const DynamicThemeBuilder({
Key? key,
super.key,
required this.title,
required this.home,
required this.localizationsDelegates,
}) : super(key: key);
});
final String title;
final Widget home;
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;
class AppSelectorView extends StatefulWidget {
const AppSelectorView({Key? key}) : super(key: key);
const AppSelectorView({super.key});
@override
State<AppSelectorView> createState() => _AppSelectorViewState();
@ -114,7 +114,7 @@ class _AppSelectorViewState extends State<AppSelectorView> {
),
),
)
.toList(),
,
...model
.getFilteredAppsNames(_query)
.map(
@ -128,7 +128,7 @@ class _AppSelectorViewState extends State<AppSelectorView> {
},
),
)
.toList(),
,
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';
class ContributorsView extends StatelessWidget {
const ContributorsView({Key? key}) : super(key: key);
const ContributorsView({super.key});
@override
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';
class HomeView extends StatelessWidget {
const HomeView({Key? key}) : super(key: key);
const HomeView({super.key});
@override
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';
class InstallerView extends StatelessWidget {
const InstallerView({Key? key}) : super(key: key);
const InstallerView({super.key});
@override
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';
class NavigationView extends StatelessWidget {
const NavigationView({Key? key}) : super(key: key);
const NavigationView({super.key});
@override
Widget build(BuildContext context) {

View file

@ -38,11 +38,11 @@ class PatchOptionsViewModel extends BaseViewModel {
option.required &&
!savedOptions.any((sOption) => sOption.key == option.key),
)
.toList(),
,
];
} else {
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';
class PatcherView extends StatelessWidget {
const PatcherView({Key? key}) : super(key: key);
const PatcherView({super.key});
@override
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';
class PatchesSelectorView extends StatefulWidget {
const PatchesSelectorView({Key? key}) : super(key: key);
const PatchesSelectorView({super.key});
@override
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';
class SettingsView extends StatelessWidget {
const SettingsView({Key? key}) : super(key: key);
const SettingsView({super.key});
static const _settingsDivider =
Divider(thickness: 1.0, indent: 20.0, endIndent: 20.0);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -10,7 +10,7 @@ import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
//ignore: must_be_immutable
class InstalledAppsCard extends StatelessWidget {
InstalledAppsCard({Key? key}) : super(key: key);
InstalledAppsCard({super.key});
List<PatchedApplication> apps = locator<HomeViewModel>().patchedInstalledApps;
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 {
const LatestCommitCard({
Key? key,
super.key,
required this.model,
required this.parentContext,
}) : super(key: key);
});
final HomeViewModel model;
final BuildContext parentContext;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -2,12 +2,12 @@ import 'package:flutter/material.dart';
class CustomMaterialButton extends StatelessWidget {
const CustomMaterialButton({
Key? key,
super.key,
required this.label,
this.isFilled = true,
this.isExpanded = false,
required this.onPressed,
}) : super(key: key);
});
final Widget label;
final bool isFilled;
final bool isExpanded;
@ -49,13 +49,13 @@ class CustomMaterialButton extends StatelessWidget {
// ignore: must_be_immutable
class TimerButton extends StatefulWidget {
TimerButton({
Key? key,
super.key,
required this.seconds,
required this.isRunning,
required this.onTimerEnd,
this.label = const Text(''),
this.isFilled = true,
}) : super(key: key);
});
Widget label;
bool isFilled;
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 {
const CustomSliverAppBar({
Key? key,
super.key,
required this.title,
this.actions,
this.bottom,
this.isMainView = false,
this.onBackButtonPressed,
}) : super(key: key);
});
final Widget title;
final List<Widget>? actions;
final PreferredSizeWidget? bottom;

View file

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

View file

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

View file

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