Fix new linter warnings

This commit is contained in:
Ming Ming 2024-05-28 23:10:33 +08:00
parent 90b138a9cc
commit 4e8d8d6768
77 changed files with 213 additions and 297 deletions

View file

@ -1,4 +1,4 @@
/// Helper functions working with remote Nextcloud server
// Helper functions working with remote Nextcloud server
import 'dart:convert';
import 'package:clock/clock.dart';
@ -131,7 +131,7 @@ String getAccountAvatarUrl(Account account, int size) =>
String getAccountAvatarUrlRelative(Account account, int size) =>
"avatar/${account.userId}/$size";
/// Initiate a login with Nextclouds login flow v2: https://docs.nextcloud.com/server/latest/developer_manual/client_apis/LoginFlow/index.html#login-flow-v2
/// Initiate a login with Nextcloud login flow v2: https://docs.nextcloud.com/server/latest/developer_manual/client_apis/LoginFlow/index.html#login-flow-v2
Future<InitiateLoginResponse> initiateLogin(Uri uri) async {
final response = await Api.fromBaseUrl(uri).request(
"POST",
@ -151,7 +151,7 @@ Future<InitiateLoginResponse> initiateLogin(Uri uri) async {
}
}
/// Retrieve App Password after successful initiation of login with Nextclouds login flow v2: https://docs.nextcloud.com/server/latest/developer_manual/client_apis/LoginFlow/index.html#login-flow-v2
/// Retrieve App Password after successful initiation of login with Nextcloud login flow v2: https://docs.nextcloud.com/server/latest/developer_manual/client_apis/LoginFlow/index.html#login-flow-v2
Future<AppPasswordResponse> _getAppPassword(
InitiateLoginPollOptions options) async {
Uri baseUrl;

View file

@ -104,20 +104,17 @@ class HomeSearchSuggestionBlocInit extends HomeSearchSuggestionBlocState {
}
class HomeSearchSuggestionBlocLoading extends HomeSearchSuggestionBlocState {
const HomeSearchSuggestionBlocLoading(List<HomeSearchResult> results)
: super(results);
const HomeSearchSuggestionBlocLoading(super.results);
}
class HomeSearchSuggestionBlocSuccess extends HomeSearchSuggestionBlocState {
const HomeSearchSuggestionBlocSuccess(List<HomeSearchResult> results)
: super(results);
const HomeSearchSuggestionBlocSuccess(super.results);
}
@toString
class HomeSearchSuggestionBlocFailure extends HomeSearchSuggestionBlocState {
const HomeSearchSuggestionBlocFailure(
List<HomeSearchTagResult> results, this.exception)
: super(results);
List<HomeSearchTagResult> super.results, this.exception);
@override
String toString() => _$toString();

View file

@ -116,22 +116,17 @@ class ListAlbumShareOutlierBlocInit extends ListAlbumShareOutlierBlocState {
}
class ListAlbumShareOutlierBlocLoading extends ListAlbumShareOutlierBlocState {
const ListAlbumShareOutlierBlocLoading(
Account? account, List<ListAlbumShareOutlierItem> items)
: super(account, items);
const ListAlbumShareOutlierBlocLoading(super.account, super.items);
}
class ListAlbumShareOutlierBlocSuccess extends ListAlbumShareOutlierBlocState {
const ListAlbumShareOutlierBlocSuccess(
Account? account, List<ListAlbumShareOutlierItem> items)
: super(account, items);
const ListAlbumShareOutlierBlocSuccess(super.account, super.items);
}
@toString
class ListAlbumShareOutlierBlocFailure extends ListAlbumShareOutlierBlocState {
const ListAlbumShareOutlierBlocFailure(
Account? account, List<ListAlbumShareOutlierItem> items, this.exception)
: super(account, items);
super.account, super.items, this.exception);
@override
String toString() => _$toString();

View file

@ -58,20 +58,16 @@ class ListImportableAlbumBlocInit extends ListImportableAlbumBlocState {
}
class ListImportableAlbumBlocLoading extends ListImportableAlbumBlocState {
const ListImportableAlbumBlocLoading(List<ListImportableAlbumBlocItem> items)
: super(items);
const ListImportableAlbumBlocLoading(super.items);
}
class ListImportableAlbumBlocSuccess extends ListImportableAlbumBlocState {
const ListImportableAlbumBlocSuccess(List<ListImportableAlbumBlocItem> items)
: super(items);
const ListImportableAlbumBlocSuccess(super.items);
}
@toString
class ListImportableAlbumBlocFailure extends ListImportableAlbumBlocState {
const ListImportableAlbumBlocFailure(
List<ListImportableAlbumBlocItem> items, this.exception)
: super(items);
const ListImportableAlbumBlocFailure(super.items, this.exception);
@override
String toString() => _$toString();

View file

@ -42,19 +42,16 @@ class ListTagBlocInit extends ListTagBlocState {
}
class ListTagBlocLoading extends ListTagBlocState {
const ListTagBlocLoading(Account? account, List<Tag> items)
: super(account, items);
const ListTagBlocLoading(super.account, super.items);
}
class ListTagBlocSuccess extends ListTagBlocState {
const ListTagBlocSuccess(Account? account, List<Tag> items)
: super(account, items);
const ListTagBlocSuccess(super.account, super.items);
}
@toString
class ListTagBlocFailure extends ListTagBlocState {
const ListTagBlocFailure(Account? account, List<Tag> items, this.exception)
: super(account, items);
const ListTagBlocFailure(super.account, super.items, this.exception);
@override
String toString() => _$toString();

View file

@ -106,20 +106,17 @@ class LsDirBlocInit extends LsDirBlocState {
}
class LsDirBlocLoading extends LsDirBlocState {
const LsDirBlocLoading(Account? account, File root, List<LsDirBlocItem> items)
: super(account, root, items);
const LsDirBlocLoading(super.account, super.root, super.items);
}
class LsDirBlocSuccess extends LsDirBlocState {
const LsDirBlocSuccess(Account? account, File root, List<LsDirBlocItem> items)
: super(account, root, items);
const LsDirBlocSuccess(super.account, super.root, super.items);
}
@toString
class LsDirBlocFailure extends LsDirBlocState {
const LsDirBlocFailure(
Account? account, File root, List<LsDirBlocItem> items, this.exception)
: super(account, root, items);
super.account, super.root, super.items, this.exception);
@override
String toString() => _$toString();

View file

@ -54,20 +54,16 @@ class LsTrashbinBlocInit extends LsTrashbinBlocState {
}
class LsTrashbinBlocLoading extends LsTrashbinBlocState {
const LsTrashbinBlocLoading(Account? account, List<File> items)
: super(account, items);
const LsTrashbinBlocLoading(super.account, super.items);
}
class LsTrashbinBlocSuccess extends LsTrashbinBlocState {
const LsTrashbinBlocSuccess(Account? account, List<File> items)
: super(account, items);
const LsTrashbinBlocSuccess(super.account, super.items);
}
@toString
class LsTrashbinBlocFailure extends LsTrashbinBlocState {
const LsTrashbinBlocFailure(
Account? account, List<File> items, this.exception)
: super(account, items);
const LsTrashbinBlocFailure(super.account, super.items, this.exception);
@override
String toString() => _$toString();
@ -78,8 +74,7 @@ class LsTrashbinBlocFailure extends LsTrashbinBlocState {
/// The state of this bloc is inconsistent. This typically means that the data
/// may have been changed externally
class LsTrashbinBlocInconsistent extends LsTrashbinBlocState {
const LsTrashbinBlocInconsistent(Account? account, List<File> items)
: super(account, items);
const LsTrashbinBlocInconsistent(super.account, super.items);
}
@npLog

View file

@ -53,17 +53,16 @@ class ScanLocalDirBlocInit extends ScanLocalDirBlocState {
}
class ScanLocalDirBlocLoading extends ScanLocalDirBlocState {
const ScanLocalDirBlocLoading(List<LocalFile> files) : super(files);
const ScanLocalDirBlocLoading(super.files);
}
class ScanLocalDirBlocSuccess extends ScanLocalDirBlocState {
const ScanLocalDirBlocSuccess(List<LocalFile> files) : super(files);
const ScanLocalDirBlocSuccess(super.files);
}
@toString
class ScanLocalDirBlocFailure extends ScanLocalDirBlocState {
const ScanLocalDirBlocFailure(List<LocalFile> files, this.exception)
: super(files);
const ScanLocalDirBlocFailure(super.files, this.exception);
@override
String toString() => _$toString();

View file

@ -66,22 +66,17 @@ class SearchBlocInit extends SearchBlocState {
}
class SearchBlocLoading extends SearchBlocState {
const SearchBlocLoading(
Account? account, SearchCriteria criteria, List<FileDescriptor> items)
: super(account, criteria, items);
const SearchBlocLoading(super.account, super.criteria, super.items);
}
class SearchBlocSuccess extends SearchBlocState {
const SearchBlocSuccess(
Account? account, SearchCriteria criteria, List<FileDescriptor> items)
: super(account, criteria, items);
const SearchBlocSuccess(super.account, super.criteria, super.items);
}
@toString
class SearchBlocFailure extends SearchBlocState {
const SearchBlocFailure(Account? account, SearchCriteria criteria,
List<FileDescriptor> items, this.exception)
: super(account, criteria, items);
const SearchBlocFailure(
super.account, super.criteria, super.items, this.exception);
@override
String toString() => _$toString();
@ -92,9 +87,7 @@ class SearchBlocFailure extends SearchBlocState {
/// The state of this bloc is inconsistent. This typically means that the data
/// may have been changed externally
class SearchBlocInconsistent extends SearchBlocState {
const SearchBlocInconsistent(
Account? account, SearchCriteria criteria, List<FileDescriptor> items)
: super(account, criteria, items);
const SearchBlocInconsistent(super.account, super.criteria, super.items);
}
@npLog

View file

@ -51,11 +51,11 @@ class SearchSuggestionBlocInit<T> extends SearchSuggestionBlocState<T> {
}
class SearchSuggestionBlocLoading<T> extends SearchSuggestionBlocState<T> {
const SearchSuggestionBlocLoading(List<T> results) : super(results);
const SearchSuggestionBlocLoading(super.results);
}
class SearchSuggestionBlocSuccess<T> extends SearchSuggestionBlocState<T> {
const SearchSuggestionBlocSuccess(List<T> results) : super(results);
const SearchSuggestionBlocSuccess(super.results);
}
@npLog

View file

@ -128,10 +128,10 @@ class AlbumFileItem extends AlbumItem {
@toString
class AlbumLabelItem extends AlbumItem {
AlbumLabelItem({
required CiString addedBy,
required DateTime addedAt,
required super.addedBy,
required super.addedAt,
required this.text,
}) : super(addedBy: addedBy, addedAt: addedAt);
});
factory AlbumLabelItem.fromJson(
JsonObj json, CiString addedBy, DateTime addedAt) {

View file

@ -98,12 +98,9 @@ abstract class AlbumProviderBase extends AlbumProvider {
@ToString(extraParams: r"{bool isDeep = false}")
class AlbumStaticProvider extends AlbumProviderBase {
AlbumStaticProvider({
DateTime? latestItemTime,
super.latestItemTime,
required List<AlbumItem> items,
}) : items = UnmodifiableListView(items),
super(
latestItemTime: latestItemTime,
);
}) : items = UnmodifiableListView(items);
factory AlbumStaticProvider.fromJson(JsonObj json) {
return AlbumStaticProvider(
@ -157,18 +154,16 @@ class AlbumStaticProvider extends AlbumProviderBase {
abstract class AlbumDynamicProvider extends AlbumProviderBase {
AlbumDynamicProvider({
DateTime? latestItemTime,
}) : super(latestItemTime: latestItemTime);
super.latestItemTime,
});
}
@ToString(extraParams: r"{bool isDeep = false}")
class AlbumDirProvider extends AlbumDynamicProvider {
AlbumDirProvider({
required this.dirs,
DateTime? latestItemTime,
}) : super(
latestItemTime: latestItemTime,
);
super.latestItemTime,
});
factory AlbumDirProvider.fromJson(JsonObj json) {
return AlbumDirProvider(
@ -220,8 +215,8 @@ class AlbumDirProvider extends AlbumDynamicProvider {
class AlbumTagProvider extends AlbumDynamicProvider {
AlbumTagProvider({
required this.tags,
DateTime? latestItemTime,
}) : super(latestItemTime: latestItemTime);
super.latestItemTime,
});
factory AlbumTagProvider.fromJson(JsonObj json) => AlbumTagProvider(
latestItemTime: json["latestItemTime"] == null

View file

@ -145,8 +145,8 @@ abstract class AlbumReversibleSortProvider extends AlbumSortProvider {
@toString
class AlbumTimeSortProvider extends AlbumReversibleSortProvider {
const AlbumTimeSortProvider({
required bool isAscending,
}) : super(isAscending: isAscending);
required super.isAscending,
});
factory AlbumTimeSortProvider.fromJson(JsonObj json) {
return AlbumTimeSortProvider(
@ -164,8 +164,8 @@ class AlbumTimeSortProvider extends AlbumReversibleSortProvider {
@toString
class AlbumFilenameSortProvider extends AlbumReversibleSortProvider {
const AlbumFilenameSortProvider({
required bool isAscending,
}) : super(isAscending: isAscending);
required super.isAscending,
});
factory AlbumFilenameSortProvider.fromJson(JsonObj json) {
return AlbumFilenameSortProvider(

View file

@ -30,17 +30,17 @@ abstract class CollectionAdapter {
static CollectionAdapter of(
DiContainer c, Account account, Collection collection) {
switch (collection.contentProvider.runtimeType) {
case CollectionAlbumProvider:
case const (CollectionAlbumProvider):
return CollectionAlbumAdapter(c, account, collection);
case CollectionLocationGroupProvider:
case const (CollectionLocationGroupProvider):
return CollectionLocationGroupAdapter(c, account, collection);
case CollectionMemoryProvider:
case const (CollectionMemoryProvider):
return CollectionMemoryAdapter(c, account, collection);
case CollectionNcAlbumProvider:
case const (CollectionNcAlbumProvider):
return CollectionNcAlbumAdapter(c, account, collection);
case CollectionPersonProvider:
case const (CollectionPersonProvider):
return CollectionPersonAdapter(c, account, collection);
case CollectionTagProvider:
case const (CollectionTagProvider):
return CollectionTagAdapter(c, account, collection);
default:
throw UnsupportedError(

View file

@ -12,9 +12,9 @@ abstract class PersonAdapter {
static PersonAdapter of(DiContainer c, Account account, Person person) {
switch (person.contentProvider.runtimeType) {
case PersonFaceRecognitionProvider:
case const (PersonFaceRecognitionProvider):
return PersonFaceRecognitionAdapter(c, account, person);
case PersonRecognizeProvider:
case const (PersonRecognizeProvider):
return PersonRecognizeAdapter(c, account, person);
default:
throw UnsupportedError(

View file

@ -38,9 +38,9 @@ class Connect extends StatefulWidget {
);
const Connect({
Key? key,
super.key,
required this.account,
}) : super(key: key);
});
Connect.fromArgs(ConnectArguments args, {Key? key})
: this(
@ -248,9 +248,8 @@ class _ConnectState extends State<Connect> {
class _WebDavUrlDialog extends StatefulWidget {
const _WebDavUrlDialog({
Key? key,
required this.account,
}) : super(key: key);
});
@override
createState() => _WebDavUrlDialogState();

View file

@ -25,9 +25,7 @@ part 'sign_in.g.dart';
class SignIn extends StatefulWidget {
static const routeName = "/sign-in-legacy";
const SignIn({
Key? key,
}) : super(key: key);
const SignIn({super.key});
@override
createState() => _SignInState();

View file

@ -2,9 +2,7 @@ import 'package:flutter/material.dart';
import 'package:nc_photos/app_localizations.dart';
class AboutGeocodingDialog extends StatelessWidget {
const AboutGeocodingDialog({
Key? key,
}) : super(key: key);
const AboutGeocodingDialog({super.key});
@override
build(BuildContext context) {

View file

@ -28,9 +28,9 @@ class AlbumDirPicker extends StatefulWidget {
);
const AlbumDirPicker({
Key? key,
super.key,
required this.account,
}) : super(key: key);
});
AlbumDirPicker.fromArgs(AlbumDirPickerArguments args, {Key? key})
: this(

View file

@ -42,9 +42,9 @@ class AlbumImporter extends StatefulWidget {
);
const AlbumImporter({
Key? key,
super.key,
required this.account,
}) : super(key: key);
});
AlbumImporter.fromArgs(AlbumImporterArguments args, {Key? key})
: this(

View file

@ -40,10 +40,10 @@ class AlbumShareOutlierBrowser extends StatefulWidget {
);
const AlbumShareOutlierBrowser({
Key? key,
super.key,
required this.account,
required this.album,
}) : super(key: key);
});
AlbumShareOutlierBrowser.fromArgs(AlbumShareOutlierBrowserArguments args,
{Key? key})

View file

@ -59,8 +59,7 @@ class BorderSideTween extends Tween<BorderSide?> {
/// The [begin] and [end] properties must be non-null before the tween is
/// first used, but the arguments can be null if the values are going to be
/// filled in later.
BorderSideTween({BorderSide? begin, BorderSide? end})
: super(begin: begin, end: end);
BorderSideTween({super.begin, super.end});
/// Returns the value this variable has at the given animation clock value.
@override

View file

@ -34,9 +34,9 @@ class Changelog extends StatelessWidget {
_changelogs.keys.first > fromVersion;
const Changelog({
Key? key,
super.key,
this.fromVersion,
}) : super(key: key);
});
Changelog.fromArgs(ChangelogArguments args, {Key? key})
: this(

View file

@ -2,13 +2,13 @@ import 'package:flutter/material.dart';
class CollectionGridItem extends StatelessWidget {
const CollectionGridItem({
Key? key,
super.key,
required this.cover,
required this.title,
this.subtitle,
this.subtitle2,
this.icon,
}) : super(key: key);
});
@override
Widget build(BuildContext context) {

View file

@ -39,9 +39,9 @@ class Connect extends StatefulWidget {
);
const Connect({
Key? key,
super.key,
required this.uri,
}) : super(key: key);
});
Connect.fromArgs(ConnectArguments args, {Key? key})
: this(
@ -303,9 +303,8 @@ class _ConnectState extends State<Connect> {
class _WebDavUrlDialog extends StatefulWidget {
const _WebDavUrlDialog({
Key? key,
required this.account,
}) : super(key: key);
});
@override
createState() => _WebDavUrlDialogState();

View file

@ -5,10 +5,10 @@ import 'package:flutter/material.dart';
/// Scaffold is needed for [SnackBar] to show correctly on top of a dialog
class DialogScaffold extends StatelessWidget {
const DialogScaffold({
Key? key,
super.key,
required this.body,
this.canPop = true,
}) : super(key: key);
});
@override
build(BuildContext context) {

View file

@ -21,14 +21,14 @@ part 'dir_picker.g.dart';
class DirPicker extends StatefulWidget {
const DirPicker({
Key? key,
super.key,
required this.account,
required this.strippedRootDir,
this.initialPicks,
this.isMultipleSelections = true,
this.validator,
this.onConfirmed,
}) : super(key: key);
});
@override
createState() => DirPickerState();

View file

@ -7,7 +7,7 @@ part 'draggable.g.dart';
@npLog
class Draggable<T extends Object> extends StatelessWidget {
const Draggable({
Key? key,
super.key,
required this.data,
required this.child,
this.feedback,
@ -16,7 +16,7 @@ class Draggable<T extends Object> extends StatelessWidget {
this.onDragStarted,
this.onDragEndedAny,
this.feedbackSize,
}) : super(key: key);
});
@override
build(BuildContext context) {

View file

@ -3,10 +3,10 @@ import 'package:flutter/widgets.dart';
class EmptyListIndicator extends StatelessWidget {
const EmptyListIndicator({
Key? key,
super.key,
required this.icon,
required this.text,
}) : super(key: key);
});
@override
build(BuildContext context) {

View file

@ -48,9 +48,9 @@ class EnhancedPhotoBrowser extends StatefulWidget {
);
const EnhancedPhotoBrowser({
Key? key,
super.key,
required this.filename,
}) : super(key: key);
});
EnhancedPhotoBrowser.fromArgs(EnhancedPhotoBrowserArguments args, {Key? key})
: this(

View file

@ -41,9 +41,9 @@ class Home extends StatefulWidget {
);
const Home({
Key? key,
super.key,
required this.account,
}) : super(key: key);
});
Home.fromArgs(HomeArguments args, {Key? key})
: this(

View file

@ -13,13 +13,13 @@ import 'package:np_ui/np_ui.dart';
/// AppBar for home screens
class HomeSliverAppBar extends StatelessWidget {
const HomeSliverAppBar({
Key? key,
super.key,
required this.account,
this.actions,
this.menuActions,
this.onSelectedMenuActions,
this.isShowProgressIcon = false,
}) : super(key: key);
});
@override
Widget build(BuildContext context) {

View file

@ -44,9 +44,9 @@ part 'home_search.g.dart';
class HomeSearch extends StatefulWidget {
const HomeSearch({
Key? key,
super.key,
required this.account,
}) : super(key: key);
});
@override
createState() => _HomeSearchState();
@ -609,10 +609,9 @@ extension on SearchFileType {
class _FilterBubbleList extends StatelessWidget {
const _FilterBubbleList({
Key? key,
required this.filters,
this.onEditPressed,
}) : super(key: key);
});
@override
build(BuildContext context) {
@ -681,9 +680,8 @@ class _FilterBubbleList extends StatelessWidget {
class _FilterEditDialog extends StatefulWidget {
const _FilterEditDialog({
Key? key,
required this.searchState,
}) : super(key: key);
});
@override
createState() => _FilterEditDialogState();
@ -763,14 +761,13 @@ class _FilterEditFormValue {
class _FilterDropdown<T> extends StatefulWidget {
const _FilterDropdown({
Key? key,
required this.label,
required this.items,
required this.itemStringifier,
this.initialValue,
this.onValueChanged,
this.onSaved,
}) : super(key: key);
});
@override
createState() => _FilterDropdownState<T>();

View file

@ -30,10 +30,10 @@ class HomeSearchSuggestionController {
class HomeSearchSuggestion extends StatefulWidget {
const HomeSearchSuggestion({
Key? key,
super.key,
required this.account,
required this.controller,
}) : super(key: key);
});
@override
createState() => _HomeSearchSuggestionState();

View file

@ -6,7 +6,7 @@ import 'package:np_platform_util/np_platform_util.dart';
class HorizontalPageViewer extends StatefulWidget {
HorizontalPageViewer({
Key? key,
super.key,
this.pageCount,
required this.pageBuilder,
this.initialPage = 0,
@ -14,8 +14,7 @@ class HorizontalPageViewer extends StatefulWidget {
this.viewportFraction = 1,
this.canSwitchPage = true,
this.onPageChanged,
}) : controller = controller ?? HorizontalPageViewerController(),
super(key: key);
}) : controller = controller ?? HorizontalPageViewerController();
@override
createState() => _HorizontalPageViewerState();
@ -91,8 +90,7 @@ class _HorizontalPageViewerState extends State<HorizontalPageViewer> {
controller: widget.controller._pageController,
itemCount: widget.pageCount,
itemBuilder: widget.pageBuilder,
physics:
getRawPlatform() != NpPlatform.web && widget.canSwitchPage
physics: getRawPlatform() != NpPlatform.web && widget.canSwitchPage
? null
: const NeverScrollableScrollPhysics(),
),

View file

@ -41,10 +41,10 @@ class ImageEditor extends StatefulWidget {
);
const ImageEditor({
Key? key,
super.key,
required this.account,
required this.file,
}) : super(key: key);
});
ImageEditor.fromArgs(ImageEditorArguments args, {Key? key})
: this(
@ -351,12 +351,11 @@ enum _ToolType {
class _ToolButton extends StatelessWidget {
const _ToolButton({
Key? key,
required this.icon,
required this.label,
required this.onPressed,
this.isSelected = false,
}) : super(key: key);
});
@override
build(BuildContext context) {

View file

@ -25,10 +25,10 @@ abstract class ColorArguments {
class ColorToolbar extends StatefulWidget {
const ColorToolbar({
Key? key,
super.key,
required this.initialState,
required this.onActiveFiltersChanged,
}) : super(key: key);
});
@override
createState() => _ColorToolbarState();

View file

@ -15,11 +15,11 @@ part 'crop_controller.g.dart';
/// This widget only work when width == device width!
class CropController extends StatelessWidget {
const CropController({
Key? key,
super.key,
required this.image,
required this.initialState,
this.onCropChanged,
}) : super(key: key);
});
@override
Widget build(BuildContext context) {
@ -41,11 +41,10 @@ class CropController extends StatelessWidget {
class _WrappedCropController extends StatefulWidget {
const _WrappedCropController({
Key? key,
required this.image,
required this.initialState,
this.onCropChanged,
}) : super(key: key);
});
@override
State<StatefulWidget> createState() => _WrappedCropControllerState();
@ -429,7 +428,7 @@ class _WrappedCropControllerState extends State<_WrappedCropController> {
class _TouchDot extends StatelessWidget {
static const double size = 24;
const _TouchDot({Key? key}) : super(key: key);
const _TouchDot();
@override
build(BuildContext context) {

View file

@ -9,13 +9,13 @@ import 'package:np_ui/np_ui.dart';
/// current order.
class ToolbarButton extends StatelessWidget {
const ToolbarButton({
Key? key,
super.key,
required this.icon,
required this.label,
required this.onPressed,
this.isSelected = false,
this.activationOrder,
}) : super(key: key);
});
@override
build(BuildContext context) {

View file

@ -16,12 +16,12 @@ abstract class TransformArguments {
class TransformToolbar extends StatefulWidget {
const TransformToolbar({
Key? key,
super.key,
required this.initialState,
required this.onActiveFiltersChanged,
required this.isCropModeChanged,
required this.onCropToolDeactivated,
}) : super(key: key);
});
@override
createState() => _TransformToolbarState();
@ -243,11 +243,10 @@ class _OrientationArguments implements TransformArguments {
class _OrientationButton extends StatelessWidget {
const _OrientationButton({
Key? key,
required this.label,
required this.onPressed,
this.isSelected = false,
}) : super(key: key);
});
@override
build(BuildContext context) {

View file

@ -871,9 +871,7 @@ class _StylePickerResult {
}
class _StylePicker extends StatefulWidget {
const _StylePicker({
Key? key,
}) : super(key: key);
const _StylePicker();
@override
createState() => _StylePickerState();

View file

@ -20,14 +20,14 @@ part 'image_viewer.g.dart';
class LocalImageViewer extends StatefulWidget {
const LocalImageViewer({
Key? key,
super.key,
required this.file,
required this.canZoom,
this.onLoaded,
this.onHeightChanged,
this.onZoomStarted,
this.onZoomEnded,
}) : super(key: key);
});
@override
createState() => _LocalImageViewerState();
@ -82,7 +82,7 @@ class _LocalImageViewerState extends State<LocalImageViewer> {
class RemoteImageViewer extends StatefulWidget {
const RemoteImageViewer({
Key? key,
super.key,
required this.account,
required this.file,
required this.canZoom,
@ -90,7 +90,7 @@ class RemoteImageViewer extends StatefulWidget {
this.onHeightChanged,
this.onZoomStarted,
this.onZoomEnded,
}) : super(key: key);
});
@override
createState() => _RemoteImageViewerState();
@ -214,13 +214,12 @@ class _RemoteImageViewerState extends State<RemoteImageViewer> {
class _ImageViewer extends StatefulWidget {
const _ImageViewer({
Key? key,
required this.child,
required this.canZoom,
this.onHeightChanged,
this.onZoomStarted,
this.onZoomEnded,
}) : super(key: key);
});
@override
createState() => _ImageViewerState();

View file

@ -10,9 +10,9 @@ import 'package:flutter/widgets.dart';
/// than 1 line
class ListTileCenterLeading extends StatelessWidget {
const ListTileCenterLeading({
Key? key,
super.key,
required this.child,
}) : super(key: key);
});
@override
build(BuildContext context) => SizedBox(

View file

@ -30,10 +30,10 @@ class LocalFileViewer extends StatefulWidget {
);
const LocalFileViewer({
Key? key,
super.key,
required this.streamFiles,
required this.startIndex,
}) : super(key: key);
});
LocalFileViewer.fromArgs(LocalFileViewerArguments args, {Key? key})
: this(

View file

@ -13,14 +13,14 @@ abstract class MeasurableItemListState {
class MeasurableItemList extends StatefulWidget {
const MeasurableItemList({
Key? key,
super.key,
required this.maxCrossAxisExtent,
required this.itemCount,
required this.itemBuilder,
required this.staggeredTileBuilder,
this.mainAxisSpacing = 0,
this.onMaxExtentChanged,
}) : super(key: key);
});
@override
createState() => _MeasurableItemListState();
@ -137,7 +137,7 @@ class _MeasurableItemListState extends State<MeasurableItemList>
}
class _GridKey extends GlobalObjectKey {
const _GridKey(Object value) : super(value);
const _GridKey(super.value);
@override
operator ==(Object other) {

View file

@ -8,10 +8,10 @@ class MeasureSize extends SingleChildRenderObjectWidget {
final OnWidgetSizeChanged onChange;
const MeasureSize({
Key? key,
super.key,
required this.onChange,
required Widget child,
}) : super(key: key, child: child);
required Widget super.child,
});
@override
RenderObject createRenderObject(BuildContext context) {
@ -41,10 +41,10 @@ class _MeasureSizeRenderObject extends RenderProxyBox {
class SliverMeasureExtent extends SingleChildRenderObjectWidget {
const SliverMeasureExtent({
Key? key,
super.key,
required this.onChange,
required Widget child,
}) : super(key: key, child: child);
required Widget super.child,
});
@override
RenderObject createRenderObject(BuildContext context) {

View file

@ -4,7 +4,7 @@ import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
// ignore: must_be_immutable
class MeasurableSliverStaggeredGrid extends SliverStaggeredGrid {
MeasurableSliverStaggeredGrid.extentBuilder({
Key? key,
super.key,
required double maxCrossAxisExtent,
required IndexedStaggeredTileBuilder staggeredTileBuilder,
required IndexedWidgetBuilder itemBuilder,
@ -12,7 +12,6 @@ class MeasurableSliverStaggeredGrid extends SliverStaggeredGrid {
double mainAxisSpacing = 0,
double crossAxisSpacing = 0,
}) : super(
key: key,
gridDelegate: SliverStaggeredGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: maxCrossAxisExtent,
mainAxisSpacing: mainAxisSpacing,
@ -42,9 +41,9 @@ class MeasurableSliverStaggeredGrid extends SliverStaggeredGrid {
class RenderMeasurableSliverStaggeredGrid extends RenderSliverStaggeredGrid
with WidgetsBindingObserver {
RenderMeasurableSliverStaggeredGrid({
required RenderSliverVariableSizeBoxChildManager childManager,
required SliverStaggeredGridDelegate gridDelegate,
}) : super(childManager: childManager, gridDelegate: gridDelegate);
required super.childManager,
required super.gridDelegate,
});
/// Calculate the height of this staggered grid view
///

View file

@ -8,9 +8,9 @@ part 'photo_date_time_edit_dialog.g.dart';
class PhotoDateTimeEditDialog extends StatefulWidget {
const PhotoDateTimeEditDialog({
Key? key,
super.key,
required this.initialDateTime,
}) : super(key: key);
});
@override
createState() => _PhotoDateTimeEditDialogState();

View file

@ -48,16 +48,12 @@ abstract class PhotoListFileItem extends SelectableItem {
class PhotoListImageItem extends PhotoListFileItem {
const PhotoListImageItem({
required int fileIndex,
required FileDescriptor file,
required super.fileIndex,
required super.file,
required this.account,
required this.previewUrl,
required bool shouldShowFavoriteBadge,
}) : super(
fileIndex: fileIndex,
file: file,
shouldShowFavoriteBadge: shouldShowFavoriteBadge,
);
required super.shouldShowFavoriteBadge,
});
@override
Widget buildWidget(BuildContext context) => PhotoListImage(
@ -74,16 +70,12 @@ class PhotoListImageItem extends PhotoListFileItem {
class PhotoListVideoItem extends PhotoListFileItem {
const PhotoListVideoItem({
required int fileIndex,
required FileDescriptor file,
required super.fileIndex,
required super.file,
required this.account,
required this.previewUrl,
required bool shouldShowFavoriteBadge,
}) : super(
fileIndex: fileIndex,
file: file,
shouldShowFavoriteBadge: shouldShowFavoriteBadge,
);
required super.shouldShowFavoriteBadge,
});
@override
buildWidget(BuildContext context) => PhotoListVideo(
@ -146,12 +138,9 @@ abstract class PhotoListLocalFileItem extends SelectableItem {
class PhotoListLocalImageItem extends PhotoListLocalFileItem {
const PhotoListLocalImageItem({
required int fileIndex,
required LocalFile file,
}) : super(
fileIndex: fileIndex,
file: file,
);
required super.fileIndex,
required super.file,
});
@override
buildWidget(BuildContext context) {
@ -209,14 +198,14 @@ class PhotoListLocalImageItem extends PhotoListLocalFileItem {
class PhotoListImage extends StatelessWidget {
const PhotoListImage({
Key? key,
super.key,
required this.account,
required this.previewUrl,
this.padding = const EdgeInsets.all(2),
this.isGif = false,
this.isFavorite = false,
this.heroKey,
}) : super(key: key);
});
@override
Widget build(BuildContext context) {
@ -285,11 +274,11 @@ class PhotoListImage extends StatelessWidget {
class PhotoListVideo extends StatelessWidget {
const PhotoListVideo({
Key? key,
super.key,
required this.account,
required this.previewUrl,
this.isFavorite = false,
}) : super(key: key);
});
@override
Widget build(BuildContext context) {
@ -337,9 +326,9 @@ class PhotoListVideo extends StatelessWidget {
class PhotoListLabel extends StatelessWidget {
const PhotoListLabel({
Key? key,
super.key,
required this.text,
}) : super(key: key);
});
@override
build(BuildContext context) {
@ -360,10 +349,10 @@ class PhotoListLabel extends StatelessWidget {
class PhotoListLabelEdit extends PhotoListLabel {
const PhotoListLabelEdit({
Key? key,
required String text,
super.key,
required super.text,
required this.onEditPressed,
}) : super(key: key, text: text);
});
@override
build(BuildContext context) {

View file

@ -2,9 +2,9 @@ import 'package:flutter/material.dart';
class ProcessingDialog extends StatelessWidget {
const ProcessingDialog({
Key? key,
super.key,
required this.text,
}) : super(key: key);
});
@override
build(BuildContext context) {

View file

@ -32,9 +32,9 @@ class RootPicker extends StatefulWidget {
);
const RootPicker({
Key? key,
super.key,
required this.account,
}) : super(key: key);
});
RootPicker.fromArgs(RootPickerArguments args, {Key? key})
: this(

View file

@ -5,7 +5,7 @@ import 'package:nc_photos/widget/animated_smooth_clip_r_rect.dart';
// Overlay a check mark if an item is selected
class Selectable extends StatelessWidget {
const Selectable({
Key? key,
super.key,
required this.child,
this.isSelected = false,
required this.iconSize,
@ -14,7 +14,7 @@ class Selectable extends StatelessWidget {
this.indicatorAlignment = Alignment.topLeft,
this.onTap,
this.onLongPress,
}) : super(key: key);
});
@override
build(BuildContext context) {

View file

@ -3,11 +3,11 @@ import 'package:nc_photos/app_localizations.dart';
class SelectionAppBar extends StatelessWidget {
const SelectionAppBar({
Key? key,
super.key,
required this.count,
this.onClosePressed,
this.actions,
}) : super(key: key);
});
@override
build(BuildContext context) {

View file

@ -171,11 +171,10 @@ class _WrappedEnhancementSettingsState
class _SizeSlider extends StatefulWidget {
const _SizeSlider({
Key? key,
required this.initialWidth,
required this.initialHeight,
this.onChanged,
}) : super(key: key);
});
@override
createState() => _SizeSliderState();

View file

@ -505,7 +505,6 @@ class _PresetItem {
/// Based on the original HueRingPicker
class _HueRingPicker extends StatefulWidget {
const _HueRingPicker({
Key? key,
required this.pickerColor,
required this.onColorChanged,
// ignore: unused_element
@ -516,7 +515,7 @@ class _HueRingPicker extends StatefulWidget {
this.displayThumbColor = true,
// ignore: unused_element
this.pickerAreaBorderRadius = const BorderRadius.all(Radius.zero),
}) : super(key: key);
});
final Color pickerColor;
final ValueChanged<Color> onColorChanged;

View file

@ -11,9 +11,7 @@ bool isNeedSetup() => Pref().getSetupProgressOr() & _PageId.all != _PageId.all;
class Setup extends StatefulWidget {
static const routeName = "/setup";
const Setup({
Key? key,
}) : super(key: key);
const Setup({super.key});
@override
createState() => _SetupState();

View file

@ -29,10 +29,10 @@ class ShareFolderPicker extends StatefulWidget {
);
const ShareFolderPicker({
Key? key,
super.key,
required this.account,
required this.initialValue,
}) : super(key: key);
});
ShareFolderPicker.fromArgs(ShareFolderPickerArguments args, {Key? key})
: this(

View file

@ -14,9 +14,9 @@ class ShareLinkMultipleFilesDialogResult {
class ShareLinkMultipleFilesDialog extends StatefulWidget {
const ShareLinkMultipleFilesDialog({
Key? key,
super.key,
this.shouldAskPassword = false,
}) : super(key: key);
});
@override
createState() => _ShareLinkMultipleFilesDialogState();

View file

@ -5,9 +5,7 @@ import 'package:nc_photos/help_utils.dart' as help_utils;
import 'package:nc_photos/url_launcher_util.dart';
class SharedAlbumInfoDialog extends StatefulWidget {
const SharedAlbumInfoDialog({
Key? key,
}) : super(key: key);
const SharedAlbumInfoDialog({super.key});
@override
createState() => _SharedAlbumInfoDialogState();

View file

@ -44,11 +44,11 @@ class SharedFileViewer extends StatefulWidget {
);
const SharedFileViewer({
Key? key,
super.key,
required this.account,
required this.file,
required this.shares,
}) : super(key: key);
});
SharedFileViewer.fromArgs(SharedFileViewerArguments args, {Key? key})
: this(

View file

@ -24,9 +24,7 @@ part 'sign_in.g.dart';
class SignIn extends StatefulWidget {
static const routeName = "/sign-in";
const SignIn({
Key? key,
}) : super(key: key);
const SignIn({super.key});
@override
createState() => _SignInState();

View file

@ -2,14 +2,14 @@ import 'package:flutter/material.dart';
class SimpleInputDialog extends StatefulWidget {
const SimpleInputDialog({
Key? key,
super.key,
required this.buttonText,
this.titleText,
this.initialText,
this.hintText,
this.validator,
this.obscureText = false,
}) : super(key: key);
});
@override
createState() => _SimpleInputDialogState();

View file

@ -37,12 +37,12 @@ class SlideshowConfig {
class SlideshowDialog extends StatefulWidget {
const SlideshowDialog({
Key? key,
super.key,
required this.duration,
required this.isShuffle,
required this.isRepeat,
required this.isReverse,
}) : super(key: key);
});
@override
createState() => _SlideshowDialogState();

View file

@ -42,12 +42,12 @@ class SlideshowViewer extends StatefulWidget {
);
const SlideshowViewer({
Key? key,
super.key,
required this.account,
required this.streamFiles,
required this.startIndex,
required this.config,
}) : super(key: key);
});
SlideshowViewer.fromArgs(SlideshowViewerArguments args, {Key? key})
: this(

View file

@ -31,9 +31,7 @@ part 'splash.g.dart';
class Splash extends StatefulWidget {
static const routeName = "/splash";
const Splash({
Key? key,
}) : super(key: key);
const Splash({super.key});
@override
createState() => _SplashState();

View file

@ -15,9 +15,9 @@ import 'package:np_string/np_string.dart';
class TagPickerDialog extends StatefulWidget {
const TagPickerDialog({
Key? key,
super.key,
required this.account,
}) : super(key: key);
});
@override
createState() => _TagPickerDialogState();

View file

@ -50,9 +50,9 @@ class TrashbinBrowser extends StatefulWidget {
);
const TrashbinBrowser({
Key? key,
super.key,
required this.account,
}) : super(key: key);
});
TrashbinBrowser.fromArgs(TrashbinBrowserArguments args, {Key? key})
: this(

View file

@ -40,11 +40,11 @@ class TrashbinViewer extends StatefulWidget {
);
const TrashbinViewer({
Key? key,
super.key,
required this.account,
required this.streamFiles,
required this.startIndex,
}) : super(key: key);
});
TrashbinViewer.fromArgs(TrashbinViewerArguments args, {Key? key})
: this(

View file

@ -25,7 +25,7 @@ part 'video_viewer.g.dart';
class VideoViewer extends StatefulWidget {
const VideoViewer({
Key? key,
super.key,
required this.account,
required this.file,
this.onLoaded,
@ -36,7 +36,7 @@ class VideoViewer extends StatefulWidget {
this.isControlVisible = false,
this.canPlay = true,
this.canLoop = true,
}) : super(key: key);
});
@override
createState() => _VideoViewerState();

View file

@ -76,12 +76,12 @@ class Viewer extends StatefulWidget {
);
const Viewer({
Key? key,
super.key,
required this.account,
required this.streamFiles,
required this.startIndex,
this.fromCollection,
}) : super(key: key);
});
Viewer.fromArgs(ViewerArguments args, {Key? key})
: this(

View file

@ -5,9 +5,9 @@ import 'package:flutter/material.dart';
/// Buttons are spread evenly across the horizontal axis
class ViewerBottomAppBar extends StatelessWidget {
const ViewerBottomAppBar({
Key? key,
super.key,
required this.children,
}) : super(key: key);
});
@override
build(BuildContext context) {

View file

@ -53,7 +53,7 @@ class ViewerSingleCollectionData {
class ViewerDetailPane extends StatefulWidget {
const ViewerDetailPane({
Key? key,
super.key,
required this.account,
required this.fd,
this.fromCollection,
@ -62,7 +62,7 @@ class ViewerDetailPane extends StatefulWidget {
required this.onUnarchivePressed,
required this.onDeletePressed,
this.onSlideshowPressed,
}) : super(key: key);
});
@override
createState() => _ViewerDetailPaneState();
@ -529,11 +529,10 @@ class _ViewerDetailPaneState extends State<ViewerDetailPane> {
class _DetailPaneButton extends StatelessWidget {
const _DetailPaneButton({
Key? key,
required this.icon,
required this.label,
required this.onPressed,
}) : super(key: key);
});
@override
build(BuildContext context) {

View file

@ -3,12 +3,12 @@ import 'package:nc_photos/app_localizations.dart';
class ZoomMenuButton extends StatelessWidget {
const ZoomMenuButton({
Key? key,
super.key,
required this.initialZoom,
required this.minZoom,
required this.maxZoom,
this.onZoomChanged,
}) : super(key: key);
});
@override
build(BuildContext context) {
@ -34,12 +34,11 @@ class ZoomMenuButton extends StatelessWidget {
class _PopupMenuZoom extends PopupMenuEntry<void> {
const _PopupMenuZoom({
Key? key,
required this.initialValue,
required this.minValue,
required this.maxValue,
this.onChanged,
}) : super(key: key);
});
@override
represents(void value) => false;

View file

@ -220,7 +220,7 @@ extension on Rational {
}
class _Rational extends Rational with EquatableMixin {
_Rational(int numerator, int denominator) : super(numerator, denominator);
_Rational(super.numerator, super.denominator);
factory _Rational.of(Rational r) {
return _Rational(r.numerator, r.denominator);

View file

@ -31,7 +31,7 @@ void main() {
}
class _TestWidget extends StatefulWidget {
const _TestWidget(this.manager, {Key? key}) : super(key: key);
const _TestWidget(this.manager);
@override
createState() => _TestWidgetState();

View file

@ -2,24 +2,18 @@ import 'package:flutter/material.dart';
class SwitchFormField extends FormField<bool> {
SwitchFormField({
Key? key,
required bool initialValue,
super.key,
required bool super.initialValue,
Widget? title,
Widget? subtitle,
Widget? subtitleTrue,
Widget? subtitleFalse,
bool? dense,
FormFieldSetter<bool>? onSaved,
FormFieldValidator<bool>? validator,
bool enabled = true,
AutovalidateMode? autovalidateMode,
super.onSaved,
super.validator,
super.enabled,
super.autovalidateMode,
}) : super(
key: key,
onSaved: onSaved,
validator: validator,
initialValue: initialValue,
enabled: enabled,
autovalidateMode: autovalidateMode,
builder: (field) {
final value = field.value ?? initialValue;
return SwitchListTile(

View file

@ -4,13 +4,13 @@ import 'package:np_ui/src/material3.dart';
/// A [ListTile]-like widget with unbounded height
class UnboundedListTile extends StatelessWidget {
const UnboundedListTile({
Key? key,
super.key,
this.leading,
required this.title,
this.subtitle,
this.trailing,
this.onTap,
}) : super(key: key);
});
@override
Widget build(BuildContext context) {