1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-03-01 15:11:21 +01:00

fix(mobile): set scrolling state only if changed (#3034)

* fix(mobile): set scrolling state only if changed

* fix: generate api

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
Fynn Petersen-Frey 2023-06-29 21:35:29 +02:00 committed by GitHub
parent e3557fd80e
commit ff26d3666e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 40 additions and 34 deletions

View file

@ -311,7 +311,13 @@ class ImmichAssetGridViewState extends State<ImmichAssetGridView> {
Widget _buildAssetGrid() { Widget _buildAssetGrid() {
final useDragScrolling = widget.renderList.totalAssets >= 20; final useDragScrolling = widget.renderList.totalAssets >= 20;
void dragScrolling(bool active) => _scrolling = active; void dragScrolling(bool active) {
if (active != _scrolling) {
setState(() {
_scrolling = active;
});
}
}
final listWidget = ScrollablePositionedList.builder( final listWidget = ScrollablePositionedList.builder(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(

View file

@ -72,7 +72,7 @@ class AdminSignupResponseDto {
email: mapValueOfType<String>(json, r'email')!, email: mapValueOfType<String>(json, r'email')!,
firstName: mapValueOfType<String>(json, r'firstName')!, firstName: mapValueOfType<String>(json, r'firstName')!,
lastName: mapValueOfType<String>(json, r'lastName')!, lastName: mapValueOfType<String>(json, r'lastName')!,
createdAt: mapDateTime(json, r'createdAt', '')!, createdAt: mapDateTime(json, r'createdAt', r'')!,
); );
} }
return null; return null;

View file

@ -128,14 +128,14 @@ class AlbumResponseDto {
id: mapValueOfType<String>(json, r'id')!, id: mapValueOfType<String>(json, r'id')!,
ownerId: mapValueOfType<String>(json, r'ownerId')!, ownerId: mapValueOfType<String>(json, r'ownerId')!,
albumName: mapValueOfType<String>(json, r'albumName')!, albumName: mapValueOfType<String>(json, r'albumName')!,
createdAt: mapDateTime(json, r'createdAt', '')!, createdAt: mapDateTime(json, r'createdAt', r'')!,
updatedAt: mapDateTime(json, r'updatedAt', '')!, updatedAt: mapDateTime(json, r'updatedAt', r'')!,
albumThumbnailAssetId: mapValueOfType<String>(json, r'albumThumbnailAssetId'), albumThumbnailAssetId: mapValueOfType<String>(json, r'albumThumbnailAssetId'),
shared: mapValueOfType<bool>(json, r'shared')!, shared: mapValueOfType<bool>(json, r'shared')!,
sharedUsers: UserResponseDto.listFromJson(json[r'sharedUsers']), sharedUsers: UserResponseDto.listFromJson(json[r'sharedUsers']),
assets: AssetResponseDto.listFromJson(json[r'assets']), assets: AssetResponseDto.listFromJson(json[r'assets']),
owner: UserResponseDto.fromJson(json[r'owner'])!, owner: UserResponseDto.fromJson(json[r'owner'])!,
lastModifiedAssetTimestamp: mapDateTime(json, r'lastModifiedAssetTimestamp', ''), lastModifiedAssetTimestamp: mapDateTime(json, r'lastModifiedAssetTimestamp', r''),
); );
} }
return null; return null;

View file

@ -64,8 +64,8 @@ class APIKeyResponseDto {
return APIKeyResponseDto( return APIKeyResponseDto(
id: mapValueOfType<String>(json, r'id')!, id: mapValueOfType<String>(json, r'id')!,
name: mapValueOfType<String>(json, r'name')!, name: mapValueOfType<String>(json, r'name')!,
createdAt: mapDateTime(json, r'createdAt', '')!, createdAt: mapDateTime(json, r'createdAt', r'')!,
updatedAt: mapDateTime(json, r'updatedAt', '')!, updatedAt: mapDateTime(json, r'updatedAt', r'')!,
); );
} }
return null; return null;

View file

@ -213,9 +213,9 @@ class AssetResponseDto {
originalFileName: mapValueOfType<String>(json, r'originalFileName')!, originalFileName: mapValueOfType<String>(json, r'originalFileName')!,
resized: mapValueOfType<bool>(json, r'resized')!, resized: mapValueOfType<bool>(json, r'resized')!,
thumbhash: mapValueOfType<String>(json, r'thumbhash'), thumbhash: mapValueOfType<String>(json, r'thumbhash'),
fileCreatedAt: mapDateTime(json, r'fileCreatedAt', '')!, fileCreatedAt: mapDateTime(json, r'fileCreatedAt', r'')!,
fileModifiedAt: mapDateTime(json, r'fileModifiedAt', '')!, fileModifiedAt: mapDateTime(json, r'fileModifiedAt', r'')!,
updatedAt: mapDateTime(json, r'updatedAt', '')!, updatedAt: mapDateTime(json, r'updatedAt', r'')!,
isFavorite: mapValueOfType<bool>(json, r'isFavorite')!, isFavorite: mapValueOfType<bool>(json, r'isFavorite')!,
isArchived: mapValueOfType<bool>(json, r'isArchived')!, isArchived: mapValueOfType<bool>(json, r'isArchived')!,
mimeType: mapValueOfType<String>(json, r'mimeType'), mimeType: mapValueOfType<String>(json, r'mimeType'),

View file

@ -243,31 +243,31 @@ class ExifResponseDto {
model: mapValueOfType<String>(json, r'model'), model: mapValueOfType<String>(json, r'model'),
exifImageWidth: json[r'exifImageWidth'] == null exifImageWidth: json[r'exifImageWidth'] == null
? null ? null
: num.parse(json[r'exifImageWidth'].toString()), : num.parse('${json[r'exifImageWidth']}'),
exifImageHeight: json[r'exifImageHeight'] == null exifImageHeight: json[r'exifImageHeight'] == null
? null ? null
: num.parse(json[r'exifImageHeight'].toString()), : num.parse('${json[r'exifImageHeight']}'),
orientation: mapValueOfType<String>(json, r'orientation'), orientation: mapValueOfType<String>(json, r'orientation'),
dateTimeOriginal: mapDateTime(json, r'dateTimeOriginal', ''), dateTimeOriginal: mapDateTime(json, r'dateTimeOriginal', r''),
modifyDate: mapDateTime(json, r'modifyDate', ''), modifyDate: mapDateTime(json, r'modifyDate', r''),
timeZone: mapValueOfType<String>(json, r'timeZone'), timeZone: mapValueOfType<String>(json, r'timeZone'),
lensModel: mapValueOfType<String>(json, r'lensModel'), lensModel: mapValueOfType<String>(json, r'lensModel'),
fNumber: json[r'fNumber'] == null fNumber: json[r'fNumber'] == null
? null ? null
: num.parse(json[r'fNumber'].toString()), : num.parse('${json[r'fNumber']}'),
focalLength: json[r'focalLength'] == null focalLength: json[r'focalLength'] == null
? null ? null
: num.parse(json[r'focalLength'].toString()), : num.parse('${json[r'focalLength']}'),
iso: json[r'iso'] == null iso: json[r'iso'] == null
? null ? null
: num.parse(json[r'iso'].toString()), : num.parse('${json[r'iso']}'),
exposureTime: mapValueOfType<String>(json, r'exposureTime'), exposureTime: mapValueOfType<String>(json, r'exposureTime'),
latitude: json[r'latitude'] == null latitude: json[r'latitude'] == null
? null ? null
: num.parse(json[r'latitude'].toString()), : num.parse('${json[r'latitude']}'),
longitude: json[r'longitude'] == null longitude: json[r'longitude'] == null
? null ? null
: num.parse(json[r'longitude'].toString()), : num.parse('${json[r'longitude']}'),
city: mapValueOfType<String>(json, r'city'), city: mapValueOfType<String>(json, r'city'),
state: mapValueOfType<String>(json, r'state'), state: mapValueOfType<String>(json, r'state'),
country: mapValueOfType<String>(json, r'country'), country: mapValueOfType<String>(json, r'country'),

View file

@ -156,8 +156,8 @@ class ImportAssetDto {
sidecarPath: mapValueOfType<String>(json, r'sidecarPath'), sidecarPath: mapValueOfType<String>(json, r'sidecarPath'),
deviceAssetId: mapValueOfType<String>(json, r'deviceAssetId')!, deviceAssetId: mapValueOfType<String>(json, r'deviceAssetId')!,
deviceId: mapValueOfType<String>(json, r'deviceId')!, deviceId: mapValueOfType<String>(json, r'deviceId')!,
fileCreatedAt: mapDateTime(json, r'fileCreatedAt', '')!, fileCreatedAt: mapDateTime(json, r'fileCreatedAt', r'')!,
fileModifiedAt: mapDateTime(json, r'fileModifiedAt', '')!, fileModifiedAt: mapDateTime(json, r'fileModifiedAt', r'')!,
isFavorite: mapValueOfType<bool>(json, r'isFavorite')!, isFavorite: mapValueOfType<bool>(json, r'isFavorite')!,
isArchived: mapValueOfType<bool>(json, r'isArchived'), isArchived: mapValueOfType<bool>(json, r'isArchived'),
isVisible: mapValueOfType<bool>(json, r'isVisible'), isVisible: mapValueOfType<bool>(json, r'isVisible'),

View file

@ -116,7 +116,7 @@ class SharedLinkCreateDto {
: const [], : const [],
albumId: mapValueOfType<String>(json, r'albumId'), albumId: mapValueOfType<String>(json, r'albumId'),
description: mapValueOfType<String>(json, r'description'), description: mapValueOfType<String>(json, r'description'),
expiresAt: mapDateTime(json, r'expiresAt', ''), expiresAt: mapDateTime(json, r'expiresAt', r''),
allowUpload: mapValueOfType<bool>(json, r'allowUpload') ?? false, allowUpload: mapValueOfType<bool>(json, r'allowUpload') ?? false,
allowDownload: mapValueOfType<bool>(json, r'allowDownload') ?? true, allowDownload: mapValueOfType<bool>(json, r'allowDownload') ?? true,
showExif: mapValueOfType<bool>(json, r'showExif') ?? true, showExif: mapValueOfType<bool>(json, r'showExif') ?? true,

View file

@ -113,7 +113,7 @@ class SharedLinkEditDto {
return SharedLinkEditDto( return SharedLinkEditDto(
description: mapValueOfType<String>(json, r'description'), description: mapValueOfType<String>(json, r'description'),
expiresAt: mapDateTime(json, r'expiresAt', ''), expiresAt: mapDateTime(json, r'expiresAt', r''),
allowUpload: mapValueOfType<bool>(json, r'allowUpload'), allowUpload: mapValueOfType<bool>(json, r'allowUpload'),
allowDownload: mapValueOfType<bool>(json, r'allowDownload'), allowDownload: mapValueOfType<bool>(json, r'allowDownload'),
showExif: mapValueOfType<bool>(json, r'showExif'), showExif: mapValueOfType<bool>(json, r'showExif'),

View file

@ -133,8 +133,8 @@ class SharedLinkResponseDto {
description: mapValueOfType<String>(json, r'description'), description: mapValueOfType<String>(json, r'description'),
userId: mapValueOfType<String>(json, r'userId')!, userId: mapValueOfType<String>(json, r'userId')!,
key: mapValueOfType<String>(json, r'key')!, key: mapValueOfType<String>(json, r'key')!,
createdAt: mapDateTime(json, r'createdAt', '')!, createdAt: mapDateTime(json, r'createdAt', r'')!,
expiresAt: mapDateTime(json, r'expiresAt', ''), expiresAt: mapDateTime(json, r'expiresAt', r''),
assets: AssetResponseDto.listFromJson(json[r'assets']), assets: AssetResponseDto.listFromJson(json[r'assets']),
album: AlbumResponseDto.fromJson(json[r'album']), album: AlbumResponseDto.fromJson(json[r'album']),
allowUpload: mapValueOfType<bool>(json, r'allowUpload')!, allowUpload: mapValueOfType<bool>(json, r'allowUpload')!,

View file

@ -137,9 +137,9 @@ class UserResponseDto {
profileImagePath: mapValueOfType<String>(json, r'profileImagePath')!, profileImagePath: mapValueOfType<String>(json, r'profileImagePath')!,
shouldChangePassword: mapValueOfType<bool>(json, r'shouldChangePassword')!, shouldChangePassword: mapValueOfType<bool>(json, r'shouldChangePassword')!,
isAdmin: mapValueOfType<bool>(json, r'isAdmin')!, isAdmin: mapValueOfType<bool>(json, r'isAdmin')!,
createdAt: mapDateTime(json, r'createdAt', '')!, createdAt: mapDateTime(json, r'createdAt', r'')!,
deletedAt: mapDateTime(json, r'deletedAt', ''), deletedAt: mapDateTime(json, r'deletedAt', r''),
updatedAt: mapDateTime(json, r'updatedAt', '')!, updatedAt: mapDateTime(json, r'updatedAt', r'')!,
oauthId: mapValueOfType<String>(json, r'oauthId')!, oauthId: mapValueOfType<String>(json, r'oauthId')!,
); );
} }

View file

@ -66,7 +66,7 @@ class {{{classname}}} {
{{/isNullable}} {{/isNullable}}
{{#isDateTime}} {{#isDateTime}}
{{#pattern}} {{#pattern}}
json[r'{{{baseName}}}'] = _dateEpochMarker == '{{{pattern}}}' json[r'{{{baseName}}}'] = _isEpochMarker(r'{{{pattern}}}')
? this.{{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.millisecondsSinceEpoch ? this.{{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.millisecondsSinceEpoch
: this.{{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc().toIso8601String(); : this.{{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc().toIso8601String();
{{/pattern}} {{/pattern}}
@ -76,7 +76,7 @@ class {{{classname}}} {
{{/isDateTime}} {{/isDateTime}}
{{#isDate}} {{#isDate}}
{{#pattern}} {{#pattern}}
json[r'{{{baseName}}}'] = _dateEpochMarker == '{{{pattern}}}' json[r'{{{baseName}}}'] = _isEpochMarker(r'{{{pattern}}}')
? this.{{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.millisecondsSinceEpoch ? this.{{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.millisecondsSinceEpoch
: _dateFormatter.format(this.{{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc()); : _dateFormatter.format(this.{{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc());
{{/pattern}} {{/pattern}}
@ -117,10 +117,10 @@ class {{{classname}}} {
return {{{classname}}}( return {{{classname}}}(
{{#vars}} {{#vars}}
{{#isDateTime}} {{#isDateTime}}
{{{name}}}: mapDateTime(json, r'{{{baseName}}}', '{{{pattern}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, {{{name}}}: mapDateTime(json, r'{{{baseName}}}', r'{{{pattern}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
{{/isDateTime}} {{/isDateTime}}
{{#isDate}} {{#isDate}}
{{{name}}}: mapDateTime(json, r'{{{baseName}}}', '{{{pattern}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, {{{name}}}: mapDateTime(json, r'{{{baseName}}}', r'{{{pattern}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
{{/isDate}} {{/isDate}}
{{^isDateTime}} {{^isDateTime}}
{{^isDate}} {{^isDate}}
@ -200,9 +200,9 @@ class {{{classname}}} {
{{/isMap}} {{/isMap}}
{{^isMap}} {{^isMap}}
{{#isNumber}} {{#isNumber}}
{{{name}}}: json[r'{{{baseName}}}'] == null {{{name}}}: {{#isNullable}}json[r'{{{baseName}}}'] == null
? {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}} ? {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}
: {{{datatypeWithEnum}}}.parse(json[r'{{{baseName}}}'].toString()), : {{/isNullable}}{{{datatypeWithEnum}}}.parse('${json[r'{{{baseName}}}']}'),
{{/isNumber}} {{/isNumber}}
{{^isNumber}} {{^isNumber}}
{{^isEnum}} {{^isEnum}}