feat: inventory loading

This commit is contained in:
louis 2024-03-26 17:10:14 +08:00
parent 74c9831ec7
commit e1340ead5f
3 changed files with 112 additions and 105 deletions

View File

@ -10,6 +10,7 @@ import 'package:sk_base_mobile/models/index.dart';
import 'package:sk_base_mobile/models/inventory.model.dart';
import 'package:sk_base_mobile/util/debouncer.dart';
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
import 'package:sk_base_mobile/widgets/empty.dart';
class InventorySearch extends StatelessWidget {
Function(InventoryModel)? onInventorySelected;
@ -103,7 +104,7 @@ class InventorySearch extends StatelessWidget {
],
onChanged: (value) {
controller.hasInventoryStatus.value = value!;
controller.onRefresh();
controller.refreshController.requestRefresh();
},
decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(
@ -124,7 +125,11 @@ class InventorySearch extends StatelessWidget {
controller: controller.refreshController,
onLoading: controller.onLoading,
onRefresh: controller.onRefresh,
child: Table(columnWidths: {
child: controller.inventories.isEmpty
? Center(
child: Empty(text: '暂无库存'),
)
: Table(columnWidths: {
0: FixedColumnWidth(100),
1: FlexColumnWidth(2),
2: MinColumnWidth(FixedColumnWidth(200), FixedColumnWidth(200)),
@ -134,8 +139,8 @@ class InventorySearch extends StatelessWidget {
// table header
TableRow(
decoration: BoxDecoration(
border:
Border(bottom: BorderSide(color: AppTheme.dividerColor))),
border: Border(
bottom: BorderSide(color: AppTheme.dividerColor))),
children: [
TableCell(
verticalAlignment: TableCellVerticalAlignment.middle,
@ -180,7 +185,8 @@ class InventorySearch extends StatelessWidget {
return TableRow(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(color: AppTheme.dividerColor))),
bottom:
BorderSide(color: AppTheme.dividerColor))),
children: [
buildTableCell(
Text(

View File

@ -137,6 +137,7 @@ class DioService extends Get.GetxService {
response.data = response.data['data'];
//
if (response.data != null &&
response.data is Map &&
response.data['meta'] != null &&
response.data['items'] != null) {
response.data = PaginationData.fromJson(response.data);

View File

@ -17,7 +17,7 @@ class Empty extends StatelessWidget {
Text(
text ?? '',
textAlign: TextAlign.center,
style: TextStyle(fontSize: ScreenAdaper.sp(18)),
style: TextStyle(fontSize: ScreenAdaper.sp(30)),
),
]),
);