Task statuses
This commit is contained in:
parent
47a1298eb7
commit
c174442090
|
|
@ -63,36 +63,40 @@ class _CompanyGatewayListState extends State<CompanyGatewayList> {
|
|||
if (state.isSaving) LinearProgressIndicator(),
|
||||
RefreshIndicator(
|
||||
onRefresh: () => widget.viewModel.onRefreshed(context),
|
||||
child: ReorderableListView(
|
||||
scrollController: _controller,
|
||||
onReorder: (oldIndex, newIndex) {
|
||||
// https://stackoverflow.com/a/54164333/497368
|
||||
// These two lines are workarounds for ReorderableListView problems
|
||||
if (newIndex > widget.viewModel.companyGatewayList.length) {
|
||||
newIndex = widget.viewModel.companyGatewayList.length;
|
||||
}
|
||||
if (oldIndex < newIndex) {
|
||||
newIndex--;
|
||||
}
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: ReorderableListView(
|
||||
scrollController: _controller,
|
||||
onReorder: (oldIndex, newIndex) {
|
||||
// https://stackoverflow.com/a/54164333/497368
|
||||
// These two lines are workarounds for ReorderableListView problems
|
||||
if (newIndex > widget.viewModel.companyGatewayList.length) {
|
||||
newIndex = widget.viewModel.companyGatewayList.length;
|
||||
}
|
||||
if (oldIndex < newIndex) {
|
||||
newIndex--;
|
||||
}
|
||||
|
||||
widget.viewModel.onSortChanged(oldIndex, newIndex);
|
||||
},
|
||||
children:
|
||||
widget.viewModel.companyGatewayList.map((companyGatewayId) {
|
||||
final companyGateway =
|
||||
widget.viewModel.companyGatewayMap[companyGatewayId];
|
||||
return CompanyGatewayListItem(
|
||||
key: ValueKey('__company_gateway_$companyGatewayId'),
|
||||
user: state.userCompany.user,
|
||||
filter: widget.viewModel.filter,
|
||||
companyGateway: companyGateway,
|
||||
onRemovePressed: widget
|
||||
.viewModel.state.settingsUIState.isFiltered
|
||||
? () => widget.viewModel.onRemovePressed(companyGatewayId)
|
||||
: null,
|
||||
isChecked: isInMultiselect &&
|
||||
listUIState.isSelected(companyGateway.id));
|
||||
}).toList(),
|
||||
widget.viewModel.onSortChanged(oldIndex, newIndex);
|
||||
},
|
||||
children:
|
||||
widget.viewModel.companyGatewayList.map((companyGatewayId) {
|
||||
final companyGateway =
|
||||
widget.viewModel.companyGatewayMap[companyGatewayId];
|
||||
return CompanyGatewayListItem(
|
||||
key: ValueKey('__company_gateway_$companyGatewayId'),
|
||||
user: state.userCompany.user,
|
||||
filter: widget.viewModel.filter,
|
||||
companyGateway: companyGateway,
|
||||
onRemovePressed: widget
|
||||
.viewModel.state.settingsUIState.isFiltered
|
||||
? () =>
|
||||
widget.viewModel.onRemovePressed(companyGatewayId)
|
||||
: null,
|
||||
isChecked: isInMultiselect &&
|
||||
listUIState.isSelected(companyGateway.id));
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -63,35 +63,38 @@ class _TaskStatusListState extends State<TaskStatusList> {
|
|||
if (state.isSaving) LinearProgressIndicator(),
|
||||
RefreshIndicator(
|
||||
onRefresh: () => widget.viewModel.onRefreshed(context),
|
||||
child: ReorderableListView(
|
||||
scrollController: _controller,
|
||||
onReorder: (oldIndex, newIndex) {
|
||||
// https://stackoverflow.com/a/54164333/497368
|
||||
// These two lines are workarounds for ReorderableListView problems
|
||||
if (newIndex > widget.viewModel.taskStatusList.length) {
|
||||
newIndex = widget.viewModel.taskStatusList.length;
|
||||
}
|
||||
if (oldIndex < newIndex) {
|
||||
newIndex--;
|
||||
}
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: ReorderableListView(
|
||||
scrollController: _controller,
|
||||
onReorder: (oldIndex, newIndex) {
|
||||
// https://stackoverflow.com/a/54164333/497368
|
||||
// These two lines are workarounds for ReorderableListView problems
|
||||
if (newIndex > widget.viewModel.taskStatusList.length) {
|
||||
newIndex = widget.viewModel.taskStatusList.length;
|
||||
}
|
||||
if (oldIndex < newIndex) {
|
||||
newIndex--;
|
||||
}
|
||||
|
||||
widget.viewModel.onSortChanged(oldIndex, newIndex);
|
||||
},
|
||||
children: viewModel.taskStatusList.map((taskStatusId) {
|
||||
final taskStatus = viewModel.taskStatusMap[taskStatusId];
|
||||
return TaskStatusListItem(
|
||||
key: ValueKey('__task_status_$taskStatusId'),
|
||||
user: state.userCompany.user,
|
||||
filter: viewModel.filter,
|
||||
taskStatus: taskStatus,
|
||||
/*
|
||||
onRemovePressed: widget.viewModel.state.settingsUIState.isFiltered
|
||||
? () => widget.viewModel.onRemovePressed(companyGatewayId)
|
||||
: null,
|
||||
*/
|
||||
isChecked:
|
||||
isInMultiselect && listUIState.isSelected(taskStatus.id));
|
||||
}).toList(),
|
||||
widget.viewModel.onSortChanged(oldIndex, newIndex);
|
||||
},
|
||||
children: viewModel.taskStatusList.map((taskStatusId) {
|
||||
final taskStatus = viewModel.taskStatusMap[taskStatusId];
|
||||
return TaskStatusListItem(
|
||||
key: ValueKey('__task_status_$taskStatusId'),
|
||||
user: state.userCompany.user,
|
||||
filter: viewModel.filter,
|
||||
taskStatus: taskStatus,
|
||||
/*
|
||||
onRemovePressed: widget.viewModel.state.settingsUIState.isFiltered
|
||||
? () => widget.viewModel.onRemovePressed(companyGatewayId)
|
||||
: null,
|
||||
*/
|
||||
isChecked: isInMultiselect &&
|
||||
listUIState.isSelected(taskStatus.id));
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
|
|||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/task_status/task_status_actions.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/app_bottom_bar.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/buttons/app_text_button.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/entities/entity_actions_dialog.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/list_filter.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/list_scaffold.dart';
|
||||
|
|
@ -65,22 +66,24 @@ class TaskStatusScreen extends StatelessWidget {
|
|||
},
|
||||
appBarActions: [
|
||||
if (viewModel.isInMultiselect)
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
final taskStatusIds = listUIState.selectedIds
|
||||
.map<TaskStatusEntity>(
|
||||
(taskStatusId) => viewModel.taskStatusMap[taskStatusId])
|
||||
.toList();
|
||||
AppTextButton(
|
||||
isInHeader: true,
|
||||
onPressed: () async {
|
||||
final taskStatusIds = listUIState.selectedIds
|
||||
.map<TaskStatusEntity>(
|
||||
(taskStatusId) => viewModel.taskStatusMap[taskStatusId])
|
||||
.toList();
|
||||
|
||||
await showEntityActionsDialog(
|
||||
entities: taskStatusIds,
|
||||
multiselect: true,
|
||||
completer: Completer<Null>()
|
||||
..future.then<dynamic>(
|
||||
(_) => store.dispatch(ClearTaskStatusMultiselect())),
|
||||
);
|
||||
},
|
||||
child: Text(localization.actions)),
|
||||
await showEntityActionsDialog(
|
||||
entities: taskStatusIds,
|
||||
multiselect: true,
|
||||
completer: Completer<Null>()
|
||||
..future.then<dynamic>(
|
||||
(_) => store.dispatch(ClearTaskStatusMultiselect())),
|
||||
);
|
||||
},
|
||||
label: localization.actions,
|
||||
),
|
||||
],
|
||||
body: TaskStatusListBuilder(),
|
||||
bottomNavigationBar: AppBottomBar(
|
||||
|
|
|
|||
Loading…
Reference in New Issue