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

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

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

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

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

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

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

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

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

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

@ -23,7 +23,6 @@ class FileActions extends StatelessWidget {
} else { } else {
bloc.addFavorite(details.path); bloc.addFavorite(details.path);
} }
break;
case FilesFileAction.details: case FilesFileAction.details:
await Navigator.of(context).push( await Navigator.of(context).push(
MaterialPageRoute( MaterialPageRoute(
@ -33,7 +32,6 @@ class FileActions extends StatelessWidget {
), ),
), ),
); );
break;
case FilesFileAction.rename: case FilesFileAction.rename:
final result = await showRenameDialog( final result = await showRenameDialog(
context: context, context: context,
@ -44,7 +42,6 @@ class FileActions extends StatelessWidget {
if (result != null) { if (result != null) {
bloc.rename(details.path, result); bloc.rename(details.path, result);
} }
break;
case FilesFileAction.move: case FilesFileAction.move:
final b = bloc.getNewFilesBrowserBloc(); final b = bloc.getNewFilesBrowserBloc();
final originalPath = details.path.sublist(0, details.path.length - 1); final originalPath = details.path.sublist(0, details.path.length - 1);
@ -61,7 +58,6 @@ class FileActions extends StatelessWidget {
if (result != null) { if (result != null) {
bloc.move(details.path, result..add(details.name)); bloc.move(details.path, result..add(details.name));
} }
break;
case FilesFileAction.copy: case FilesFileAction.copy:
final b = bloc.getNewFilesBrowserBloc(); final b = bloc.getNewFilesBrowserBloc();
final originalPath = details.path.sublist(0, details.path.length - 1); final originalPath = details.path.sublist(0, details.path.length - 1);
@ -78,7 +74,6 @@ class FileActions extends StatelessWidget {
if (result != null) { if (result != null) {
bloc.copy(details.path, result..add(details.name)); bloc.copy(details.path, result..add(details.name));
} }
break;
case FilesFileAction.sync: case FilesFileAction.sync:
final sizeWarning = browserBloc.options.downloadSizeWarning.value; final sizeWarning = browserBloc.options.downloadSizeWarning.value;
if (sizeWarning != null && details.size != null && details.size! > sizeWarning) { if (sizeWarning != null && details.size != null && details.size! > sizeWarning) {
@ -93,7 +88,6 @@ class FileActions extends StatelessWidget {
} }
} }
bloc.syncFile(details.path); bloc.syncFile(details.path);
break;
case FilesFileAction.delete: case FilesFileAction.delete:
if (await showConfirmationDialog( if (await showConfirmationDialog(
context, context,
@ -103,7 +97,6 @@ class FileActions extends StatelessWidget {
)) { )) {
bloc.delete(details.path); 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 { class NewsMainArticlesBloc extends NewsArticlesBloc {
NewsMainArticlesBloc( NewsMainArticlesBloc(
super.newsBloc, super._newsBloc,
super.options, super.options,
super.requestManager, super.requestManager,
super.account, super.account,
@ -98,7 +98,6 @@ class NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBlocEvents
break; break;
case FilterType.unread: case FilterType.unread:
getRead = false; getRead = false;
break;
default: default:
throw Exception('FilterType ${filterType.value} not allowed'); throw Exception('FilterType ${filterType.value} not allowed');
} }
@ -106,23 +105,17 @@ class NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBlocEvents
switch (listType) { switch (listType) {
case ListType.feed: case ListType.feed:
type = NewsListType.feed; type = NewsListType.feed;
break;
case ListType.folder: case ListType.folder:
type = NewsListType.folder; type = NewsListType.folder;
break;
case null: case null:
switch (filterType.value) { switch (filterType.value) {
case FilterType.starred: case FilterType.starred:
type = NewsListType.starred; type = NewsListType.starred;
break;
case FilterType.all: case FilterType.all:
type = NewsListType.allItems; type = NewsListType.allItems;
break;
case FilterType.unread: case FilterType.unread:
type = NewsListType.unread; type = NewsListType.unread;
break;
} }
break;
} }
await requestManager.wrapNextcloud<List<NewsArticle>, NewsListArticles>( 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) { switch (a) {
case FilterType.all: case FilterType.all:
label = AppLocalizations.of(context).articlesFilterAll; label = AppLocalizations.of(context).articlesFilterAll;
break;
case FilterType.unread: case FilterType.unread:
label = AppLocalizations.of(context).articlesFilterUnread; label = AppLocalizations.of(context).articlesFilterUnread;
break;
case FilterType.starred: case FilterType.starred:
label = AppLocalizations.of(context).articlesFilterStarred; label = AppLocalizations.of(context).articlesFilterStarred;
break;
default: default:
throw Exception('FilterType $a should not be shown'); 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, feed: feed,
), ),
); );
break;
case NewsFeedAction.delete: case NewsFeedAction.delete:
if (await showConfirmationDialog( if (await showConfirmationDialog(
context, context,
@ -119,7 +118,6 @@ class NewsFeedsView extends StatelessWidget {
)) { )) {
bloc.removeFeed(feed.id); bloc.removeFeed(feed.id);
} }
break;
case NewsFeedAction.rename: case NewsFeedAction.rename:
final result = await showRenameDialog( final result = await showRenameDialog(
context: context, context: context,
@ -129,7 +127,6 @@ class NewsFeedsView extends StatelessWidget {
if (result != null) { if (result != null) {
bloc.renameFeed(feed.id, result); bloc.renameFeed(feed.id, result);
} }
break;
case NewsFeedAction.move: case NewsFeedAction.move:
final result = await showDialog<List<int?>>( final result = await showDialog<List<int?>>(
context: context, context: context,
@ -141,7 +138,6 @@ class NewsFeedsView extends StatelessWidget {
if (result != null) { if (result != null) {
bloc.moveFeed(feed.id, result[0]); 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); bloc.deleteFolder(folder.id);
} }
break;
case NewsFolderAction.rename: case NewsFolderAction.rename:
final result = await showRenameDialog( final result = await showRenameDialog(
context: context, context: context,
@ -102,7 +101,6 @@ class NewsFoldersView extends StatelessWidget {
if (result != null) { if (result != null) {
bloc.renameFolder(folder.id, result); bloc.renameFolder(folder.id, result);
} }
break;
} }
}, },
), ),

Loading…
Cancel
Save