gpt4 book ai didi

Fetching image using API in Flutter(在颤动中使用API获取图像)

转载 作者:bug小助手 更新时间:2023-10-25 22:27:08 27 4
gpt4 key购买 nike



The following ProgressEvent$ object was thrown resolving an image codec:

解析图像编解码器时引发了以下ProgressEvent$对象:



[object ProgressEvent]



When the exception was thrown, this was the stack:

抛出异常时,堆栈如下:


final picture=user['picture']['thumbnail'];
return ListTile(
title: Text(firstName+' '+lastName),
subtitle: Text(email),
leading: ClipRRect(
borderRadius: BorderRadius.circular(10),
child: Image.network(picture),
),
);

更多回答

Please provide enough code so others can better understand or reproduce the problem.

请提供足够的代码,以便其他人能够更好地理解或重现问题。

优秀答案推荐

Here's what you've been looking for in the minimum viable way.

这就是你一直在寻找的最低限度可行的方式。


Source code:

源代码:


import "package:flutter/material.dart";

void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({super.key});

@override
Widget build(BuildContext context) {
return const MaterialApp(
home: NewHomePage(),
debugShowCheckedModeBanner: false,
);
}
}

class NewHomePage extends StatefulWidget {
const NewHomePage({super.key});

@override
State<NewHomePage> createState() => _NewHomePageState();
}

class _NewHomePageState extends State<NewHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: ListView.separated(
itemCount: 20,
itemBuilder: (BuildContext context, int index) {
return ListTile(
dense: true,
leading: ClipRRect(
borderRadius: BorderRadius.circular(10),
child: Image.network(
"https://picsum.photos/${index * 50}",
height: 50,
width: 50,
fit: BoxFit.cover,
),
),
title: Text("Title: $index"),
subtitle: Text("Subtitle: $index"),
trailing: const Icon(Icons.arrow_forward_ios),
onTap: () {},
);
},
separatorBuilder: (BuildContext context, int index) {
return const Divider(height: 1, thickness: 1);
},
),
),
);
}
}

更多回答

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com