【发布时间】:2021-07-18 22:27:01
【问题描述】:
当用户点击警报对话框中的按钮时,我试图将用户导航到不同的屏幕,所以我用墨水瓶包装容器,然后使用 onTap () 和导航器推送替换:
onTap: (){
Navigator.pushReplacement(
context,MaterialPageRoute(builder: (context) => Subscription ()),);
}
但这给了我一个错误提示:错误:3 positional argument(s) expected, but 0 found.
InkWell() 的完整块
child: InkWell(
child: Container(
child: Center(
child: Text(
"Subscribe Now",
style: TextStyle(
fontSize: 14,
color: textColor,
fontWeight: FontWeight.bold),
))),
onTap: (){
Navigator.pushReplacement(
context,MaterialPageRoute(builder: (context) => Subscription ()),);
}
)
订阅类:
class Subscription extends StatefulWidget {
final bool isPaymentSuccess;
final User currentUser;
final Map items;
Subscription(this.currentUser, this.isPaymentSuccess, this.items);
@override
_SubscriptionState createState() => _SubscriptionState();
}
【问题讨论】: