upgrade min sdk; run formatter

This commit is contained in:
Fabian Freund committed 2025-06-02 22:25:10 +02:00
1 parent 8fccd767af
commit ad03cc9bac
171 files changed
+4817 -4685

No files matched your search

@@ -44,9 +44,8 @@ class ArticleDao extends DatabaseAccessor<FeedDatabase> with _$ArticleDaoMixin {
return db.transaction(() async {
await Future.wait(
articles.map((newArticle) {
final statement =
db.article.update()
..where((article) => article.id.equals(newArticle.id));
final statement = db.article.update()
..where((article) => article.id.equals(newArticle.id));
return statement.write(
ArticleCompanion(
@@ -86,12 +85,11 @@ class ArticleDao extends DatabaseAccessor<FeedDatabase> with _$ArticleDaoMixin {
updated: Value(article.updated),
);
},
where:
(old) =>
old.updated.isNotNull() &
old.updated.isSmallerThanValue(
article.updated ?? DateTime(0),
),
where: (old) =>
old.updated.isNotNull() &
old.updated.isSmallerThanValue(
article.updated ?? DateTime(0),
),
),
),
)
@@ -101,8 +99,8 @@ class ArticleDao extends DatabaseAccessor<FeedDatabase> with _$ArticleDaoMixin {
}
Future<int> updateArticleRead(String articleId, DateTime? read) {
final statement =
db.article.update()..where((article) => article.id.equals(articleId));
final statement = db.article.update()
..where((article) => article.id.equals(articleId));
return statement.write(ArticleCompanion(lastRead: Value(read)));
}
@@ -110,15 +108,14 @@ class ArticleDao extends DatabaseAccessor<FeedDatabase> with _$ArticleDaoMixin {
Selectable<(String, int)> getUnreadArticleCount() {
final count = countAll();
final countByFeed =
db.article.selectOnly()
..addColumns([db.article.feedId, count])
..where(
db.article.lastRead.isNull() |
(db.article.updated.isNotNull() &
db.article.lastRead.isSmallerThan(db.article.lastRead)),
)
..groupBy([db.article.feedId]);
final countByFeed = db.article.selectOnly()
..addColumns([db.article.feedId, count])
..where(
db.article.lastRead.isNull() |
(db.article.updated.isNotNull() &
db.article.lastRead.isSmallerThan(db.article.lastRead)),
)
..groupBy([db.article.feedId]);
return countByFeed.map(
(result) => (result.read(db.article.feedId)!, result.read(count)!),
@@ -16,8 +16,8 @@ class FeedDao extends DatabaseAccessor<FeedDatabase> with _$FeedDaoMixin {
}
Future<int> updateFeedFetched(Uri feedId, DateTime fetched) {
final statement =
db.feed.update()..where((feed) => feed.url.equalsValue(feedId));
final statement = db.feed.update()
..where((feed) => feed.url.equalsValue(feedId));
return statement.write(FeedCompanion(lastFetched: Value(fetched)));
}
@@ -273,14 +273,16 @@ class FeedData extends DataClass implements Insertable<FeedData> {
return FeedData(
url: data.url.present ? data.url.value : this.url,
title: data.title.present ? data.title.value : this.title,
description:
data.description.present ? data.description.value : this.description,
description: data.description.present
? data.description.value
: this.description,
icon: data.icon.present ? data.icon.value : this.icon,
siteLink: data.siteLink.present ? data.siteLink.value : this.siteLink,
authors: data.authors.present ? data.authors.value : this.authors,
tags: data.tags.present ? data.tags.value : this.tags,
lastFetched:
data.lastFetched.present ? data.lastFetched.value : this.lastFetched,
lastFetched: data.lastFetched.present
? data.lastFetched.value
: this.lastFetched,
);
}
@@ -625,22 +627,20 @@ class Article extends Table with TableInfo<Article, FeedArticle> {
FeedArticle map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return FeedArticle(
id:
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
feedId: Article.$converterfeedId.fromSql(
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}feed_id'],
)!,
),
fetched:
attachedDatabase.typeMapping.read(
DriftSqlType.dateTime,
data['${effectivePrefix}fetched'],
)!,
fetched: attachedDatabase.typeMapping.read(
DriftSqlType.dateTime,
data['${effectivePrefix}fetched'],
)!,
created: attachedDatabase.typeMapping.read(
DriftSqlType.dateTime,
data['${effectivePrefix}created'],
@@ -992,22 +992,20 @@ class ArticleView extends ViewInfo<ArticleView, FeedArticle>
FeedArticle map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return FeedArticle(
id:
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
feedId: Article.$converterfeedId.fromSql(
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}feed_id'],
)!,
),
fetched:
attachedDatabase.typeMapping.read(
DriftSqlType.dateTime,
data['${effectivePrefix}fetched'],
)!,
fetched: attachedDatabase.typeMapping.read(
DriftSqlType.dateTime,
data['${effectivePrefix}fetched'],
)!,
created: attachedDatabase.typeMapping.read(
DriftSqlType.dateTime,
data['${effectivePrefix}created'],
@@ -1251,21 +1249,18 @@ class ArticleFts extends Table
ArticleFt map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return ArticleFt(
title:
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}title'],
)!,
summaryPlain:
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}summaryPlain'],
)!,
contentPlain:
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}contentPlain'],
)!,
title: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}title'],
)!,
summaryPlain: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}summaryPlain'],
)!,
contentPlain: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}contentPlain'],
)!,
);
}
@@ -1332,14 +1327,12 @@ class ArticleFt extends DataClass implements Insertable<ArticleFt> {
ArticleFt copyWithCompanion(ArticleFtsCompanion data) {
return ArticleFt(
title: data.title.present ? data.title.value : this.title,
summaryPlain:
data.summaryPlain.present
? data.summaryPlain.value
: this.summaryPlain,
contentPlain:
data.contentPlain.present
? data.contentPlain.value
: this.contentPlain,
summaryPlain: data.summaryPlain.present
? data.summaryPlain.value
: this.summaryPlain,
contentPlain: data.contentPlain.present
? data.contentPlain.value
: this.contentPlain,
);
}
@@ -1886,12 +1879,12 @@ class $FeedTableManager
TableManagerState(
db: db,
table: table,
createFilteringComposer:
() => $FeedFilterComposer($db: db, $table: table),
createOrderingComposer:
() => $FeedOrderingComposer($db: db, $table: table),
createComputedFieldComposer:
() => $FeedAnnotationComposer($db: db, $table: table),
createFilteringComposer: () =>
$FeedFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$FeedOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$FeedAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<Uri> url = const Value.absent(),
@@ -1936,16 +1929,9 @@ class $FeedTableManager
lastFetched: lastFetched,
rowid: rowid,
),
withReferenceMapper:
(p0) =>
p0
.map(
(e) => (
e.readTable(table),
$FeedReferences(db, table, e),
),
)
.toList(),
withReferenceMapper: (p0) => p0
.map((e) => (e.readTable(table), $FeedReferences(db, table, e)))
.toList(),
prefetchHooksCallback: ({articleRefs = false}) {
return PrefetchHooks(
db: db,
@@ -1957,12 +1943,10 @@ class $FeedTableManager
await $_getPrefetchedData<FeedData, Feed, FeedArticle>(
currentTable: table,
referencedTable: $FeedReferences._articleRefsTable(db),
managerFromTypedResult:
(p0) => $FeedReferences(db, table, p0).articleRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.feedId == item.url,
),
managerFromTypedResult: (p0) =>
$FeedReferences(db, table, p0).articleRefs,
referencedItemsForCurrentItem: (item, referencedItems) =>
referencedItems.where((e) => e.feedId == item.url),
typedResults: items,
),
];
@@ -2380,12 +2364,12 @@ class $ArticleTableManager
TableManagerState(
db: db,
table: table,
createFilteringComposer:
() => $ArticleFilterComposer($db: db, $table: table),
createOrderingComposer:
() => $ArticleOrderingComposer($db: db, $table: table),
createComputedFieldComposer:
() => $ArticleAnnotationComposer($db: db, $table: table),
createFilteringComposer: () =>
$ArticleFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$ArticleOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$ArticleAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
@@ -2462,51 +2446,47 @@ class $ArticleTableManager
contentPlain: contentPlain,
rowid: rowid,
),
withReferenceMapper:
(p0) =>
p0
.map(
(e) => (
e.readTable(table),
$ArticleReferences(db, table, e),
),
)
.toList(),
withReferenceMapper: (p0) => p0
.map(
(e) => (e.readTable(table), $ArticleReferences(db, table, e)),
)
.toList(),
prefetchHooksCallback: ({feedId = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [],
addJoins: <
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (feedId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.feedId,
referencedTable: $ArticleReferences._feedIdTable(
db,
),
referencedColumn:
$ArticleReferences._feedIdTable(db).url,
)
as T;
}
addJoins:
<
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (feedId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.feedId,
referencedTable: $ArticleReferences
._feedIdTable(db),
referencedColumn: $ArticleReferences
._feedIdTable(db)
.url,
)
as T;
}
return state;
},
return state;
},
getPrefetchedDataCallback: (items) async {
return [];
},
@@ -2636,12 +2616,12 @@ class $ArticleFtsTableManager
TableManagerState(
db: db,
table: table,
createFilteringComposer:
() => $ArticleFtsFilterComposer($db: db, $table: table),
createOrderingComposer:
() => $ArticleFtsOrderingComposer($db: db, $table: table),
createComputedFieldComposer:
() => $ArticleFtsAnnotationComposer($db: db, $table: table),
createFilteringComposer: () =>
$ArticleFtsFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$ArticleFtsOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$ArticleFtsAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> title = const Value.absent(),
@@ -2666,16 +2646,9 @@ class $ArticleFtsTableManager
contentPlain: contentPlain,
rowid: rowid,
),
withReferenceMapper:
(p0) =>
p0
.map(
(e) => (
e.readTable(table),
BaseReferences(db, table, e),
),
)
.toList(),
withReferenceMapper: (p0) => p0
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
.toList(),
prefetchHooksCallback: null,
),
);
@@ -165,96 +165,78 @@ class _$FeedArticleCWProxyImpl implements _$FeedArticleCWProxy {
Object? siteLink = const $CopyWithPlaceholder(),
}) {
return FeedArticle(
id:
id == const $CopyWithPlaceholder()
? _value.id
// ignore: cast_nullable_to_non_nullable
: id as String,
feedId:
feedId == const $CopyWithPlaceholder()
? _value.feedId
// ignore: cast_nullable_to_non_nullable
: feedId as Uri,
fetched:
fetched == const $CopyWithPlaceholder()
? _value.fetched
// ignore: cast_nullable_to_non_nullable
: fetched as DateTime,
created:
created == const $CopyWithPlaceholder()
? _value.created
// ignore: cast_nullable_to_non_nullable
: created as DateTime?,
updated:
updated == const $CopyWithPlaceholder()
? _value.updated
// ignore: cast_nullable_to_non_nullable
: updated as DateTime?,
lastRead:
lastRead == const $CopyWithPlaceholder()
? _value.lastRead
// ignore: cast_nullable_to_non_nullable
: lastRead as DateTime?,
title:
title == const $CopyWithPlaceholder()
? _value.title
// ignore: cast_nullable_to_non_nullable
: title as String?,
authors:
authors == const $CopyWithPlaceholder()
? _value.authors
// ignore: cast_nullable_to_non_nullable
: authors as List<FeedAuthor>?,
tags:
tags == const $CopyWithPlaceholder()
? _value.tags
// ignore: cast_nullable_to_non_nullable
: tags as List<FeedCategory>?,
links:
links == const $CopyWithPlaceholder()
? _value.links
// ignore: cast_nullable_to_non_nullable
: links as List<FeedLink>?,
summaryHtml:
summaryHtml == const $CopyWithPlaceholder()
? _value.summaryHtml
// ignore: cast_nullable_to_non_nullable
: summaryHtml as String?,
summaryMarkdown:
summaryMarkdown == const $CopyWithPlaceholder()
? _value.summaryMarkdown
// ignore: cast_nullable_to_non_nullable
: summaryMarkdown as String?,
summaryPlain:
summaryPlain == const $CopyWithPlaceholder()
? _value.summaryPlain
// ignore: cast_nullable_to_non_nullable
: summaryPlain as String?,
contentHtml:
contentHtml == const $CopyWithPlaceholder()
? _value.contentHtml
// ignore: cast_nullable_to_non_nullable
: contentHtml as String?,
contentMarkdown:
contentMarkdown == const $CopyWithPlaceholder()
? _value.contentMarkdown
// ignore: cast_nullable_to_non_nullable
: contentMarkdown as String?,
contentPlain:
contentPlain == const $CopyWithPlaceholder()
? _value.contentPlain
// ignore: cast_nullable_to_non_nullable
: contentPlain as String?,
icon:
icon == const $CopyWithPlaceholder()
? _value.icon
// ignore: cast_nullable_to_non_nullable
: icon as Uri?,
siteLink:
siteLink == const $CopyWithPlaceholder()
? _value.siteLink
// ignore: cast_nullable_to_non_nullable
: siteLink as Uri?,
id: id == const $CopyWithPlaceholder()
? _value.id
// ignore: cast_nullable_to_non_nullable
: id as String,
feedId: feedId == const $CopyWithPlaceholder()
? _value.feedId
// ignore: cast_nullable_to_non_nullable
: feedId as Uri,
fetched: fetched == const $CopyWithPlaceholder()
? _value.fetched
// ignore: cast_nullable_to_non_nullable
: fetched as DateTime,
created: created == const $CopyWithPlaceholder()
? _value.created
// ignore: cast_nullable_to_non_nullable
: created as DateTime?,
updated: updated == const $CopyWithPlaceholder()
? _value.updated
// ignore: cast_nullable_to_non_nullable
: updated as DateTime?,
lastRead: lastRead == const $CopyWithPlaceholder()
? _value.lastRead
// ignore: cast_nullable_to_non_nullable
: lastRead as DateTime?,
title: title == const $CopyWithPlaceholder()
? _value.title
// ignore: cast_nullable_to_non_nullable
: title as String?,
authors: authors == const $CopyWithPlaceholder()
? _value.authors
// ignore: cast_nullable_to_non_nullable
: authors as List<FeedAuthor>?,
tags: tags == const $CopyWithPlaceholder()
? _value.tags
// ignore: cast_nullable_to_non_nullable
: tags as List<FeedCategory>?,
links: links == const $CopyWithPlaceholder()
? _value.links
// ignore: cast_nullable_to_non_nullable
: links as List<FeedLink>?,
summaryHtml: summaryHtml == const $CopyWithPlaceholder()
? _value.summaryHtml
// ignore: cast_nullable_to_non_nullable
: summaryHtml as String?,
summaryMarkdown: summaryMarkdown == const $CopyWithPlaceholder()
? _value.summaryMarkdown
// ignore: cast_nullable_to_non_nullable
: summaryMarkdown as String?,
summaryPlain: summaryPlain == const $CopyWithPlaceholder()
? _value.summaryPlain
// ignore: cast_nullable_to_non_nullable
: summaryPlain as String?,
contentHtml: contentHtml == const $CopyWithPlaceholder()
? _value.contentHtml
// ignore: cast_nullable_to_non_nullable
: contentHtml as String?,
contentMarkdown: contentMarkdown == const $CopyWithPlaceholder()
? _value.contentMarkdown
// ignore: cast_nullable_to_non_nullable
: contentMarkdown as String?,
contentPlain: contentPlain == const $CopyWithPlaceholder()
? _value.contentPlain
// ignore: cast_nullable_to_non_nullable
: contentPlain as String?,
icon: icon == const $CopyWithPlaceholder()
? _value.icon
// ignore: cast_nullable_to_non_nullable
: icon as Uri?,
siteLink: siteLink == const $CopyWithPlaceholder()
? _value.siteLink
// ignore: cast_nullable_to_non_nullable
: siteLink as Uri?,
);
}
}
@@ -273,31 +255,25 @@ FeedArticle _$FeedArticleFromJson(Map<String, dynamic> json) => FeedArticle(
id: json['id'] as String,
feedId: Uri.parse(json['feedId'] as String),
fetched: DateTime.parse(json['fetched'] as String),
created:
json['created'] == null
? null
: DateTime.parse(json['created'] as String),
updated:
json['updated'] == null
? null
: DateTime.parse(json['updated'] as String),
lastRead:
json['lastRead'] == null
? null
: DateTime.parse(json['lastRead'] as String),
created: json['created'] == null
? null
: DateTime.parse(json['created'] as String),
updated: json['updated'] == null
? null
: DateTime.parse(json['updated'] as String),
lastRead: json['lastRead'] == null
? null
: DateTime.parse(json['lastRead'] as String),
title: json['title'] as String?,
authors:
(json['authors'] as List<dynamic>?)
?.map((e) => FeedAuthor.fromJson(e as Map<String, dynamic>))
.toList(),
tags:
(json['tags'] as List<dynamic>?)
?.map((e) => FeedCategory.fromJson(e as Map<String, dynamic>))
.toList(),
links:
(json['links'] as List<dynamic>?)
?.map((e) => FeedLink.fromJson(e as Map<String, dynamic>))
.toList(),
authors: (json['authors'] as List<dynamic>?)
?.map((e) => FeedAuthor.fromJson(e as Map<String, dynamic>))
.toList(),
tags: (json['tags'] as List<dynamic>?)
?.map((e) => FeedCategory.fromJson(e as Map<String, dynamic>))
.toList(),
links: (json['links'] as List<dynamic>?)
?.map((e) => FeedLink.fromJson(e as Map<String, dynamic>))
.toList(),
summaryHtml: json['summaryHtml'] as String?,
summaryMarkdown: json['summaryMarkdown'] as String?,
summaryPlain: json['summaryPlain'] as String?,
@@ -305,8 +281,9 @@ FeedArticle _$FeedArticleFromJson(Map<String, dynamic> json) => FeedArticle(
contentMarkdown: json['contentMarkdown'] as String?,
contentPlain: json['contentPlain'] as String?,
icon: json['icon'] == null ? null : Uri.parse(json['icon'] as String),
siteLink:
json['siteLink'] == null ? null : Uri.parse(json['siteLink'] as String),
siteLink: json['siteLink'] == null
? null
: Uri.parse(json['siteLink'] as String),
);
Map<String, dynamic> _$FeedArticleToJson(FeedArticle instance) =>
@@ -11,10 +11,9 @@ FeedParseResult _$FeedParseResultFromJson(Map<String, dynamic> json) =>
feedData: const FeedDataConverter().fromJson(
json['feedData'] as Map<String, dynamic>,
),
articleData:
(json['articleData'] as List<dynamic>)
.map((e) => FeedArticle.fromJson(e as Map<String, dynamic>))
.toList(),
articleData: (json['articleData'] as List<dynamic>)
.map((e) => FeedArticle.fromJson(e as Map<String, dynamic>))
.toList(),
);
Map<String, dynamic> _$FeedParseResultToJson(FeedParseResult instance) =>
@@ -13,8 +13,9 @@ String _$feedDatabaseHash() => r'c3b20e867da5af6e92d1e8c1efa96b79988837a1';
final feedDatabaseProvider = Provider<FeedDatabase>.internal(
feedDatabase,
name: r'feedDatabaseProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product') ? null : _$feedDatabaseHash,
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$feedDatabaseHash,
dependencies: null,
allTransitiveDependencies: null,
);
@@ -104,21 +104,19 @@ class FilteredArticleList extends _$FilteredArticleList {
AsyncValue<List<FeedArticle>> build(Uri? feedId) {
final filterTags = ref.watch(articleFilterProvider);
final articlesAsync =
_hasSearch
? ref.watch(articleSearchProvider(feedId))
: ref.watch(feedArticleListProvider(feedId));
final articlesAsync = _hasSearch
? ref.watch(articleSearchProvider(feedId))
: ref.watch(feedArticleListProvider(feedId));
return articlesAsync.whenData((articles) {
if (filterTags.isNotEmpty) {
return articles.where((article) {
final tags = article.tags?.map((tag) => tag.id).toSet();
final authors =
article.authors
?.map((author) => author.name.whenNotEmpty)
.nonNulls
.toSet();
final authors = article.authors
?.map((author) => author.name.whenNotEmpty)
.nonNulls
.toSet();
return filterTags.every(
(filter) =>
@@ -13,8 +13,9 @@ String _$feedListHash() => r'0076186437354768c39fb1d7c8bcfcf7b94c7dd1';
final feedListProvider = AutoDisposeStreamProvider<List<FeedData>>.internal(
feedList,
name: r'feedListProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product') ? null : _$feedListHash,
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$feedListHash,
dependencies: null,
allTransitiveDependencies: null,
);
@@ -87,10 +88,9 @@ class FeedDataProvider extends AutoDisposeStreamProvider<FeedData?> {
(ref) => feedData(ref as FeedDataRef, feedId),
from: feedDataProvider,
name: r'feedDataProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$feedDataHash,
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$feedDataHash,
dependencies: FeedDataFamily._dependencies,
allTransitiveDependencies: FeedDataFamily._allTransitiveDependencies,
feedId: feedId,
@@ -208,10 +208,9 @@ class FeedArticleListProvider
(ref) => feedArticleList(ref as FeedArticleListRef, feedId),
from: feedArticleListProvider,
name: r'feedArticleListProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$feedArticleListHash,
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$feedArticleListHash,
dependencies: FeedArticleListFamily._dependencies,
allTransitiveDependencies:
FeedArticleListFamily._allTransitiveDependencies,
@@ -333,10 +332,9 @@ class FeedArticleProvider extends AutoDisposeStreamProvider<FeedArticle?> {
),
from: feedArticleProvider,
name: r'feedArticleProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$feedArticleHash,
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$feedArticleHash,
dependencies: FeedArticleFamily._dependencies,
allTransitiveDependencies: FeedArticleFamily._allTransitiveDependencies,
articleId: articleId,
@@ -428,10 +426,9 @@ final unreadArticleCountProvider =
AutoDisposeProvider<Raw<Stream<Map<String, int>>>>.internal(
unreadArticleCount,
name: r'unreadArticleCountProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$unreadArticleCountHash,
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$unreadArticleCountHash,
dependencies: null,
allTransitiveDependencies: null,
);
@@ -488,10 +485,9 @@ class UnreadFeedArticleCountProvider extends AutoDisposeStreamProvider<int?> {
unreadFeedArticleCount(ref as UnreadFeedArticleCountRef, feedId),
from: unreadFeedArticleCountProvider,
name: r'unreadFeedArticleCountProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$unreadFeedArticleCountHash,
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$unreadFeedArticleCountHash,
dependencies: UnreadFeedArticleCountFamily._dependencies,
allTransitiveDependencies:
UnreadFeedArticleCountFamily._allTransitiveDependencies,
@@ -609,10 +605,9 @@ class FetchWebFeedProvider extends AutoDisposeFutureProvider<FeedParseResult> {
(ref) => fetchWebFeed(ref as FetchWebFeedRef, url),
from: fetchWebFeedProvider,
name: r'fetchWebFeedProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$fetchWebFeedHash,
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$fetchWebFeedHash,
dependencies: FetchWebFeedFamily._dependencies,
allTransitiveDependencies:
FetchWebFeedFamily._allTransitiveDependencies,
@@ -742,10 +737,9 @@ class ArticleSearchProvider
() => ArticleSearch()..feedId = feedId,
from: articleSearchProvider,
name: r'articleSearchProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$articleSearchHash,
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$articleSearchHash,
dependencies: ArticleSearchFamily._dependencies,
allTransitiveDependencies:
ArticleSearchFamily._allTransitiveDependencies,
@@ -885,10 +879,9 @@ class FilteredArticleListProvider
() => FilteredArticleList()..feedId = feedId,
from: filteredArticleListProvider,
name: r'filteredArticleListProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$filteredArticleListHash,
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$filteredArticleListHash,
dependencies: FilteredArticleListFamily._dependencies,
allTransitiveDependencies:
FilteredArticleListFamily._allTransitiveDependencies,
@@ -15,10 +15,9 @@ final addFeedDialogBlockingProvider =
NotifierProvider<AddFeedDialogBlocking, void>.internal(
AddFeedDialogBlocking.new,
name: r'addFeedDialogBlockingProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$addFeedDialogBlockingHash,
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$addFeedDialogBlockingHash,
dependencies: null,
allTransitiveDependencies: null,
);
@@ -14,10 +14,9 @@ final articleFilterProvider =
NotifierProvider<ArticleFilter, Set<String>>.internal(
ArticleFilter.new,
name: r'articleFilterProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$articleFilterHash,
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$articleFilterHash,
dependencies: null,
allTransitiveDependencies: null,
);
@@ -13,10 +13,9 @@ String _$feedRepositoryHash() => r'805cc26890b0d43576a1eab0ecb5851b6649d7b7';
final feedRepositoryProvider = NotifierProvider<FeedRepository, void>.internal(
FeedRepository.new,
name: r'feedRepositoryProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$feedRepositoryHash,
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$feedRepositoryHash,
dependencies: null,
allTransitiveDependencies: null,
);
@@ -15,10 +15,9 @@ final articleContentProcessorServiceProvider =
NotifierProvider<ArticleContentProcessorService, void>.internal(
ArticleContentProcessorService.new,
name: r'articleContentProcessorServiceProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$articleContentProcessorServiceHash,
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$articleContentProcessorServiceHash,
dependencies: null,
allTransitiveDependencies: null,
);
@@ -13,8 +13,9 @@ String _$feedReaderHash() => r'301e01fa831c58723dc0ab118496f4fb34c38610';
final feedReaderProvider = NotifierProvider<FeedReader, void>.internal(
FeedReader.new,
name: r'feedReaderProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product') ? null : _$feedReaderHash,
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$feedReaderHash,
dependencies: null,
allTransitiveDependencies: null,
);
@@ -15,13 +15,9 @@ extension WebFeedJson on WebFeed {
title: json['title'] as String,
description: json['description'] as String,
links: (json['links'] as List).cast<String?>(),
items:
(json['items'] as List)
.map(
(item) =>
WebFeedItemJson.fromJson(item as Map<String, dynamic>),
)
.toList(),
items: (json['items'] as List)
.map((item) => WebFeedItemJson.fromJson(item as Map<String, dynamic>))
.toList(),
);
}
}
@@ -41,10 +37,9 @@ extension WebFeedItemJson on WebFeedItem {
title: json['title'] as String,
body: json['body'] as String,
links: (json['links'] as List).cast<String?>(),
updated:
json['updated'] != null
? DateTime.parse(json['updated'] as String)
: null,
updated: json['updated'] != null
? DateTime.parse(json['updated'] as String)
: null,
);
}
}
@@ -10,8 +10,9 @@ class FetchArticlesController extends _$FetchArticlesController {
Future<void> fetchAllArticles() async {
state = const AsyncLoading();
state = await AsyncValue.guard(() async {
final feeds =
await ref.read(feedRepositoryProvider.notifier).getAllFeeds();
final feeds = await ref
.read(feedRepositoryProvider.notifier)
.getAllFeeds();
await Future.wait(
feeds.map((feed) async {
@@ -11,19 +11,19 @@ String _$fetchArticlesControllerHash() =>
/// See also [FetchArticlesController].
@ProviderFor(FetchArticlesController)
final fetchArticlesControllerProvider = AutoDisposeNotifierProvider<
FetchArticlesController,
AsyncValue<void>
>.internal(
FetchArticlesController.new,
name: r'fetchArticlesControllerProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
final fetchArticlesControllerProvider =
AutoDisposeNotifierProvider<
FetchArticlesController,
AsyncValue<void>
>.internal(
FetchArticlesController.new,
name: r'fetchArticlesControllerProvider',
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$fetchArticlesControllerHash,
dependencies: null,
allTransitiveDependencies: null,
);
dependencies: null,
allTransitiveDependencies: null,
);
typedef _$FetchArticlesController = AutoDisposeNotifier<AsyncValue<void>>;
// ignore_for_file: type=lint
@@ -91,121 +91,118 @@ class FeedArticleScreen extends HookConsumerWidget {
}, [article]);
return NestedScrollView(
headerSliverBuilder:
(context, innerBoxIsScrolled) => [
SliverAppBar.large(
pinned: false,
flexibleSpace: FlexibleSpaceBar(
centerTitle: false,
titlePadding: EdgeInsetsDirectional.only(
start: 72,
end: 72,
bottom: bottomHeight + 16,
),
title: Text(
article.displayTitle,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
background: articleImages?.firstOrNull.mapNotNull(
(img) => Image.network(
img.toString(),
fit: BoxFit.cover,
color: Theme.of(
context,
).colorScheme.surface.withAlpha(200),
colorBlendMode: BlendMode.darken,
),
),
),
bottom: PreferredSize(
preferredSize: Size(double.infinity, bottomHeight),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16.0,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Divider(),
Text(
'Published: ${hasArticleCreated ? ref.read(formatProvider.notifier).fullDateTimeWithTimezone(article.created!) : 'N/A'}',
style: Theme.of(context).textTheme.bodySmall
?.copyWith(fontStyle: FontStyle.italic),
),
if (hasArticleUpdated)
Text(
'Updated: ${ref.read(formatProvider.notifier).fullDateTimeWithTimezone(article.updated!)}',
style: Theme.of(context).textTheme.bodySmall
?.copyWith(fontStyle: FontStyle.italic),
),
if (hasAuthors)
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Row(
children: [
const Text('Authors:'),
const SizedBox(width: 8),
Expanded(
child: AuthorsHorizontalList(
authors: article.authors!,
),
),
],
),
),
if (hasTags)
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Row(
children: [
const Text('Tags:'),
const SizedBox(width: 8),
Expanded(
child: TagsHorizontalList(
tags: article.tags!,
),
),
],
),
),
],
),
),
),
actions: [
if (articleLink != null)
IconButton(
onPressed: () async {
await ref
.read(tabRepositoryProvider.notifier)
.addTab(url: articleLink.uri);
if (context.mounted) {
BrowserRoute().go(context);
}
},
icon: const Icon(Icons.open_in_browser),
),
],
headerSliverBuilder: (context, innerBoxIsScrolled) => [
SliverAppBar.large(
pinned: false,
flexibleSpace: FlexibleSpaceBar(
centerTitle: false,
titlePadding: EdgeInsetsDirectional.only(
start: 72,
end: 72,
bottom: bottomHeight + 16,
),
// SliverToBoxAdapter(
// child: Padding(
// padding: const EdgeInsets.all(8.0),
// child: TabBar(
// controller: tabController,
// tabs: [
// ...tabs.map(
// (tab) => switch (tab) {
// _Pages.summary => const Tab(text: 'Summary'),
// _Pages.content => const Tab(text: 'Article'),
// },
// ),
// ],
// ),
// ),
// ),
title: Text(
article.displayTitle,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
background: articleImages?.firstOrNull.mapNotNull(
(img) => Image.network(
img.toString(),
fit: BoxFit.cover,
color: Theme.of(
context,
).colorScheme.surface.withAlpha(200),
colorBlendMode: BlendMode.darken,
),
),
),
bottom: PreferredSize(
preferredSize: Size(double.infinity, bottomHeight),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Divider(),
Text(
'Published: ${hasArticleCreated ? ref.read(formatProvider.notifier).fullDateTimeWithTimezone(article.created!) : 'N/A'}',
style: Theme.of(context).textTheme.bodySmall
?.copyWith(fontStyle: FontStyle.italic),
),
if (hasArticleUpdated)
Text(
'Updated: ${ref.read(formatProvider.notifier).fullDateTimeWithTimezone(article.updated!)}',
style: Theme.of(context).textTheme.bodySmall
?.copyWith(fontStyle: FontStyle.italic),
),
if (hasAuthors)
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Row(
children: [
const Text('Authors:'),
const SizedBox(width: 8),
Expanded(
child: AuthorsHorizontalList(
authors: article.authors!,
),
),
],
),
),
if (hasTags)
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Row(
children: [
const Text('Tags:'),
const SizedBox(width: 8),
Expanded(
child: TagsHorizontalList(
tags: article.tags!,
),
),
],
),
),
],
),
),
),
actions: [
if (articleLink != null)
IconButton(
onPressed: () async {
await ref
.read(tabRepositoryProvider.notifier)
.addTab(url: articleLink.uri);
if (context.mounted) {
BrowserRoute().go(context);
}
},
icon: const Icon(Icons.open_in_browser),
),
],
),
// SliverToBoxAdapter(
// child: Padding(
// padding: const EdgeInsets.all(8.0),
// child: TabBar(
// controller: tabController,
// tabs: [
// ...tabs.map(
// (tab) => switch (tab) {
// _Pages.summary => const Tab(text: 'Summary'),
// _Pages.content => const Tab(text: 'Article'),
// },
// ),
// ],
// ),
// ),
// ),
],
body: TabBarView(
controller: tabController,
children: [
@@ -230,17 +227,17 @@ class FeedArticleScreen extends HookConsumerWidget {
}
}
},
styleSheet: MarkdownStyleSheet.fromTheme(
Theme.of(context),
).copyWith(
blockquoteDecoration: BoxDecoration(
color:
Theme.of(
styleSheet:
MarkdownStyleSheet.fromTheme(
Theme.of(context),
).copyWith(
blockquoteDecoration: BoxDecoration(
color: Theme.of(
context,
).colorScheme.secondaryContainer,
borderRadius: BorderRadius.circular(2.0),
),
),
borderRadius: BorderRadius.circular(2.0),
),
),
data: switch (tab) {
_Pages.summary => article.summaryMarkdown!,
_Pages.content => article.contentMarkdown!,
@@ -253,13 +250,12 @@ class FeedArticleScreen extends HookConsumerWidget {
},
);
},
error:
(error, stackTrace) => Center(
child: FailureWidget(
title: 'Failed reading article',
exception: error,
),
),
error: (error, stackTrace) => Center(
child: FailureWidget(
title: 'Failed reading article',
exception: error,
),
),
loading: () => const Center(child: CircularProgressIndicator()),
),
);
@@ -70,21 +70,20 @@ class FeedArticleListScreen extends HookConsumerWidget {
controller: searchTextController,
decoration: InputDecoration(
label: const Text('Search'),
suffixIcon:
hasText
? IconButton(
onPressed: () {
searchTextController.clear();
focusNode.requestFocus();
},
icon: const Icon(Icons.clear),
)
: SpeechToTextButton(
onTextReceived: (data) {
searchTextController.text =
data.toString();
},
),
suffixIcon: hasText
? IconButton(
onPressed: () {
searchTextController.clear();
focusNode.requestFocus();
},
icon: const Icon(Icons.clear),
)
: SpeechToTextButton(
onTextReceived: (data) {
searchTextController.text = data
.toString();
},
),
),
),
const SizedBox(height: 4),
@@ -99,30 +98,29 @@ class FeedArticleListScreen extends HookConsumerWidget {
controller: controller,
shrinkWrap: true,
scrollDirection: Axis.horizontal,
children:
tags
.map(
(tag) => Padding(
padding: const EdgeInsets.only(
right: 8.0,
),
child: FilterChip(
label: Text(tag),
showCheckmark: false,
selected: true,
onSelected: (value) {},
onDeleted: () {
ref
.read(
articleFilterProvider
.notifier,
)
.removeTag(tag);
},
),
),
)
.toList(),
children: tags
.map(
(tag) => Padding(
padding: const EdgeInsets.only(
right: 8.0,
),
child: FilterChip(
label: Text(tag),
showCheckmark: false,
selected: true,
onSelected: (value) {},
onDeleted: () {
ref
.read(
articleFilterProvider
.notifier,
)
.removeTag(tag);
},
),
),
)
.toList(),
);
},
),
@@ -175,13 +173,12 @@ class FeedArticleListScreen extends HookConsumerWidget {
),
);
},
error:
(error, stackTrace) => Center(
child: FailureWidget(
title: 'Failed to load Articles',
exception: error,
),
),
error: (error, stackTrace) => Center(
child: FailureWidget(
title: 'Failed to load Articles',
exception: error,
),
),
loading: () => const SizedBox.shrink(),
);
},
@@ -60,39 +60,34 @@ class FeedEditScreen extends HookConsumerWidget {
return _FeedEditContent(mode: _mode, initialFeed: initialFeed);
},
error:
(error, stackTrace) => Scaffold(
key: const ValueKey('error'),
appBar: AppBar(),
body: Center(
child: FailureWidget(
title: 'Failed to load feed',
exception: error,
error: (error, stackTrace) => Scaffold(
key: const ValueKey('error'),
appBar: AppBar(),
body: Center(
child: FailureWidget(title: 'Failed to load feed', exception: error),
),
),
loading: () => Scaffold(
key: const ValueKey('loading'),
appBar: AppBar(
title: Text(switch (_mode) {
_DialogMode.create => 'New Feed',
_DialogMode.edit => 'Edit Feed',
}),
),
body: const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CircularProgressIndicator(),
Padding(
padding: EdgeInsets.only(top: 8.0),
child: Text('Fetching feed...'),
),
),
),
loading:
() => Scaffold(
key: const ValueKey('loading'),
appBar: AppBar(
title: Text(switch (_mode) {
_DialogMode.create => 'New Feed',
_DialogMode.edit => 'Edit Feed',
}),
),
body: const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CircularProgressIndicator(),
Padding(
padding: EdgeInsets.only(top: 8.0),
child: Text('Fetching feed...'),
),
],
),
),
],
),
),
),
);
}
}
@@ -141,11 +136,10 @@ class _FeedEditContent extends HookConsumerWidget {
onPressed: () async {
if (formKey.currentState?.validate() ?? false) {
final feedData = FeedData(
url:
uri_parser.tryParseUrl(
urlTextController.text,
eagerParsing: true,
)!,
url: uri_parser.tryParseUrl(
urlTextController.text,
eagerParsing: true,
)!,
authors: initialFeed.authors,
description: descriptionTextController.text.whenNotEmpty,
icon: uri_parser.tryParseUrl(
@@ -32,17 +32,16 @@ class FeedListScreen extends HookConsumerWidget {
),
);
},
error:
(error, stackTrace) => Center(
child: FailureWidget(
title: 'Failed to load Feeds',
exception: error,
onRetry: () {
// ignore: unused_result
ref.refresh(feedListProvider);
},
),
),
error: (error, stackTrace) => Center(
child: FailureWidget(
title: 'Failed to load Feeds',
exception: error,
onRetry: () {
// ignore: unused_result
ref.refresh(feedListProvider);
},
),
),
loading: () => const SizedBox.shrink(),
),
floatingActionButton: FloatingActionButton.extended(
@@ -15,51 +15,44 @@ class SelectFeedDialog extends HookConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
return SimpleDialog(
title: const Text('Add Feed'),
children:
feedUris
.map(
(uri) => HookConsumer(
builder: (context, ref, child) {
final feedAsync = ref.watch(fetchWebFeedProvider(uri));
children: feedUris
.map(
(uri) => HookConsumer(
builder: (context, ref, child) {
final feedAsync = ref.watch(fetchWebFeedProvider(uri));
return feedAsync.when(
data: (data) {
return ListTile(
title: Text(
data.feedData.title.whenNotEmpty ?? 'Unnamed Feed',
),
subtitle: Text(uri.toString()),
trailing: const Icon(Icons.add),
onTap: () {
FeedCreateRoute(
feedId: uri,
).pushReplacement(context);
},
);
return feedAsync.when(
data: (data) {
return ListTile(
title: Text(
data.feedData.title.whenNotEmpty ?? 'Unnamed Feed',
),
subtitle: Text(uri.toString()),
trailing: const Icon(Icons.add),
onTap: () {
FeedCreateRoute(feedId: uri).pushReplacement(context);
},
error:
(error, stackTrace) => FailureWidget(
title: 'Failed to fetch Feed',
exception: error,
onRetry: () {
// ignore: unused_result
ref.refresh(fetchWebFeedProvider(uri));
},
),
loading:
() => Skeletonizer(
child: ListTile(
title: Text(BoneMock.title),
subtitle: Skeleton.keep(
child: Text(uri.toString()),
),
),
),
);
},
),
)
.toList(),
error: (error, stackTrace) => FailureWidget(
title: 'Failed to fetch Feed',
exception: error,
onRetry: () {
// ignore: unused_result
ref.refresh(fetchWebFeedProvider(uri));
},
),
loading: () => Skeletonizer(
child: ListTile(
title: Text(BoneMock.title),
subtitle: Skeleton.keep(child: Text(uri.toString())),
),
),
);
},
),
)
.toList(),
);
}
}
@@ -11,26 +11,25 @@ class AuthorsHorizontalList extends StatelessWidget {
Set<String> selectedTags = const {},
void Function(String tagId, bool value)? onTagSelected,
}) {
_authors =
authors.map((author) {
final label = Text(
'${author.name ?? ''} ${author.email.mapNotNull((email) => '($email)') ?? ''}'
.trim(),
);
_authors = authors.map((author) {
final label = Text(
'${author.name ?? ''} ${author.email.mapNotNull((email) => '($email)') ?? ''}'
.trim(),
);
return onTagSelected.mapNotNull(
(onTagSelected) => FilterChip(
label: label,
selected: selectedTags.contains(author.name),
onSelected: (value) {
if (author.name.isNotEmpty) {
onTagSelected(author.name!, value);
}
},
),
) ??
Chip(label: label);
}).toList();
return onTagSelected.mapNotNull(
(onTagSelected) => FilterChip(
label: label,
selected: selectedTags.contains(author.name),
onSelected: (value) {
if (author.name.isNotEmpty) {
onTagSelected(author.name!, value);
}
},
),
) ??
Chip(label: label);
}).toList();
}
@override
@@ -70,11 +70,12 @@ class FeedArticleCard extends HookConsumerWidget {
MarkdownBody(
data: titleHighlight!,
styleSheet: MarkdownStyleSheet(
p: Theme.of(
context,
).textTheme.titleMedium?.copyWith(
color: Theme.of(context).colorScheme.onSurface,
),
p: Theme.of(context).textTheme.titleMedium
?.copyWith(
color: Theme.of(
context,
).colorScheme.onSurface,
),
),
),
if (titleHighlight.isEmpty)
@@ -86,23 +87,19 @@ class FeedArticleCard extends HookConsumerWidget {
MarkdownBody(
data: searchSnippet!,
styleSheet: MarkdownStyleSheet(
p: Theme.of(
context,
).textTheme.bodyMedium?.copyWith(
color:
Theme.of(
p: Theme.of(context).textTheme.bodyMedium
?.copyWith(
color: Theme.of(
context,
).colorScheme.onSurfaceVariant,
),
a: Theme.of(
context,
).textTheme.bodyMedium?.copyWith(
color:
Theme.of(
),
a: Theme.of(context).textTheme.bodyMedium
?.copyWith(
color: Theme.of(
context,
).colorScheme.onSurfaceVariant,
decoration: TextDecoration.none,
),
decoration: TextDecoration.none,
),
),
),
if (searchSnippet.isEmpty &&
@@ -108,16 +108,18 @@ class FeedCard extends HookConsumerWidget {
Icon(
MdiIcons.newspaperVariantMultipleOutline,
size: 18,
color:
Theme.of(context).colorScheme.onPrimary,
color: Theme.of(
context,
).colorScheme.onPrimary,
),
const SizedBox(width: 4),
Text(
count.toString(),
textAlign: TextAlign.center,
style: TextStyle(
color:
Theme.of(context).colorScheme.onPrimary,
color: Theme.of(
context,
).colorScheme.onPrimary,
),
),
],
@@ -31,17 +31,16 @@ class TagField extends HookWidget {
const SizedBox(height: 4),
Wrap(
spacing: 8.0,
children:
tags.value
.map(
(tag) => InputChip(
label: Text(tag),
onDeleted: () {
tags.value = {...tags.value}..remove(tag);
},
),
)
.toList(),
children: tags.value
.map(
(tag) => InputChip(
label: Text(tag),
onDeleted: () {
tags.value = {...tags.value}..remove(tag);
},
),
)
.toList(),
),
TextField(
controller: textController,
@@ -68,12 +67,11 @@ class TagField extends HookWidget {
},
onSubmitted: (value) {
if (value.isNotEmpty) {
final values =
value
.split(_tagSplitPatter)
.map((str) => str.trim())
.where((str) => str.isNotEmpty)
.toList();
final values = value
.split(_tagSplitPatter)
.map((str) => str.trim())
.where((str) => str.isNotEmpty)
.toList();
if (values.isNotEmpty) {
textController.clear();
@@ -11,28 +11,26 @@ class TagsHorizontalList extends StatelessWidget {
Set<String> selectedTags = const {},
void Function(String tagId, bool value)? onTagSelected,
}) {
_tags =
tags.map((tag) {
final label = Text(
'${tag.id} ${tag.title.mapNotNull((title) => '($title)') ?? ''}'
.trim(),
);
_tags = tags.map((tag) {
final label = Text(
'${tag.id} ${tag.title.mapNotNull((title) => '($title)') ?? ''}'.trim(),
);
return Padding(
padding: const EdgeInsets.only(right: 8.0),
child:
onTagSelected.mapNotNull(
(onTagSelected) => FilterChip(
label: label,
selected: selectedTags.contains(tag.id),
onSelected: (value) {
onTagSelected(tag.id, value);
},
),
) ??
Chip(label: label),
);
}).toList();
return Padding(
padding: const EdgeInsets.only(right: 8.0),
child:
onTagSelected.mapNotNull(
(onTagSelected) => FilterChip(
label: label,
selected: selectedTags.contains(tag.id),
onSelected: (value) {
onTagSelected(tag.id, value);
},
),
) ??
Chip(label: label),
);
}).toList();
}
@override
@@ -21,10 +21,9 @@ class FeedParser {
RssVersion.rss1 => Rss1Feed.parse(xmlString),
RssVersion.rss2 => RssFeed.parse(xmlString),
RssVersion.atom => AtomFeed.parse(xmlString),
RssVersion.unknown =>
throw Error.safeToString(
'Invalid XML String? We cannot detect RSS/Atom version.',
),
RssVersion.unknown => throw Error.safeToString(
'Invalid XML String? We cannot detect RSS/Atom version.',
),
};
return FeedParser._(url, feed);
@@ -53,8 +52,9 @@ class FeedParser {
siteLink: feed.link.mapNotNull(Uri.tryParse),
authors: (feed.author.whenNotEmpty ?? feed.dc?.creator.whenNotEmpty)
.mapNotNull((creator) => [FeedAuthor(name: creator)]),
tags:
categories.isNotEmpty ? categories : feed.dc?.toFeedCategories(),
tags: categories.isNotEmpty
? categories
: feed.dc?.toFeedCategories(),
);
case final AtomFeed feed:
final authors = feed.authors.toFeedAuthors();
@@ -64,11 +64,10 @@ class FeedParser {
url: url,
title: feed.title.whenNotEmpty,
icon: feed.icon.mapNotNull(Uri.tryParse),
siteLink:
feed.links
.toFeedLinks()
.getRelation(FeedLinkRelation.alternate)
?.uri,
siteLink: feed.links
.toFeedLinks()
.getRelation(FeedLinkRelation.alternate)
?.uri,
description: feed.subtitle.whenNotEmpty,
authors: authors.isNotEmpty ? authors : null,
tags: tags,
@@ -150,10 +149,9 @@ class FeedParser {
FeedLink(uri: link, relation: FeedLinkRelation.alternate),
],
),
tags:
categories.isNotEmpty
? categories
: item.dc?.toFeedCategories(),
tags: categories.isNotEmpty
? categories
: item.dc?.toFeedCategories(),
contentHtml: item.content?.value.whenNotEmpty,
);
}).toList();