Closed YuQi9797 closed 6 months ago
作者您好,我在按照example中的'paging_page.dart'进行修改。
class _PagingPageState extends State<PagingPage> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Paging example'.tr), ), body: CustomPaging( itemBuilder: <MyType>(context, index, item) { return const MyItem(item); }, ), ); } }
此处在itemBuilder中,我返回的是自己的Itme布局,同时传入自定义MyType类Item。但出现 The argument type 'MyType' can't be assigned to the parameter type 'MyType'.问题, 就问该如何解决? 谢谢
itemBuilder
The argument type 'MyType' can't be assigned to the parameter type 'MyType'.
找到问题了, ItemType不应该去动它。 直接对自己的item进行类型转换。虽然不知道为什么...
itemBuilder: <ItemType>(context, index, item) { return LeaveItem(item as MyType); }
3.3.4添加了类型推断。如还有问题,请重新开启此issue
作者您好,我在按照example中的'paging_page.dart'进行修改。
此处在
itemBuilder
中,我返回的是自己的Itme布局,同时传入自定义MyType类Item。但出现The argument type 'MyType' can't be assigned to the parameter type 'MyType'.
问题, 就问该如何解决? 谢谢