Cancel button for client settings doesn't work #494

This commit is contained in:
Hillel Coren 2023-06-04 16:50:18 +03:00
parent 51f02b9cd7
commit 22eb7d4782
4 changed files with 34 additions and 18 deletions

View File

@ -551,6 +551,9 @@ Reducer<BuiltList<HistoryRecord>> historyReducer = combineReducers([
TypedReducer<BuiltList<HistoryRecord>, ViewClient>((historyList, action) =>
_addToHistory(historyList,
HistoryRecord(id: action.clientId, entityType: EntityType.client))),
TypedReducer<BuiltList<HistoryRecord>, ViewClientList>((historyList,
action) =>
_addToHistory(historyList, HistoryRecord(entityType: EntityType.client))),
TypedReducer<BuiltList<HistoryRecord>, EditClient>((historyList, action) =>
_addToHistory(historyList,
HistoryRecord(id: action.client.id, entityType: EntityType.client))),

View File

@ -132,6 +132,8 @@ class _HistoryListTileState extends State<HistoryListTile> {
style: Theme.of(context).textTheme.bodySmall,
);
}
} else if (history.id == null) {
title = Text(localization.lookup(history.entityType.plural));
} else {
entity = state.getEntityMap(history.entityType)[history.id] as BaseEntity;
@ -241,10 +243,14 @@ class _HistoryListTileState extends State<HistoryListTile> {
));
break;
default:
viewEntityById(
entityId: history.id,
entityType: history.entityType,
);
if (history.id == null) {
viewEntitiesByType(entityType: history.entityType);
} else {
viewEntityById(
entityId: history.id,
entityType: history.entityType,
);
}
}
},
onLongPress: entity == null

View File

@ -274,11 +274,9 @@ class MainScreen extends StatelessWidget {
].contains(item.entityType)) {
history = item;
break;
} else if (item.id == null) {
history = item;
} else {
if (item.id == null) {
continue;
}
final entity =
state.getEntityMap(item.entityType)[item.id] as BaseEntity;
if (entity == null || !entity.isActive) {
@ -314,11 +312,15 @@ class MainScreen extends StatelessWidget {
));
break;
default:
viewEntityById(
entityId: history.id,
entityType: history.entityType,
showError: false,
);
if (history.id == null) {
viewEntitiesByType(entityType: history.entityType);
} else {
viewEntityById(
entityId: history.id,
entityType: history.entityType,
showError: false,
);
}
}
return false;

View File

@ -132,11 +132,16 @@ class _MenuDrawerState extends State<MenuDrawer> {
));
break;
default:
viewEntityById(
entityId: history.id,
entityType: history.entityType,
showError: false,
);
if (history.id == null) {
viewEntitiesByType(
entityType: history.entityType);
} else {
viewEntityById(
entityId: history.id,
entityType: history.entityType,
showError: false,
);
}
}
},
icon: Icon(MdiIcons.arrowLeftCircleOutline))