Support disabling preview
This commit is contained in:
parent
86804844d5
commit
a888cf1118
|
|
@ -109,6 +109,14 @@ abstract class PrefState implements Built<PrefState, PrefStateBuilder> {
|
|||
menuSidebarMode == AppSidebarMode.collapse &&
|
||||
!isMenuVisible;
|
||||
|
||||
bool get isListLayout {
|
||||
if (isDesktop && !isPreviewEnabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return moduleLayout == ModuleLayout.list;
|
||||
}
|
||||
|
||||
// ignore: unused_element
|
||||
static void _initializeBuilder(PrefStateBuilder builder) => builder
|
||||
..useSidebarEditor.replace(BuiltMap<EntityType, bool>())
|
||||
|
|
|
|||
|
|
@ -347,8 +347,8 @@ class _AppBottomBarState extends State<AppBottomBar> {
|
|||
return StoreBuilder(builder: (BuildContext context, Store<AppState> store) {
|
||||
final localization = AppLocalization.of(context);
|
||||
final prefState = store.state.prefState;
|
||||
final isList = prefState.moduleLayout == ModuleLayout.list ||
|
||||
widget.entityType.isSetting;
|
||||
final isList =
|
||||
widget.entityType.isSetting || state.prefState.isListLayout;
|
||||
|
||||
void _onColumnsPressed() {
|
||||
multiselectDialog(
|
||||
|
|
@ -400,7 +400,8 @@ class _AppBottomBarState extends State<AppBottomBar> {
|
|||
icon: Icon(Icons.check_box),
|
||||
onPressed: () => widget.onCheckboxPressed(),
|
||||
),
|
||||
if (!widget.entityType.isSetting)
|
||||
if (!widget.entityType.isSetting &&
|
||||
prefState.isPreviewEnabled)
|
||||
IconButton(
|
||||
tooltip: isList
|
||||
? localization.showTable
|
||||
|
|
@ -410,22 +411,24 @@ class _AppBottomBarState extends State<AppBottomBar> {
|
|||
store.dispatch(SwitchListTableLayout());
|
||||
},
|
||||
),
|
||||
if (isList && widget.sortFields.isNotEmpty)
|
||||
IconButton(
|
||||
tooltip: localization.sort,
|
||||
icon: Icon(Icons.sort_by_alpha),
|
||||
onPressed: _showSortSheet,
|
||||
),
|
||||
if (!isList && isNotMobile(context))
|
||||
IconButton(
|
||||
tooltip: localization.preview,
|
||||
icon: Icon(Icons.chrome_reader_mode),
|
||||
onPressed: () {
|
||||
store.dispatch(UpdateUserPreferences(
|
||||
isPreviewVisible:
|
||||
!state.prefState.isPreviewVisible));
|
||||
},
|
||||
),
|
||||
if (prefState.isPreviewEnabled) ...[
|
||||
if (isList && widget.sortFields.isNotEmpty)
|
||||
IconButton(
|
||||
tooltip: localization.sort,
|
||||
icon: Icon(Icons.sort_by_alpha),
|
||||
onPressed: _showSortSheet,
|
||||
),
|
||||
if (!isList && isDesktop(context))
|
||||
IconButton(
|
||||
tooltip: localization.preview,
|
||||
icon: Icon(Icons.chrome_reader_mode),
|
||||
onPressed: () {
|
||||
store.dispatch(UpdateUserPreferences(
|
||||
isPreviewVisible:
|
||||
!state.prefState.isPreviewVisible));
|
||||
},
|
||||
),
|
||||
],
|
||||
],
|
||||
IconButton(
|
||||
tooltip: localization.filter,
|
||||
|
|
|
|||
|
|
@ -104,12 +104,11 @@ class _EntityListState extends State<EntityList> {
|
|||
final uiState = state.uiState;
|
||||
final entityType = widget.entityType;
|
||||
final listUIState = state.getUIState(entityType).listUIState;
|
||||
final isList = state.prefState.moduleLayout == ModuleLayout.list ||
|
||||
entityType.isSetting;
|
||||
final isInMultiselect = listUIState.isInMultiselect();
|
||||
final entityList = widget.entityList;
|
||||
final entityMap = state.getEntityMap(entityType);
|
||||
final countSelected = (listUIState.selectedIds ?? <String>[]).length;
|
||||
final isList = entityType.isSetting || state.prefState.isListLayout;
|
||||
|
||||
if (!state.isLoaded && entityList.isEmpty) {
|
||||
return LoadingIndicator();
|
||||
|
|
|
|||
|
|
@ -99,8 +99,8 @@ class _DeviceSettingsState extends State<DeviceSettings> {
|
|||
onChanged: (value) {
|
||||
viewModel.onPreviewSidebarChanged(context, value);
|
||||
},
|
||||
enabledLabel: localization.disabled,
|
||||
disabledLabel: localization.enabled,
|
||||
enabledLabel: localization.enabled,
|
||||
disabledLabel: localization.disabled,
|
||||
),
|
||||
],
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in New Issue