minor fixes
This commit is contained in:
parent
dee1ebf867
commit
a346efd0d6
6 changed files with 35 additions and 6 deletions
|
@ -19,12 +19,31 @@ class QueryFilter extends CollectionFilter {
|
||||||
@override
|
@override
|
||||||
List<Object?> get props => [query, live];
|
List<Object?> get props => [query, live];
|
||||||
|
|
||||||
|
static final _fieldPattern = RegExp(r'(.+)([=<>])(.+)');
|
||||||
|
static const keyContentId = 'ID';
|
||||||
|
static const opEqual = '=';
|
||||||
|
|
||||||
QueryFilter(this.query, {this.colorful = true, this.live = false}) {
|
QueryFilter(this.query, {this.colorful = true, this.live = false}) {
|
||||||
var upQuery = query.toUpperCase();
|
var upQuery = query.toUpperCase();
|
||||||
if (upQuery.startsWith('ID:')) {
|
|
||||||
final contentId = int.tryParse(upQuery.substring(3));
|
final match = _fieldPattern.firstMatch(upQuery);
|
||||||
_test = (entry) => entry.contentId == contentId;
|
if (match != null) {
|
||||||
return;
|
final key = match.group(1)?.trim();
|
||||||
|
final op = match.group(2)?.trim();
|
||||||
|
final value = match.group(3)?.trim();
|
||||||
|
if (key != null && op != null && value != null) {
|
||||||
|
switch (key) {
|
||||||
|
case keyContentId:
|
||||||
|
if (op == opEqual) {
|
||||||
|
final contentId = int.tryParse(value);
|
||||||
|
if (contentId != null) {
|
||||||
|
_test = (entry) => entry.contentId == contentId;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// allow NOT queries starting with `-`
|
// allow NOT queries starting with `-`
|
||||||
|
|
|
@ -44,6 +44,8 @@ class MimeTypes {
|
||||||
|
|
||||||
static const anyVideo = 'video/*';
|
static const anyVideo = 'video/*';
|
||||||
|
|
||||||
|
static const v3gpp = 'video/3gpp';
|
||||||
|
static const asf = 'video/x-ms-asf';
|
||||||
static const avi = 'video/avi';
|
static const avi = 'video/avi';
|
||||||
static const aviVnd = 'video/vnd.avi';
|
static const aviVnd = 'video/vnd.avi';
|
||||||
static const flv = 'video/flv';
|
static const flv = 'video/flv';
|
||||||
|
@ -56,6 +58,7 @@ class MimeTypes {
|
||||||
static const mpeg = 'video/mpeg';
|
static const mpeg = 'video/mpeg';
|
||||||
static const ogv = 'video/ogg';
|
static const ogv = 'video/ogg';
|
||||||
static const webm = 'video/webm';
|
static const webm = 'video/webm';
|
||||||
|
static const wmv = 'video/x-ms-wmv';
|
||||||
|
|
||||||
static const json = 'application/json';
|
static const json = 'application/json';
|
||||||
static const plainText = 'text/plain';
|
static const plainText = 'text/plain';
|
||||||
|
@ -76,7 +79,7 @@ class MimeTypes {
|
||||||
|
|
||||||
static const Set<String> _knownOpaqueImages = {jpeg};
|
static const Set<String> _knownOpaqueImages = {jpeg};
|
||||||
|
|
||||||
static const Set<String> _knownVideos = {avi, aviVnd, flv, flvX, mkv, mov, mp2t, mp2ts, mp4, mpeg, ogv, webm};
|
static const Set<String> _knownVideos = {v3gpp, asf, avi, aviVnd, flv, flvX, mkv, mov, mp2t, mp2ts, mp4, mpeg, ogv, webm, wmv};
|
||||||
|
|
||||||
static final Set<String> knownMediaTypes = {
|
static final Set<String> knownMediaTypes = {
|
||||||
anyImage,
|
anyImage,
|
||||||
|
|
|
@ -22,7 +22,11 @@ class GeocodingService {
|
||||||
});
|
});
|
||||||
return (result as List).cast<Map>().map(Address.fromMap).toList();
|
return (result as List).cast<Map>().map(Address.fromMap).toList();
|
||||||
} on PlatformException catch (e, stack) {
|
} on PlatformException catch (e, stack) {
|
||||||
if (e.code != 'getAddress-empty' && e.code != 'getAddress-network') {
|
if (!{
|
||||||
|
'getAddress-empty',
|
||||||
|
'getAddress-network',
|
||||||
|
'getAddress-unavailable',
|
||||||
|
}.contains(e.code)) {
|
||||||
await reportService.recordError(e, stack);
|
await reportService.recordError(e, stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,7 @@ class _CollectionGridContent extends StatelessWidget {
|
||||||
final sectionedListLayoutProvider = ValueListenableBuilder<double>(
|
final sectionedListLayoutProvider = ValueListenableBuilder<double>(
|
||||||
valueListenable: context.select<TileExtentController, ValueNotifier<double>>((controller) => controller.extentNotifier),
|
valueListenable: context.select<TileExtentController, ValueNotifier<double>>((controller) => controller.extentNotifier),
|
||||||
builder: (context, thumbnailExtent, child) {
|
builder: (context, thumbnailExtent, child) {
|
||||||
|
assert(thumbnailExtent > 0);
|
||||||
return Selector<TileExtentController, Tuple4<double, int, double, double>>(
|
return Selector<TileExtentController, Tuple4<double, int, double, double>>(
|
||||||
selector: (context, c) => Tuple4(c.viewportSize.width, c.columnCount, c.spacing, c.horizontalPadding),
|
selector: (context, c) => Tuple4(c.viewportSize.width, c.columnCount, c.spacing, c.horizontalPadding),
|
||||||
builder: (context, c, child) {
|
builder: (context, c, child) {
|
||||||
|
|
|
@ -140,6 +140,7 @@ class _AvesFilterChipState extends State<AvesFilterChip> {
|
||||||
_subscriptions.add(settings.updateStream.where((event) => event.key == Settings.themeColorModeKey).listen((_) {
|
_subscriptions.add(settings.updateStream.where((event) => event.key == Settings.themeColorModeKey).listen((_) {
|
||||||
// delay so that contextual colors reflect the new settings
|
// delay so that contextual colors reflect the new settings
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
if (!mounted) return;
|
||||||
_onCoverColorChange(null);
|
_onCoverColorChange(null);
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -92,6 +92,7 @@ class _InteractiveFilterTileState<T extends CollectionFilter> extends State<Inte
|
||||||
setState(() => _heroTypeOverride = HeroType.always);
|
setState(() => _heroTypeOverride = HeroType.always);
|
||||||
}
|
}
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
if (!mounted) return;
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
|
|
Loading…
Reference in a new issue