我正在尝试使用 flutter pdf package pdf生成 pdf ,一切正常,但我想在下面的多个页面上生成部分,我添加了代码示例
final pdf = pw.Document();
pdf.addPage(pw.MultiPage(
pageFormat: PdfPageFormat.a4,
build: (pw.Context context) {
return pw.Center(
child:Column(
children:[
pw.Text("Hello World"),
pw.Text("Hello 2"),
]
)
); // Center
}));
Run Code Online (Sandbox Code Playgroud)
如何在第一页显示 Hello World,在第二页显示 Hello 2?
对于我的场景,我使用 flutter http 包来发出 http 请求...在主屏幕中,我必须发送大约 3 个 http 请求,因为我必须使用等待请求来一一发送。
我已经使用了 BaseAPiService 类,因此所有 API 调用都将通过该类,
如果我在发生上述请求时导航到另一个地方如何破坏该连接?否则,如果导航后应用程序还在等待之前的 API 请求完成。
使用的示例基本 API 服务类
class ApiService {
apiGet(url, data) async {
Get.dialog(LoadingDialog());
var response;
if (data == null) {
response = await http.get(
baseUrl + url,
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
);
}
Navigator.pop(Get.overlayContext);
return response;
}
apiPost(url, data) async {
FocusScopeNode currentFocus = FocusScope.of(Get.context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
Get.dialog(LoadingDialog());
var response;
if (data != null) {
response = await …Run Code Online (Sandbox Code Playgroud)