flutter報錯:NoSuchMethodError: The method '>' was called on null.


寫了個list,發現出不來,報錯

flutter: Another exception was thrown: RenderBox was not laid out: _RenderScrollSemantics#81b3a relayoutBoundary=up3 NEEDS-PAINT
flutter: Another exception was thrown: 'package:flutter/src/rendering/shifted_box.dart': Failed assertion: line 314 pos 12: 'child.hasSize': is not true.
flutter: Another exception was thrown: NoSuchMethodError: The method '<=' was called on null.
flutter: Another exception was thrown: NoSuchMethodError: The getter 'visible' was called on null.

搜了搜發現是Column或Row里面要加個Flexible來包裹里面的內容: https://github.com/flutter/flutter/issues/21628

Column(
children:
<Widget>[ Flexible( child: ListView( children: <Widget>[ ListTitle(leading:Icon(Icons.code),title:Text('hahaha')) ], ), ) ], )

解決了,但不知道具體是為何🤦‍♀️

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM