Skip to content

Commit

Permalink
v1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
CoolSnow committed Jan 19, 2021
1 parent fab0946 commit a97a938
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion lib/ui/pages/stock_list.dart
Expand Up @@ -30,6 +30,7 @@ class _StockListPageState extends State<StockListPage> {
Map<String, StockPrice> stockPriceMap = {}; //缓存价格信息
String stockCodeString = ''; //股票代码列表
bool timerRunning = false;
bool requesting = false;
@override
void initState() {
super.initState();
Expand Down Expand Up @@ -255,10 +256,12 @@ class _StockListPageState extends State<StockListPage> {
}

void _updateStockInfo() {
if (stocklist.isEmpty || stockCodeString.isEmpty) {
if (requesting || stocklist.isEmpty || stockCodeString.isEmpty) {
return;
}
requesting = true;
StockUtil.updateStockPrice(stockCodeString).then((pricesMap) {
requesting = false;
if (pricesMap != null && pricesMap.isNotEmpty) {
setState(() {
for (int i = 0; i < stocklist.length; i++) {
Expand Down
4 changes: 3 additions & 1 deletion lib/util/stock_util.dart
Expand Up @@ -52,7 +52,9 @@ class StockUtil {
Completer<Map<String, StockPrice>> completer = Completer();
String url = API_STOCK + codes;
HttpUtil().getDio().get(url).then((response) {
return completer.complete(_parseSinaData(response.data));
completer.complete(_parseSinaData(response.data));
}).catchError((error) {
completer.complete(null);
});
return completer.future;
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Expand Up @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+100
version: 1.0.1+101

environment:
sdk: ">=2.7.0 <3.0.0"
Expand Down

0 comments on commit a97a938

Please sign in to comment.