[英]How can i resize image.network in appbar
I want image at center in appbar and resize to bigger.我希望图像在应用栏的中心并调整为更大。 I tried use width and height but it's death code.
我尝试使用宽度和高度,但它是死亡代码。
class HomeScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
//ใช้ context
return MaterialApp(
//ใช้ MaterialApp
home: Scaffold(
//ใช้ Scaffold
appBar: BuildAppBar(),
//สร้าง AppBar
body: Center(child: Text('Hi')), //ใช้ Text แสดงข้อความตรงกลางจอ
),
);
}
AppBar BuildAppBar() {
return AppBar(
leading: Container(
padding: const EdgeInsets.all(0),
child: Image.network(
'http://www.sr...i can't open this url to pubic'),
width: 100,
height: 100,
),
);
}
}
If you want to add a image to center of appBar, you can use this code;如果要在 appBar 的中心添加图像,可以使用此代码;
appBar: AppBar(
title: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.network(
'https://picsum.photos/250?image=9',
fit: BoxFit.contain,
height: 60,
errorBuilder: (context, error, stackTrace) =>
const Icon(Icons.error_outline_outlined),
),
Container()
],
),
),
Try this:尝试这个:
return AppBar(
centerTitle: true,
toolbarHeight: 100,
title: Image.network(
imageUrl,
width: 100,
height: 100,
),
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.