我有这张卡,我想使任何图像都占据该卡的全宽,我尝试将width设置为double.infinity和3000,但是它不起作用。我也想在图像的顶部写上文字吗?如果这样做会影响应用程序性能吗?
return Card(
clipBehavior: Clip.antiAlias,
elevation: 5,
margin: EdgeInsets.fromLTRB(10, 20, 10, 24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new Expanded(
flex: 8,
child: new Container(
width: double.infinity,
child: ClipRRect(
borderRadius: BorderRadius.circular(4.0),
child: CachedNetworkImage(
fadeInDuration: Duration(milliseconds: 2000),
width: 3000,
imageUrl:
'https://images.alphacoders.com/560/thumb-350-560228.jpg',
placeholder: (context, url) =>
new CircularProgressIndicator(),
),
),
),
),
new Expanded(
flex: 2,
child: new Container(
child: MaterialButton(
minWidth: double.infinity,
color: Color(orange),
onPressed: () {},
child: Text(
'Read More',
style: TextStyle(color: Colors.white),
),
),
color: Colors.green,
))
],
),
);
答案 0 :(得分:2)
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main(int argc, char **argv)
{
ifstream inFile;
ofstream outFile;
string name;
int x,y,z;
outFile.open("C:\\Users\\luked\\Desktop\\Test.txt");
outFile << 5 << " " << 10 << " " << 15 << endl << "My name is Luke";
outFile.close();
inFile.open("C:\\Users\\luked\\Desktop\\Test.txt");
inFile >> x >> y >> z;
getline(inFile, name);
cout << x << " " << y << " " << z << " " << endl << name;
return 0;
}
答案 1 :(得分:1)
如果要使其宽度合适
改为使用Boxfit.fitWidth