【发布时间】:2021-03-22 15:59:15
【问题描述】:
我正在做扫描条形码应用程序,我想扫描条形码并获取带有信息的图片。首先,我通过扫描条形码成功获取了信息。在此之后,我想在扫描条形码后显示产品图片及其信息。所以我写了下面的代码,但我再次运行应用程序然后抛出错误Nosuchmethoderror:the method'/' was called on null Tried calling:/(3)。那么,我应该怎么做才能同时传递图像和信息。
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xFF121212),
body: Center(
child: product == null
? Text(
"Value : ${widget.code}",
style: TextStyle(color: Colors.blue),
)
: Container(
child: Column(
children: <Widget>[
Container(
height: screenHeight / 3,
width: screenWidth / 1.5,
child: CachedNetworkImage(
fit: BoxFit.fill,
imageUrl:
"https://smileylion.com/easyshopping/productimage/${product.code}.jpg",
placeholder: (context, url) =>
new CircularProgressIndicator(),
errorWidget: (context, url, error) =>
new Icon(Icons.error),
),
),
Text(
"CODE: ${product.code}",
style: TextStyle(fontSize: 20, color: Colors.white),
),
【问题讨论】:
标签: php image flutter dart barcode-scanner