Browse Source

fix(dynamite,neon_files,neon_news,neon_lints): fix lints

Signed-off-by: Nikolas Rimikis <rimikis.nikolas@gmail.com>
pull/576/head
Nikolas Rimikis 1 year ago
parent
commit
19b3b9260c
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 11
      packages/dynamite/dynamite/lib/src/openapi_builder.dart
  2. 3
      packages/dynamite/dynamite/lib/src/type_result/base.dart
  3. 2
      packages/dynamite/dynamite/lib/src/type_result/enum.dart
  4. 2
      packages/dynamite/dynamite/lib/src/type_result/list.dart
  5. 2
      packages/dynamite/dynamite/lib/src/type_result/map.dart
  6. 7
      packages/neon/neon_files/lib/widgets/actions.dart
  7. 9
      packages/neon/neon_news/lib/blocs/articles.dart
  8. 3
      packages/neon/neon_news/lib/widgets/articles_view.dart
  9. 4
      packages/neon/neon_news/lib/widgets/feeds_view.dart
  10. 2
      packages/neon/neon_news/lib/widgets/folders_view.dart

11
packages/dynamite/dynamite/lib/src/openapi_builder.dart

@ -477,17 +477,14 @@ class OpenAPIBuilder implements Builder {
code.write(
"path = path.replaceAll('{${parameter.name}}', Uri.encodeQueryComponent($value));",
);
break;
case 'query':
code.write(
"queryParameters['${parameter.name}'] = $value;",
);
break;
case 'header':
code.write(
"headers['${parameter.name}'] = $value;",
);
break;
default:
throw Exception('Can not work with parameter in "${parameter.in_}"');
}
@ -549,7 +546,6 @@ class OpenAPIBuilder implements Builder {
if (dartParameterNullable) {
code.write('}');
}
break;
default:
throw Exception('Can not parse mime type "$mimeType"');
}
@ -1547,19 +1543,16 @@ TypeResult resolveType(
'bool',
nullable: nullable,
);
break;
case 'integer':
result = TypeResultBase(
'int',
nullable: nullable,
);
break;
case 'number':
result = TypeResultBase(
'num',
nullable: nullable,
);
break;
case 'string':
switch (schema.format) {
case 'binary':
@ -1567,14 +1560,12 @@ TypeResult resolveType(
'Uint8List',
nullable: nullable,
);
break;
}
result = TypeResultBase(
'String',
nullable: nullable,
);
break;
case 'array':
if (schema.items != null) {
final subResult = resolveType(
@ -1596,7 +1587,6 @@ TypeResult resolveType(
nullable: nullable,
);
}
break;
case 'object':
if (schema.properties == null) {
if (schema.additionalProperties != null) {
@ -1645,7 +1635,6 @@ TypeResult resolveType(
schema,
nullable: nullable,
);
break;
}
}

3
packages/dynamite/dynamite/lib/src/type_result/base.dart

@ -3,7 +3,7 @@ part of 'type_result.dart';
@immutable
class TypeResultBase extends TypeResult {
TypeResultBase(
super.name, {
super.className, {
super.nullable,
});
@ -47,7 +47,6 @@ class TypeResultBase extends TypeResult {
switch (name) {
case 'JsonObject':
dartName = 'dynamic';
break;
default:
dartName = name;
}

2
packages/dynamite/dynamite/lib/src/type_result/enum.dart

@ -3,7 +3,7 @@ part of 'type_result.dart';
@immutable
class TypeResultEnum extends TypeResult {
TypeResultEnum(
super.name,
super.className,
this.subType, {
super.nullable,
});

2
packages/dynamite/dynamite/lib/src/type_result/list.dart

@ -3,7 +3,7 @@ part of 'type_result.dart';
@immutable
class TypeResultList extends TypeResult {
TypeResultList(
super.name,
super.className,
final TypeResult subType, {
super.nullable,
}) : super(generics: [subType]);

2
packages/dynamite/dynamite/lib/src/type_result/map.dart

@ -3,7 +3,7 @@ part of 'type_result.dart';
@immutable
class TypeResultMap extends TypeResult {
TypeResultMap(
super.name,
super.className,
final TypeResult subType, {
super.nullable,
}) : super(generics: [TypeResultBase('String'), subType]);

7
packages/neon/neon_files/lib/widgets/actions.dart

@ -23,7 +23,6 @@ class FileActions extends StatelessWidget {
} else {
bloc.addFavorite(details.path);
}
break;
case FilesFileAction.details:
await Navigator.of(context).push(
MaterialPageRoute(
@ -33,7 +32,6 @@ class FileActions extends StatelessWidget {
),
),
);
break;
case FilesFileAction.rename:
final result = await showRenameDialog(
context: context,
@ -44,7 +42,6 @@ class FileActions extends StatelessWidget {
if (result != null) {
bloc.rename(details.path, result);
}
break;
case FilesFileAction.move:
final b = bloc.getNewFilesBrowserBloc();
final originalPath = details.path.sublist(0, details.path.length - 1);
@ -61,7 +58,6 @@ class FileActions extends StatelessWidget {
if (result != null) {
bloc.move(details.path, result..add(details.name));
}
break;
case FilesFileAction.copy:
final b = bloc.getNewFilesBrowserBloc();
final originalPath = details.path.sublist(0, details.path.length - 1);
@ -78,7 +74,6 @@ class FileActions extends StatelessWidget {
if (result != null) {
bloc.copy(details.path, result..add(details.name));
}
break;
case FilesFileAction.sync:
final sizeWarning = browserBloc.options.downloadSizeWarning.value;
if (sizeWarning != null && details.size != null && details.size! > sizeWarning) {
@ -93,7 +88,6 @@ class FileActions extends StatelessWidget {
}
}
bloc.syncFile(details.path);
break;
case FilesFileAction.delete:
if (await showConfirmationDialog(
context,
@ -103,7 +97,6 @@ class FileActions extends StatelessWidget {
)) {
bloc.delete(details.path);
}
break;
}
}

9
packages/neon/neon_news/lib/blocs/articles.dart

@ -31,7 +31,7 @@ abstract class NewsArticlesBlocStates {
class NewsMainArticlesBloc extends NewsArticlesBloc {
NewsMainArticlesBloc(
super.newsBloc,
super._newsBloc,
super.options,
super.requestManager,
super.account,
@ -98,7 +98,6 @@ class NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBlocEvents
break;
case FilterType.unread:
getRead = false;
break;
default:
throw Exception('FilterType ${filterType.value} not allowed');
}
@ -106,23 +105,17 @@ class NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBlocEvents
switch (listType) {
case ListType.feed:
type = NewsListType.feed;
break;
case ListType.folder:
type = NewsListType.folder;
break;
case null:
switch (filterType.value) {
case FilterType.starred:
type = NewsListType.starred;
break;
case FilterType.all:
type = NewsListType.allItems;
break;
case FilterType.unread:
type = NewsListType.unread;
break;
}
break;
}
await requestManager.wrapNextcloud<List<NewsArticle>, NewsListArticles>(

3
packages/neon/neon_news/lib/widgets/articles_view.dart

@ -70,13 +70,10 @@ class _NewsArticlesViewState extends State<NewsArticlesView> {
switch (a) {
case FilterType.all:
label = AppLocalizations.of(context).articlesFilterAll;
break;
case FilterType.unread:
label = AppLocalizations.of(context).articlesFilterUnread;
break;
case FilterType.starred:
label = AppLocalizations.of(context).articlesFilterStarred;
break;
default:
throw Exception('FilterType $a should not be shown');
}

4
packages/neon/neon_news/lib/widgets/feeds_view.dart

@ -111,7 +111,6 @@ class NewsFeedsView extends StatelessWidget {
feed: feed,
),
);
break;
case NewsFeedAction.delete:
if (await showConfirmationDialog(
context,
@ -119,7 +118,6 @@ class NewsFeedsView extends StatelessWidget {
)) {
bloc.removeFeed(feed.id);
}
break;
case NewsFeedAction.rename:
final result = await showRenameDialog(
context: context,
@ -129,7 +127,6 @@ class NewsFeedsView extends StatelessWidget {
if (result != null) {
bloc.renameFeed(feed.id, result);
}
break;
case NewsFeedAction.move:
final result = await showDialog<List<int?>>(
context: context,
@ -141,7 +138,6 @@ class NewsFeedsView extends StatelessWidget {
if (result != null) {
bloc.moveFeed(feed.id, result[0]);
}
break;
}
},
),

2
packages/neon/neon_news/lib/widgets/folders_view.dart

@ -92,7 +92,6 @@ class NewsFoldersView extends StatelessWidget {
)) {
bloc.deleteFolder(folder.id);
}
break;
case NewsFolderAction.rename:
final result = await showRenameDialog(
context: context,
@ -102,7 +101,6 @@ class NewsFoldersView extends StatelessWidget {
if (result != null) {
bloc.renameFolder(folder.id, result);
}
break;
}
},
),

Loading…
Cancel
Save