当我使用 dio 获取数据时颤动,加载指示器总是会停止几秒钟并且无法单击 iOS 中的按钮
Flutter when I use dio get data, loading indicator will alway stop a few sec and can not click button in iOS
这是我的代码:
import 'package:flutter/material.dart';
import 'package:dio/dio.dart';
class ListensScreen extends StatefulWidget {
_ListensScreenState createState() => _ListensScreenState();
}
class _ListensScreenState extends State<ListensScreen> {
Dio _dio = new Dio();
@override
Widget build(BuildContext context) {
return new Container(
alignment: Alignment.center,
child: FutureBuilder(
future: _dio.get("https://cnodejs.org/api/v1/topics"),
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
Response response = snapshot.data;
if (snapshot.hasError) {
return Text(snapshot.error.toString());
}
return ListView(
children: response.data["data"].map<Widget>((e) =>
ListTile(title: Text(e["title"]))
).toList(),
);
}
return CircularProgressIndicator();
}
),
);
}
}
好像移动的时间比GIF长不了多少,而且我什么按钮都点不进去。使用起来很不友好
Android和Simulator没有这个问题。只有当我在 iPhone 中测试并在应用商店下载应用程序时才会出现此问题。
Flutter 1.12.13 和 dio 3.0.9
我发现这个问题出在服务器上。当我使用https
时,这个问题会出现在iOS上。 Android 和 Web 没有错。 iOS 有什么不同吗?
谢谢!
如果您的 SSL Web 服务器(如 nginx)位于防火墙后面并且必须使用 http 代理访问 OCSP 服务器以实施 OCSP Stapling,请使用此选项。
这是我的代码:
import 'package:flutter/material.dart';
import 'package:dio/dio.dart';
class ListensScreen extends StatefulWidget {
_ListensScreenState createState() => _ListensScreenState();
}
class _ListensScreenState extends State<ListensScreen> {
Dio _dio = new Dio();
@override
Widget build(BuildContext context) {
return new Container(
alignment: Alignment.center,
child: FutureBuilder(
future: _dio.get("https://cnodejs.org/api/v1/topics"),
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
Response response = snapshot.data;
if (snapshot.hasError) {
return Text(snapshot.error.toString());
}
return ListView(
children: response.data["data"].map<Widget>((e) =>
ListTile(title: Text(e["title"]))
).toList(),
);
}
return CircularProgressIndicator();
}
),
);
}
}
好像移动的时间比GIF长不了多少,而且我什么按钮都点不进去。使用起来很不友好
Android和Simulator没有这个问题。只有当我在 iPhone 中测试并在应用商店下载应用程序时才会出现此问题。
Flutter 1.12.13 和 dio 3.0.9
我发现这个问题出在服务器上。当我使用https
时,这个问题会出现在iOS上。 Android 和 Web 没有错。 iOS 有什么不同吗?
谢谢!
如果您的 SSL Web 服务器(如 nginx)位于防火墙后面并且必须使用 http 代理访问 OCSP 服务器以实施 OCSP Stapling,请使用此选项。