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

View File

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

View File

@ -73,7 +73,8 @@ class ProjectViewVM {
onRefreshed: (context) => _handleRefresh(context), onRefreshed: (context) => _handleRefresh(context),
onClientPressed: (BuildContext context) => store onClientPressed: (BuildContext context) => store
.dispatch(ViewClient(clientId: project.clientId, context: context)), .dispatch(ViewClient(clientId: project.clientId, context: context)),
onAddTaskPressed: () => store.dispatch(EditTask( onAddTaskPressed: (context) => store.dispatch(EditTask(
context: context,
task: TaskEntity().rebuild((b) => b task: TaskEntity().rebuild((b) => b
..projectId = project.id ..projectId = project.id
..clientId = project.clientId))), ..clientId = project.clientId))),
@ -111,7 +112,7 @@ class ProjectViewVM {
final Function(BuildContext) onEditPressed; final Function(BuildContext) onEditPressed;
final Function(BuildContext) onClientPressed; final Function(BuildContext) onClientPressed;
final Function onBackPressed; final Function onBackPressed;
final Function onAddTaskPressed; final Function(BuildContext) onAddTaskPressed;
final Function(BuildContext) onRefreshed; final Function(BuildContext) onRefreshed;
final bool isSaving; final bool isSaving;
final bool isLoading; 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:invoiceninja_flutter/utils/localization.dart';
import 'package:redux/redux.dart'; import 'package:redux/redux.dart';
import 'package:invoiceninja_flutter/ui/app/dialogs/error_dialog.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/redux/task/task_actions.dart';
import 'package:invoiceninja_flutter/data/models/task_model.dart'; import 'package:invoiceninja_flutter/data/models/task_model.dart';
import 'package:invoiceninja_flutter/ui/task/edit/task_edit.dart'; import 'package:invoiceninja_flutter/ui/task/edit/task_edit.dart';