From 4b699c792f915bcd56bccd05f7835b20f348af66 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 30 Oct 2019 17:39:34 +0200 Subject: [PATCH] Settings --- lib/ui/user/user_list.dart | 95 +------------------------------------- stubs/ui/stub/stub_list | 94 ------------------------------------- 2 files changed, 1 insertion(+), 188 deletions(-) diff --git a/lib/ui/user/user_list.dart b/lib/ui/user/user_list.dart index b305a44ae..8f8e11d64 100644 --- a/lib/ui/user/user_list.dart +++ b/lib/ui/user/user_list.dart @@ -55,7 +55,7 @@ class UserList extends StatelessWidget { onEntityAction: viewModel.onEntityAction); return UserListItem( - user: viewModel.userCompany.user, + user: user, filter: viewModel.filter, onTap: () => viewModel.onUserTap(context, user), onEntityAction: (EntityAction action) { @@ -72,99 +72,6 @@ class UserList extends StatelessWidget { ), ), ), - - /* - filteredClient != null - ? Material( - color: Colors.orangeAccent, - elevation: 6.0, - child: InkWell( - onTap: () => viewModel.onViewEntityFilterPressed(context), - child: Row( - children: [ - SizedBox(width: 18.0), - Expanded( - child: Text( - '${localization.filteredBy} ${filteredClient.listDisplayName}', - style: TextStyle( - color: Colors.white, - fontSize: 16.0, - ), - ), - ), - IconButton( - icon: Icon( - Icons.close, - color: Colors.white, - ), - onPressed: () => viewModel.onClearEntityFilterPressed(), - ) - ], - ), - ), - ) - : Container(), - Expanded( - child: !viewModel.isLoaded - ? LoadingIndicator() - : RefreshIndicator( - onRefresh: () => viewModel.onRefreshed(context), - child: viewModel.userList.isEmpty - ? HelpText(AppLocalization.of(context).noRecordsFound) - : ListView.separated( - shrinkWrap: true, - separatorBuilder: (context, index) => ListDivider(), - itemCount: viewModel.userList.length, - itemBuilder: (BuildContext context, index) { - final user = viewModel.user; - final userId = viewModel.userList[index]; - final user = viewModel.userMap[userId]; - final client = - viewModel.clientMap[user.clientId] ?? - ClientEntity(); - - - void showDialog() => showEntityActionsDialog( - entity: user, - context: context, - user: user, - onEntityAction: viewModel.onEntityAction); - - - - return UserListItem( - user: viewModel.user, - filter: viewModel.filter, - user: user, - client: - viewModel.clientMap[user.clientId] ?? - ClientEntity(), - onTap: () => - viewModel.onUserTap(context, user), - onEntityAction: (EntityAction action) { - if (action == EntityAction.more) { - showDialog(); - } else { - viewModel.onEntityAction( - context, user, action); - } - }, - onLongPress: () async { - final longPressIsSelection = - store.state.uiState.longPressSelectionIsDefault ?? true; - if (longPressIsSelection && !isInMultiselect) { - viewModel.onEntityAction( - context, [user], EntityAction.toggleMultiselect); - } else { - showDialog(); - } - }, - isChecked: isInMultiselect && listUIState.isSelected(user), - ); - }, - ), - ), - ),*/ ], ); } diff --git a/stubs/ui/stub/stub_list b/stubs/ui/stub/stub_list index 7ec850da5..38690048c 100644 --- a/stubs/ui/stub/stub_list +++ b/stubs/ui/stub/stub_list @@ -78,100 +78,6 @@ class StubList extends StatelessWidget { ), ), ), - - - /* - filteredClient != null - ? Material( - color: Colors.orangeAccent, - elevation: 6.0, - child: InkWell( - onTap: () => viewModel.onViewEntityFilterPressed(context), - child: Row( - children: [ - SizedBox(width: 18.0), - Expanded( - child: Text( - '${localization.filteredBy} ${filteredClient.listDisplayName}', - style: TextStyle( - color: Colors.white, - fontSize: 16.0, - ), - ), - ), - IconButton( - icon: Icon( - Icons.close, - color: Colors.white, - ), - onPressed: () => viewModel.onClearEntityFilterPressed(), - ) - ], - ), - ), - ) - : Container(), - Expanded( - child: !viewModel.isLoaded - ? LoadingIndicator() - : RefreshIndicator( - onRefresh: () => viewModel.onRefreshed(context), - child: viewModel.stubList.isEmpty - ? HelpText(AppLocalization.of(context).noRecordsFound) - : ListView.separated( - shrinkWrap: true, - separatorBuilder: (context, index) => ListDivider(), - itemCount: viewModel.stubList.length, - itemBuilder: (BuildContext context, index) { - final user = viewModel.user; - final stubId = viewModel.stubList[index]; - final stub = viewModel.stubMap[stubId]; - final client = - viewModel.clientMap[stub.clientId] ?? - ClientEntity(); - - - void showDialog() => showEntityActionsDialog( - entity: stub, - context: context, - user: user, - onEntityAction: viewModel.onEntityAction); - - - - return StubListItem( - user: viewModel.user, - filter: viewModel.filter, - stub: stub, - client: - viewModel.clientMap[stub.clientId] ?? - ClientEntity(), - onTap: () => - viewModel.onStubTap(context, stub), - onEntityAction: (EntityAction action) { - if (action == EntityAction.more) { - showDialog(); - } else { - viewModel.onEntityAction( - context, stub, action); - } - }, - onLongPress: () async { - final longPressIsSelection = - store.state.uiState.longPressSelectionIsDefault ?? true; - if (longPressIsSelection && !isInMultiselect) { - viewModel.onEntityAction( - context, [stub], EntityAction.toggleMultiselect); - } else { - showDialog(); - } - }, - isChecked: isInMultiselect && listUIState.isSelected(stub), - ); - }, - ), - ), - ),*/ ], ); }