feat: inventory loading
This commit is contained in:
parent
74c9831ec7
commit
e1340ead5f
|
@ -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/models/inventory.model.dart';
|
||||||
import 'package:sk_base_mobile/util/debouncer.dart';
|
import 'package:sk_base_mobile/util/debouncer.dart';
|
||||||
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
|
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
|
||||||
|
import 'package:sk_base_mobile/widgets/empty.dart';
|
||||||
|
|
||||||
class InventorySearch extends StatelessWidget {
|
class InventorySearch extends StatelessWidget {
|
||||||
Function(InventoryModel)? onInventorySelected;
|
Function(InventoryModel)? onInventorySelected;
|
||||||
|
@ -103,7 +104,7 @@ class InventorySearch extends StatelessWidget {
|
||||||
],
|
],
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
controller.hasInventoryStatus.value = value!;
|
controller.hasInventoryStatus.value = value!;
|
||||||
controller.onRefresh();
|
controller.refreshController.requestRefresh();
|
||||||
},
|
},
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
contentPadding: EdgeInsets.symmetric(
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
@ -124,7 +125,11 @@ class InventorySearch extends StatelessWidget {
|
||||||
controller: controller.refreshController,
|
controller: controller.refreshController,
|
||||||
onLoading: controller.onLoading,
|
onLoading: controller.onLoading,
|
||||||
onRefresh: controller.onRefresh,
|
onRefresh: controller.onRefresh,
|
||||||
child: Table(columnWidths: {
|
child: controller.inventories.isEmpty
|
||||||
|
? Center(
|
||||||
|
child: Empty(text: '暂无库存'),
|
||||||
|
)
|
||||||
|
: Table(columnWidths: {
|
||||||
0: FixedColumnWidth(100),
|
0: FixedColumnWidth(100),
|
||||||
1: FlexColumnWidth(2),
|
1: FlexColumnWidth(2),
|
||||||
2: MinColumnWidth(FixedColumnWidth(200), FixedColumnWidth(200)),
|
2: MinColumnWidth(FixedColumnWidth(200), FixedColumnWidth(200)),
|
||||||
|
@ -134,8 +139,8 @@ class InventorySearch extends StatelessWidget {
|
||||||
// table header
|
// table header
|
||||||
TableRow(
|
TableRow(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border:
|
border: Border(
|
||||||
Border(bottom: BorderSide(color: AppTheme.dividerColor))),
|
bottom: BorderSide(color: AppTheme.dividerColor))),
|
||||||
children: [
|
children: [
|
||||||
TableCell(
|
TableCell(
|
||||||
verticalAlignment: TableCellVerticalAlignment.middle,
|
verticalAlignment: TableCellVerticalAlignment.middle,
|
||||||
|
@ -180,7 +185,8 @@ class InventorySearch extends StatelessWidget {
|
||||||
return TableRow(
|
return TableRow(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border(
|
border: Border(
|
||||||
bottom: BorderSide(color: AppTheme.dividerColor))),
|
bottom:
|
||||||
|
BorderSide(color: AppTheme.dividerColor))),
|
||||||
children: [
|
children: [
|
||||||
buildTableCell(
|
buildTableCell(
|
||||||
Text(
|
Text(
|
||||||
|
|
|
@ -137,6 +137,7 @@ class DioService extends Get.GetxService {
|
||||||
response.data = response.data['data'];
|
response.data = response.data['data'];
|
||||||
// 分页数据处理
|
// 分页数据处理
|
||||||
if (response.data != null &&
|
if (response.data != null &&
|
||||||
|
response.data is Map &&
|
||||||
response.data['meta'] != null &&
|
response.data['meta'] != null &&
|
||||||
response.data['items'] != null) {
|
response.data['items'] != null) {
|
||||||
response.data = PaginationData.fromJson(response.data);
|
response.data = PaginationData.fromJson(response.data);
|
||||||
|
|
|
@ -17,7 +17,7 @@ class Empty extends StatelessWidget {
|
||||||
Text(
|
Text(
|
||||||
text ?? '',
|
text ?? '',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(fontSize: ScreenAdaper.sp(18)),
|
style: TextStyle(fontSize: ScreenAdaper.sp(30)),
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue