Tablet layout

This commit is contained in:
Hillel Coren 2019-08-19 14:29:28 +03:00
parent 49d4b3c9d2
commit 8ac5642c06
3 changed files with 54 additions and 9 deletions

View File

@ -70,10 +70,18 @@ Middleware<AppState> _viewExpense() {
NextDispatcher next) async { NextDispatcher next) async {
final action = dynamicAction as ViewExpense; final action = dynamicAction as ViewExpense;
if (hasChanges(
store: store, context: action.context, force: action.force)) {
return;
}
next(action); next(action);
store.dispatch(UpdateCurrentRoute(ExpenseViewScreen.route)); store.dispatch(UpdateCurrentRoute(ExpenseViewScreen.route));
Navigator.of(action.context).pushNamed(ExpenseViewScreen.route);
if (isMobile(action.context)) {
Navigator.of(action.context).pushNamed(ExpenseViewScreen.route);
}
}; };
} }
@ -81,12 +89,19 @@ Middleware<AppState> _viewExpenseList() {
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) { return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
final action = dynamicAction as ViewExpenseList; final action = dynamicAction as ViewExpenseList;
if (hasChanges(
store: store, context: action.context, force: action.force)) {
return;
}
next(action); next(action);
store.dispatch(UpdateCurrentRoute(ExpenseScreen.route)); store.dispatch(UpdateCurrentRoute(ExpenseScreen.route));
Navigator.of(action.context).pushNamedAndRemoveUntil( if (isMobile(action.context)) {
ExpenseScreen.route, (Route<dynamic> route) => false); Navigator.of(action.context).pushNamedAndRemoveUntil(
ExpenseScreen.route, (Route<dynamic> route) => false);
}
}; };
} }

View File

@ -69,10 +69,18 @@ Middleware<AppState> _viewTask() {
NextDispatcher next) async { NextDispatcher next) async {
final action = dynamicAction as ViewTask; final action = dynamicAction as ViewTask;
if (hasChanges(
store: store, context: action.context, force: action.force)) {
return;
}
next(action); next(action);
store.dispatch(UpdateCurrentRoute(TaskViewScreen.route)); store.dispatch(UpdateCurrentRoute(TaskViewScreen.route));
Navigator.of(action.context).pushNamed(TaskViewScreen.route);
if (isMobile(action.context)) {
Navigator.of(action.context).pushNamed(TaskViewScreen.route);
}
}; };
} }
@ -80,12 +88,19 @@ Middleware<AppState> _viewTaskList() {
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) { return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
final action = dynamicAction as ViewTaskList; final action = dynamicAction as ViewTaskList;
if (hasChanges(
store: store, context: action.context, force: action.force)) {
return;
}
next(action); next(action);
store.dispatch(UpdateCurrentRoute(TaskScreen.route)); store.dispatch(UpdateCurrentRoute(TaskScreen.route));
Navigator.of(action.context).pushNamedAndRemoveUntil( if (isMobile(action.context)) {
TaskScreen.route, (Route<dynamic> route) => false); Navigator.of(action.context).pushNamedAndRemoveUntil(
TaskScreen.route, (Route<dynamic> route) => false);
}
}; };
} }

View File

@ -70,10 +70,18 @@ Middleware<AppState> _viewVendor() {
NextDispatcher next) async { NextDispatcher next) async {
final action = dynamicAction as ViewVendor; final action = dynamicAction as ViewVendor;
if (hasChanges(
store: store, context: action.context, force: action.force)) {
return;
}
next(action); next(action);
store.dispatch(UpdateCurrentRoute(VendorViewScreen.route)); store.dispatch(UpdateCurrentRoute(VendorViewScreen.route));
Navigator.of(action.context).pushNamed(VendorViewScreen.route);
if (isMobile(action.context)) {
Navigator.of(action.context).pushNamed(VendorViewScreen.route);
}
}; };
} }
@ -81,12 +89,19 @@ Middleware<AppState> _viewVendorList() {
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) { return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
final action = dynamicAction as ViewVendorList; final action = dynamicAction as ViewVendorList;
if (hasChanges(
store: store, context: action.context, force: action.force)) {
return;
}
next(action); next(action);
store.dispatch(UpdateCurrentRoute(VendorScreen.route)); store.dispatch(UpdateCurrentRoute(VendorScreen.route));
Navigator.of(action.context).pushNamedAndRemoveUntil( if (isMobile(action.context)) {
VendorScreen.route, (Route<dynamic> route) => false); Navigator.of(action.context).pushNamedAndRemoveUntil(
VendorScreen.route, (Route<dynamic> route) => false);
}
}; };
} }