import 'package:flutter/material.dart';
class PersonalData extends StatelessWidget {
final String Name;
final String Alter;
final String urlImage;
PersonalData(this.Name, this.Alter, this.urlImage);
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(title: new Text(Name),),
body: new Container(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
new Text("Name: " + Name, textAlign: TextAlign.left),
new Text("Alter: " + Alter),
new Image.network(urlImage, height: 200.0, width: 200.0, alignment: Alignment.topRight,),
],
),
),
);
}
}
如何在文本附近获取图像。此时文本保持不变,图像位于右侧的文本
下答案 0 :(得分:2)
我认为你应该更多地搜索fultter docs和library这是一个基本要求,并且他们很好地提供了它:
Widget _getUserDetailsWidget() {
var assetImage = AssetImage("assets/png/cat.jpg");
var image = new Image(image: assetImage, height: 96.0, width: 96.0, fit: BoxFit.fitWidth,);
final ListTile listTile = new ListTile(title: new Text("Silent Sudo"),
leading: image, subtitle: new Text("Location: India"));
return listTile;
}
替换new Container() => _getUserDetailsWidget()