Покупка +

null-safety-migration
suvaysov 2022-11-15 19:22:49 +06:00
parent 94b1e7a79a
commit 69c98ca7c8
2 changed files with 15 additions and 9 deletions

View File

@ -185,7 +185,6 @@ Future<void> removeAllSellData(Store<AppState> store) async {
Future<void> loadSellData(Store<AppState> store) async {
try {
log.i('loadSellData');
final int? appCompanyId = store.state.userState!.auth!.companyId;
final List<Map<String, dynamic>> set = await _dbService.queryRowsWithWhere(
transactionTableName,

View File

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
import 'package:intl/intl.dart';
import 'package:satu/core/models/inventarization/response/inventarization_response.dart';
import 'package:satu/core/services/dialog_service.dart';
import 'package:satu/core/services/inventarization_service.dart';
import 'package:satu/core/services/navigator_service.dart';
import 'package:satu/core/utils/locator.dart';
@ -22,14 +23,14 @@ class InventarizationView extends StatefulWidget {
}
class _InventarizationViewState extends State<InventarizationView> {
final InventarizationService _service = locator<InventarizationService>();
final NavigatorService _navigatorService = locator<NavigatorService>();
final DialogService _dialogService = locator<DialogService>();
static const _pageSize = 20;
final PagingController<int, InventarizationResponse> _pagingController =
PagingController(firstPageKey: 1);
PagingController(firstPageKey: 1);
final DateFormat formatterDay = DateFormat('dd.MM.yyyy');
@ -58,7 +59,7 @@ class _InventarizationViewState extends State<InventarizationView> {
children: [
verticalSpaceSmall,
Padding(
padding: const EdgeInsets.only( left: 15.0),
padding: const EdgeInsets.only(left: 15.0),
child: SizedBox(
width: double.infinity,
child: Row(
@ -99,12 +100,18 @@ class _InventarizationViewState extends State<InventarizationView> {
);
},
pagingController: _pagingController,
builderDelegate: PagedChildBuilderDelegate<InventarizationResponse>(
itemBuilder: (BuildContext context, InventarizationResponse item,
int index) {
builderDelegate:
PagedChildBuilderDelegate<InventarizationResponse>(
itemBuilder: (BuildContext context,
InventarizationResponse item, int index) {
return DictionaryTile(
key: Key('category_${item.id}'),
onPress: () async {
if (item.act != null) {
return _dialogService.showDialog(
description:
'В обработанный акт нельзя добавить товары');
}
final dynamic result = await _navigatorService
.push(inventarizationEditRoute, arguments: item);
if (result != null && true == (result as bool)) {
@ -144,8 +151,8 @@ class _InventarizationViewState extends State<InventarizationView> {
}
Future<void> _fetchData(int pageKey, int perPage) async {
final List<InventarizationResponse> newItems = await _service
.getList(page: pageKey, perpage: perPage);
final List<InventarizationResponse> newItems =
await _service.getList(page: pageKey, perpage: perPage);
final isLastPage = newItems.length < _pageSize;
if (isLastPage) {
_pagingController.appendLastPage(newItems);