Implement desktop client layout
This commit is contained in:
parent
af62837d57
commit
bc60811aaf
|
|
@ -203,6 +203,8 @@ class EntityType extends EnumClass {
|
||||||
|
|
||||||
String get snakeCase => toSnakeCase(toString());
|
String get snakeCase => toSnakeCase(toString());
|
||||||
|
|
||||||
|
bool get hasFullWidthViewer => [EntityType.client].contains(this);
|
||||||
|
|
||||||
static BuiltSet<EntityType> get values => _$typeValues;
|
static BuiltSet<EntityType> get values => _$typeValues;
|
||||||
|
|
||||||
static EntityType valueOf(String name) => _$typeValueOf(name);
|
static EntityType valueOf(String name) => _$typeValueOf(name);
|
||||||
|
|
|
||||||
|
|
@ -125,6 +125,12 @@ class ToggleEditorLayout implements PersistPrefs {
|
||||||
final EntityType entityType;
|
final EntityType entityType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ToggleViewerLayout implements PersistPrefs {
|
||||||
|
ToggleViewerLayout(this.entityType);
|
||||||
|
|
||||||
|
final EntityType entityType;
|
||||||
|
}
|
||||||
|
|
||||||
class TogglePreviewSidebar {}
|
class TogglePreviewSidebar {}
|
||||||
|
|
||||||
class UpdateUserPreferences implements PersistPrefs {
|
class UpdateUserPreferences implements PersistPrefs {
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,8 @@ PrefState prefReducer(
|
||||||
..customColors.replace(customColorsReducer(state.customColors, action))
|
..customColors.replace(customColorsReducer(state.customColors, action))
|
||||||
..useSidebarEditor
|
..useSidebarEditor
|
||||||
.replace(sidebarEditorReducer(state.useSidebarEditor, action))
|
.replace(sidebarEditorReducer(state.useSidebarEditor, action))
|
||||||
|
..useSidebarViewer
|
||||||
|
.replace(sidebarViewerReducer(state.useSidebarViewer, action))
|
||||||
..sortFields.replace(sortFieldsReducer(state.sortFields, action))
|
..sortFields.replace(sortFieldsReducer(state.sortFields, action))
|
||||||
..editAfterSaving = editAfterSavingReducer(state.editAfterSaving, action)
|
..editAfterSaving = editAfterSavingReducer(state.editAfterSaving, action)
|
||||||
..enableTouchEvents =
|
..enableTouchEvents =
|
||||||
|
|
@ -172,6 +174,17 @@ Reducer<BuiltMap<EntityType, bool>> sidebarEditorReducer = combineReducers([
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
Reducer<BuiltMap<EntityType, bool>> sidebarViewerReducer = combineReducers([
|
||||||
|
TypedReducer<BuiltMap<EntityType, bool>, ToggleViewerLayout>((value, action) {
|
||||||
|
final entityType = action.entityType.baseType;
|
||||||
|
if (value.containsKey(entityType)) {
|
||||||
|
return value.rebuild((b) => b..[entityType] = !value[entityType]);
|
||||||
|
} else {
|
||||||
|
return value.rebuild((b) => b..[entityType] = true);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
]);
|
||||||
|
|
||||||
Reducer<bool> menuVisibleReducer = combineReducers([
|
Reducer<bool> menuVisibleReducer = combineReducers([
|
||||||
TypedReducer<bool, UpdateUserPreferences>((value, action) {
|
TypedReducer<bool, UpdateUserPreferences>((value, action) {
|
||||||
return action.sidebar == AppSidebar.menu ? !value : value;
|
return action.sidebar == AppSidebar.menu ? !value : value;
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import 'package:flutter_redux/flutter_redux.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/icon_text.dart';
|
import 'package:invoiceninja_flutter/ui/app/icon_text.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/screen_imports.dart';
|
import 'package:invoiceninja_flutter/ui/app/screen_imports.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/icons.dart';
|
import 'package:invoiceninja_flutter/utils/icons.dart';
|
||||||
|
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||||
import 'package:overflow_view/overflow_view.dart';
|
import 'package:overflow_view/overflow_view.dart';
|
||||||
|
|
||||||
// Project imports:
|
// Project imports:
|
||||||
|
|
@ -215,9 +216,17 @@ class EntityTopFilter extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
SizedBox(width: 4),
|
||||||
if (!prefState
|
if (!prefState
|
||||||
.isViewerFullScreen(filterEntityType)) ...[
|
.isViewerFullScreen(filterEntityType)) ...[
|
||||||
SizedBox(width: 4),
|
if (filterEntityType.hasFullWidthViewer)
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
store.dispatch(ToggleViewerLayout(
|
||||||
|
uiState.filterEntityType));
|
||||||
|
},
|
||||||
|
icon: Icon(MdiIcons.chevronDown),
|
||||||
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.clear,
|
Icons.clear,
|
||||||
|
|
@ -227,8 +236,14 @@ class EntityTopFilter extends StatelessWidget {
|
||||||
FilterByEntity(entity: uiState.filterEntity),
|
FilterByEntity(entity: uiState.filterEntity),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 4),
|
] else
|
||||||
],
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
store.dispatch(
|
||||||
|
ToggleViewerLayout(uiState.filterEntityType));
|
||||||
|
},
|
||||||
|
icon: Icon(MdiIcons.chevronUp),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -389,7 +404,6 @@ class EntityTopFilterHeader extends StatelessWidget {
|
||||||
FilterByEntity(entity: uiState.filterEntity),
|
FilterByEntity(entity: uiState.filterEntity),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 4),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/dashboard/dashboard_actions.dart';
|
import 'package:invoiceninja_flutter/redux/dashboard/dashboard_actions.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/settings/settings_actions.dart';
|
import 'package:invoiceninja_flutter/redux/settings/settings_actions.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
|
||||||
import 'package:invoiceninja_flutter/ui/app/app_bottom_bar.dart';
|
import 'package:invoiceninja_flutter/ui/app/app_bottom_bar.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/history_drawer_vm.dart';
|
import 'package:invoiceninja_flutter/ui/app/history_drawer_vm.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue