mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-22 16:56:19 +01:00
Refactor: extract fn
This commit is contained in:
parent
cf46af142c
commit
b82f83a23a
6 changed files with 26 additions and 72 deletions
|
@ -17,6 +17,7 @@ import 'package:nc_photos/use_case/import_pending_shared_album.dart';
|
|||
import 'package:nc_photos/use_case/update_album.dart';
|
||||
import 'package:nc_photos/widget/album_browser_app_bar.dart';
|
||||
import 'package:nc_photos/widget/album_browser_util.dart' as album_browser_util;
|
||||
import 'package:nc_photos/widget/photo_list_util.dart' as photo_list_util;
|
||||
import 'package:nc_photos/widget/selectable_item_stream_list_mixin.dart';
|
||||
import 'package:nc_photos/widget/selection_app_bar.dart';
|
||||
import 'package:nc_photos/widget/zoom_menu_button.dart';
|
||||
|
@ -163,19 +164,7 @@ mixin AlbumBrowserMixin<T extends StatefulWidget>
|
|||
}
|
||||
|
||||
@protected
|
||||
int get thumbSize {
|
||||
switch (_thumbZoomLevel) {
|
||||
case 1:
|
||||
return 176;
|
||||
|
||||
case 2:
|
||||
return 256;
|
||||
|
||||
case 0:
|
||||
default:
|
||||
return 112;
|
||||
}
|
||||
}
|
||||
int get thumbSize => photo_list_util.getThumbSize(_thumbZoomLevel);
|
||||
|
||||
void _onMenuOptionSelected(int option, Account account, Album album,
|
||||
void Function(int)? onSelectedMenuItem) {
|
||||
|
|
|
@ -20,6 +20,7 @@ import 'package:nc_photos/theme.dart';
|
|||
import 'package:nc_photos/use_case/update_property.dart';
|
||||
import 'package:nc_photos/widget/empty_list_indicator.dart';
|
||||
import 'package:nc_photos/widget/photo_list_item.dart';
|
||||
import 'package:nc_photos/widget/photo_list_util.dart' as photo_list_util;
|
||||
import 'package:nc_photos/widget/selectable_item_stream_list_mixin.dart';
|
||||
import 'package:nc_photos/widget/selection_app_bar.dart';
|
||||
import 'package:nc_photos/widget/viewer.dart';
|
||||
|
@ -294,25 +295,12 @@ class _ArchiveBrowserState extends State<ArchiveBrowser>
|
|||
_bloc.add(const ScanAccountDirBlocQuery());
|
||||
}
|
||||
|
||||
int get _thumbSize {
|
||||
switch (_thumbZoomLevel) {
|
||||
case 1:
|
||||
return 176;
|
||||
|
||||
case 2:
|
||||
return 256;
|
||||
|
||||
case 0:
|
||||
default:
|
||||
return 112;
|
||||
}
|
||||
}
|
||||
|
||||
late final _bloc = ScanAccountDirBloc.of(widget.account);
|
||||
|
||||
var _backingFiles = <File>[];
|
||||
|
||||
var _thumbZoomLevel = 0;
|
||||
int get _thumbSize => photo_list_util.getThumbSize(_thumbZoomLevel);
|
||||
|
||||
static final _log = Logger("widget.archive_browser._ArchiveBrowserState");
|
||||
}
|
||||
|
|
|
@ -612,23 +612,6 @@ class _HomePhotosState extends State<HomePhotos>
|
|||
return " ($clippedCount/$_metadataTaskProcessTotalCount)";
|
||||
}
|
||||
|
||||
int get _thumbSize {
|
||||
switch (_thumbZoomLevel) {
|
||||
case -1:
|
||||
return 96;
|
||||
|
||||
case 1:
|
||||
return 176;
|
||||
|
||||
case 2:
|
||||
return 256;
|
||||
|
||||
case 0:
|
||||
default:
|
||||
return 112;
|
||||
}
|
||||
}
|
||||
|
||||
Primitive<bool> get _hasFiredMetadataTask {
|
||||
final blocId =
|
||||
"${widget.account.scheme}://${widget.account.username}@${widget.account.address}";
|
||||
|
@ -651,6 +634,7 @@ class _HomePhotosState extends State<HomePhotos>
|
|||
var _backingFiles = <File>[];
|
||||
|
||||
var _thumbZoomLevel = 0;
|
||||
int get _thumbSize => photo_list_util.getThumbSize(_thumbZoomLevel);
|
||||
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ import 'package:nc_photos/use_case/update_property.dart';
|
|||
import 'package:nc_photos/widget/handler/add_selection_to_album_handler.dart';
|
||||
import 'package:nc_photos/widget/handler/remove_selection_handler.dart';
|
||||
import 'package:nc_photos/widget/photo_list_item.dart';
|
||||
import 'package:nc_photos/widget/photo_list_util.dart' as photo_list_util;
|
||||
import 'package:nc_photos/widget/selectable_item_stream_list_mixin.dart';
|
||||
import 'package:nc_photos/widget/selection_app_bar.dart';
|
||||
import 'package:nc_photos/widget/viewer.dart';
|
||||
|
@ -450,24 +451,11 @@ class _PersonBrowserState extends State<PersonBrowser>
|
|||
_bloc.add(ListFaceBlocQuery(widget.account, widget.person));
|
||||
}
|
||||
|
||||
int get _thumbSize {
|
||||
switch (_thumbZoomLevel) {
|
||||
case 1:
|
||||
return 176;
|
||||
|
||||
case 2:
|
||||
return 256;
|
||||
|
||||
case 0:
|
||||
default:
|
||||
return 112;
|
||||
}
|
||||
}
|
||||
|
||||
final ListFaceBloc _bloc = ListFaceBloc();
|
||||
List<File>? _backingFiles;
|
||||
|
||||
var _thumbZoomLevel = 0;
|
||||
int get _thumbSize => photo_list_util.getThumbSize(_thumbZoomLevel);
|
||||
|
||||
late final Throttler _refreshThrottler = Throttler(
|
||||
onTriggered: (_) {
|
||||
|
|
|
@ -18,3 +18,20 @@ class DateGroupHelper {
|
|||
final bool isMonthOnly;
|
||||
DateTime? _currentDate;
|
||||
}
|
||||
|
||||
int getThumbSize(int zoomLevel) {
|
||||
switch (zoomLevel) {
|
||||
case -1:
|
||||
return 96;
|
||||
|
||||
case 1:
|
||||
return 176;
|
||||
|
||||
case 2:
|
||||
return 256;
|
||||
|
||||
case 0:
|
||||
default:
|
||||
return 112;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import 'package:nc_photos/use_case/restore_trashbin.dart';
|
|||
import 'package:nc_photos/widget/empty_list_indicator.dart';
|
||||
import 'package:nc_photos/widget/handler/remove_selection_handler.dart';
|
||||
import 'package:nc_photos/widget/photo_list_item.dart';
|
||||
import 'package:nc_photos/widget/photo_list_util.dart' as photo_list_util;
|
||||
import 'package:nc_photos/widget/selectable_item_stream_list_mixin.dart';
|
||||
import 'package:nc_photos/widget/selection_app_bar.dart';
|
||||
import 'package:nc_photos/widget/trashbin_viewer.dart';
|
||||
|
@ -404,25 +405,12 @@ class _TrashbinBrowserState extends State<TrashbinBrowser>
|
|||
_bloc.add(LsTrashbinBlocQuery(widget.account));
|
||||
}
|
||||
|
||||
int get _thumbSize {
|
||||
switch (_thumbZoomLevel) {
|
||||
case 1:
|
||||
return 176;
|
||||
|
||||
case 2:
|
||||
return 256;
|
||||
|
||||
case 0:
|
||||
default:
|
||||
return 112;
|
||||
}
|
||||
}
|
||||
|
||||
late LsTrashbinBloc _bloc;
|
||||
|
||||
var _backingFiles = <File>[];
|
||||
|
||||
var _thumbZoomLevel = 0;
|
||||
int get _thumbSize => photo_list_util.getThumbSize(_thumbZoomLevel);
|
||||
|
||||
static final _log = Logger("widget.trashbin_browser._TrashbinBrowserState");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue