completed migrating data scope from user to workspace
This commit is contained in:
@@ -64,16 +64,16 @@ class _HistoryScreenState extends State<HistoryScreen>
|
||||
|
||||
Future<void> setupData() async {
|
||||
prefs = await SharedPreferences.getInstance();
|
||||
final userId = prefs.getString("userId") ?? '';
|
||||
await controller.searchTransactions(userId);
|
||||
final workspaceId = prefs.getString("workspaceId") ?? '';
|
||||
await controller.searchTransactions(workspaceId);
|
||||
}
|
||||
|
||||
void _onScroll() {
|
||||
if (_scrollController.position.pixels >=
|
||||
_scrollController.position.maxScrollExtent - 200) {
|
||||
final userId = prefs.getString("userId") ?? '';
|
||||
if (userId.isNotEmpty) {
|
||||
controller.loadNextPage(userId);
|
||||
final workspaceId = prefs.getString("workspaceId") ?? '';
|
||||
if (workspaceId.isNotEmpty) {
|
||||
controller.loadNextPage(workspaceId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -227,9 +227,10 @@ class _HistoryScreenState extends State<HistoryScreen>
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
final userId = prefs.getString("userId") ?? '';
|
||||
final workspaceId =
|
||||
prefs.getString("workspaceId") ?? '';
|
||||
controller.searchTransactions(
|
||||
userId,
|
||||
workspaceId,
|
||||
search: _searchController.text.isNotEmpty
|
||||
? _searchController.text
|
||||
: null,
|
||||
@@ -327,9 +328,10 @@ class _HistoryScreenState extends State<HistoryScreen>
|
||||
icon: const Icon(Icons.clear),
|
||||
onPressed: () {
|
||||
_searchController.clear();
|
||||
final userId = prefs.getString("userId") ?? '';
|
||||
final workspaceId =
|
||||
prefs.getString("workspaceId") ?? '';
|
||||
controller.searchTransactions(
|
||||
userId,
|
||||
workspaceId,
|
||||
status: controller.model.statusFilter,
|
||||
type: controller.model.typeFilter,
|
||||
);
|
||||
@@ -351,9 +353,9 @@ class _HistoryScreenState extends State<HistoryScreen>
|
||||
),
|
||||
textInputAction: TextInputAction.search,
|
||||
onFieldSubmitted: (value) {
|
||||
final userId = prefs.getString("userId") ?? '';
|
||||
final workspaceId = prefs.getString("workspaceId") ?? '';
|
||||
controller.searchTransactions(
|
||||
userId,
|
||||
workspaceId,
|
||||
search: value.isNotEmpty ? value : null,
|
||||
status: controller.model.statusFilter,
|
||||
type: controller.model.typeFilter,
|
||||
@@ -496,9 +498,9 @@ class _HistoryScreenState extends State<HistoryScreen>
|
||||
'Status: ${controller.model.statusFilter}',
|
||||
() {
|
||||
controller.model.statusFilter = null;
|
||||
final userId = prefs.getString("userId") ?? '';
|
||||
final workspaceId = prefs.getString("workspaceId") ?? '';
|
||||
controller.searchTransactions(
|
||||
userId,
|
||||
workspaceId,
|
||||
search: _searchController.text.isNotEmpty
|
||||
? _searchController.text
|
||||
: null,
|
||||
@@ -509,9 +511,9 @@ class _HistoryScreenState extends State<HistoryScreen>
|
||||
if (controller.model.typeFilter != null)
|
||||
_activeFilterChip('Type: ${controller.model.typeFilter}', () {
|
||||
controller.model.typeFilter = null;
|
||||
final userId = prefs.getString("userId") ?? '';
|
||||
final workspaceId = prefs.getString("workspaceId") ?? '';
|
||||
controller.searchTransactions(
|
||||
userId,
|
||||
workspaceId,
|
||||
search: _searchController.text.isNotEmpty
|
||||
? _searchController.text
|
||||
: null,
|
||||
|
||||
Reference in New Issue
Block a user