fix: fetch label

This commit is contained in:
J. A. Messias 2024-11-18 13:41:06 -03:00
parent 5cab6b88a6
commit 8972d580e5
1 changed files with 4 additions and 4 deletions

View File

@ -39,7 +39,7 @@ class _PetsHistoryScreenState extends State<PetsHistoryScreen> with TickerProvid
void initState() { void initState() {
super.initState(); super.initState();
model = widget.model ?? createModel(context, () => PetsPageModel(isInteractive: false)); model = widget.model ?? createModel(context, () => PetsPageModel(isInteractive: false));
_petsFuture = _fetchVisits(); _petsFuture = _fetch();
_scrollController = ScrollController() _scrollController = ScrollController()
..addListener(() { ..addListener(() {
if (_scrollController.position.atEdge && _scrollController.position.pixels != 0) { if (_scrollController.position.atEdge && _scrollController.position.pixels != 0) {
@ -89,7 +89,7 @@ class _PetsHistoryScreenState extends State<PetsHistoryScreen> with TickerProvid
); );
} }
Future<ApiCallResponse?> _fetchVisits() async { Future<ApiCallResponse?> _fetch() async {
try { try {
setState(() => _loading = true); setState(() => _loading = true);
@ -134,7 +134,7 @@ class _PetsHistoryScreenState extends State<PetsHistoryScreen> with TickerProvid
if (_hasData == true) { if (_hasData == true) {
_pageNumber++; _pageNumber++;
_petsFuture = _fetchVisits(); _petsFuture = _fetch();
} }
} }
@ -316,7 +316,7 @@ class _PetsHistoryScreenState extends State<PetsHistoryScreen> with TickerProvid
safeSetState(() { safeSetState(() {
_pageNumber = 1; _pageNumber = 1;
_petsWrap = []; _petsWrap = [];
_petsFuture = _fetchVisits().then((value) => value!.jsonBody['pets'] ?? []); _petsFuture = _fetch().then((value) => value!.jsonBody['pets'] ?? []);
}); });
}).catchError((e, s) async { }).catchError((e, s) async {
await DialogUtil.errorDefault(context); await DialogUtil.errorDefault(context);