This commit is contained in:
Hillel Coren 2018-12-18 21:20:42 +02:00
parent a2f0154f6e
commit 8996ffef67
4 changed files with 11 additions and 13 deletions

View File

@ -81,8 +81,7 @@ void main() async {
..addAll(createStoreInvoicesMiddleware())
..addAll(createStorePersistenceMiddleware())
// STARTER: middleware - do not remove comment
..addAll(createStoreTasksMiddleware())
..addAll(createStoreTasksMiddleware())
..addAll(createStoreProjectsMiddleware())
..addAll(createStorePaymentsMiddleware())
..addAll(createStoreQuotesMiddleware())
@ -255,13 +254,12 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
InvoiceEditScreen.route: (context) => InvoiceEditScreen(),
InvoiceEmailScreen.route: (context) => InvoiceEmailScreen(),
// STARTER: routes - do not remove comment
TaskScreen.route: (context) {
widget.store.dispatch(LoadTasks());
return TaskScreen();
},
TaskViewScreen.route: (context) => TaskViewScreen(),
TaskEditScreen.route: (context) => TaskEditScreen(),
TaskScreen.route: (context) {
widget.store.dispatch(LoadTasks());
return TaskScreen();
},
TaskViewScreen.route: (context) => TaskViewScreen(),
TaskEditScreen.route: (context) => TaskEditScreen(),
ProjectScreen.route: (context) {
widget.store.dispatch(LoadProjects());
return ProjectScreen();

View File

@ -112,7 +112,7 @@ class _ProjectViewState extends State<ProjectView> {
),
floatingActionButton: FloatingActionButton(
backgroundColor: Theme.of(context).primaryColorDark,
onPressed: viewModel.onAddTaskPressed,
onPressed: () => viewModel.onAddTaskPressed(context),
child: Icon(
Icons.add,
color: Colors.white,

View File

@ -73,7 +73,8 @@ class ProjectViewVM {
onRefreshed: (context) => _handleRefresh(context),
onClientPressed: (BuildContext context) => store
.dispatch(ViewClient(clientId: project.clientId, context: context)),
onAddTaskPressed: () => store.dispatch(EditTask(
onAddTaskPressed: (context) => store.dispatch(EditTask(
context: context,
task: TaskEntity().rebuild((b) => b
..projectId = project.id
..clientId = project.clientId))),
@ -111,7 +112,7 @@ class ProjectViewVM {
final Function(BuildContext) onEditPressed;
final Function(BuildContext) onClientPressed;
final Function onBackPressed;
final Function onAddTaskPressed;
final Function(BuildContext) onAddTaskPressed;
final Function(BuildContext) onRefreshed;
final bool isSaving;
final bool isLoading;

View File

@ -11,7 +11,6 @@ import 'package:invoiceninja_flutter/ui/task/task_screen.dart';
import 'package:invoiceninja_flutter/utils/localization.dart';
import 'package:redux/redux.dart';
import 'package:invoiceninja_flutter/ui/app/dialogs/error_dialog.dart';
import 'package:invoiceninja_flutter/ui/task/view/task_view_vm.dart';
import 'package:invoiceninja_flutter/redux/task/task_actions.dart';
import 'package:invoiceninja_flutter/data/models/task_model.dart';
import 'package:invoiceninja_flutter/ui/task/edit/task_edit.dart';