The relevant error-causing widget was
AlertDialog
lib\pages\DoctorPage.dart:157
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderCustomPaint#a3b64 relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
package:flutter/…/rendering/box.dart:1
Failed assertion: line 1979 pos 12: 'hasSize'
The relevant error-causing widget was
AlertDialog
lib\pages\DoctorPage.dart:157
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderPhysicalShape#5185b relayoutBoundary=up2 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
package:flutter/…/rendering/box.dart:1
Failed assertion: line 1979 pos 12: 'hasSize'
The relevant error-causing widget was
AlertDialog
lib\pages\DoctorPage.dart:157
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════
'package:flutter/src/rendering/shifted_box.dart': Failed assertion: line 348 pos 12: 'child!.hasSize': is not true.
package:flutter/…/rendering/shifted_box.dart:348
The relevant error-causing widget was
AlertDialog
lib\pages\DoctorPage.dart:157
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderPhysicalShape#5185b relayoutBoundary=up2
'package:flutter/src/rendering/box.dart':
package:flutter/…/rendering/box.dart:1
Failed assertion: line 1979 pos 12: 'hasSize'
The relevant error-causing widget was
AlertDialog
這個長錯誤顯示在我將警報框放在顫動中的地方
這是我的警報框代碼
class DoctorButtonBar extends StatelessWidget {
const DoctorButtonBar({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return ButtonBar(
alignment: MainAxisAlignment.spaceBetween,
children: [
IconButton(
onPressed: () {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
scrollable: true,
title: "title".text.make(),
);
});
},
icon: Icon(
Iconsax.award5,
color: AutiTheme.white,
semanticLabel: "Autisure Assured",
),
),
IconButton(
onPressed: () {},
icon: Icon(
CupertinoIcons.arrow_right_circle_fill,
color: AutiTheme.white,
))
],
);
}
}
注意:我將它與串列視圖一起使用我不知道是否會導致問題,但有關串列視圖的錯誤中沒有提到
我的 DoctorButtonBar 代碼
return VxBox(
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
DoctorListImage(image: item.imageUrl),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
"Dr. ${item.name}".text.lg.color(AutiTheme.white).bold.make(),
item.specialist.text.color(AutiTheme.creamColor).make(),
10.heightBox,
const DoctorButtonBar()
],
))
],
))
.color(AutiTheme.primary)
.shadow2xl
.rounded
.square(150)
.make()
.onTap(() {})
.py16();
關于頁面,我從映射它的 JSON 檔案中獲取一些資料,并將其顯示在 listview.builder() 中。在那里,我創建了一個批次作為經過驗證的批次,它是一個圖示按鈕,因此當用戶單擊時,我想通過為獎勵按鈕提供一些背景關系來顯示一個警報框。
uj5u.com熱心網友回復:
嘗試使用對話框而不是 AlertDialog
showDialog(
context: context,
builder: (context){
return Dialog(
backgroundColor: Color(0xFFfafafa),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
elevation: 20,
child: Container(
height: 120, //use height
child: child,
);
});
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/491245.html
上一篇:概念中的嵌套模板結構
