From 2734131f083b71750a67b23711f926b66d870c88 Mon Sep 17 00:00:00 2001 From: Felix Date: Mon, 12 Aug 2019 16:28:46 +0100 Subject: [PATCH] fixing weird CupertinoPicker --- lib/pages/receipt_page_2.dart | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/pages/receipt_page_2.dart b/lib/pages/receipt_page_2.dart index 897be0b..e064039 100644 --- a/lib/pages/receipt_page_2.dart +++ b/lib/pages/receipt_page_2.dart @@ -101,19 +101,20 @@ class ReceiptPage2State extends State { } List _sampleRecurringOptions = new List(7); + List _categories = new List(); @override Widget build(BuildContext context) { - Future> _futureCats = getCats(); - List _categories = new List(); - _categories.add("Fetching categories..."); - - _futureCats.then((value) { - _categories = null; - _categories = value; - setState(() {}); - }); + if (_categories.length == 0) { + Future> _futureCats = getCats(); + _categories.add("Fetching categories..."); + _futureCats.then((value) { + _categories = null; + _categories = value; + setState(() {}); + }); + } _sampleRecurringOptions[0] = "None"; _sampleRecurringOptions[1] = "Daily";