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