mod: 异常状态样式

This commit is contained in:
guozhigq
2023-08-19 17:50:26 +08:00
parent 740116e873
commit ec9d9739fe
12 changed files with 134 additions and 32 deletions

View File

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:pilipala/common/skeleton/video_card_h.dart';
import 'package:pilipala/common/widgets/http_error.dart';
import 'package:pilipala/common/widgets/no_data.dart';
import 'package:pilipala/pages/history/index.dart';
import 'widgets/item.dart';
@ -27,7 +28,7 @@ class _HistoryPageState extends State<HistoryPage> {
if (_historyController.scrollController.position.pixels >=
_historyController.scrollController.position.maxScrollExtent -
300) {
if (!_historyController.isLoadingMore) {
if (!_historyController.isLoadingMore.value) {
_historyController.onLoad();
}
}
@ -92,13 +93,9 @@ class _HistoryPageState extends State<HistoryPage> {
Map data = snapshot.data;
if (data['status']) {
return Obx(
() => _historyController.historyList.isEmpty
? const SliverToBoxAdapter(
child: Center(
child: Text('没数据'),
),
)
: SliverList(
() => _historyController.historyList.isNotEmpty &&
!_historyController.isLoadingMore.value
? SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {
return HistoryItem(
@ -108,7 +105,12 @@ class _HistoryPageState extends State<HistoryPage> {
},
childCount:
_historyController.historyList.length),
),
)
: _historyController.isLoadingMore.value
? const SliverToBoxAdapter(
child: Center(child: Text('加载中')),
)
: const NoData(),
);
} else {
return HttpError(