image - 如何将我的产品添加到我的图片右侧?
问题描述
我正在构建一个颤动的网络应用程序,我的图像在页面的左侧而不是全屏,现在我想在我的图像旁边显示我的产品,但我不想让我工作。我试着用和列,但没有运气我试着用一行包裹它也没有运气看图像将产品从左侧移动到开放空间
解决方案
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:web_windmillsa_tech/tools/store.dart';
import 'favorites.dart';
import 'messages.dart';
import 'cart.dart';
import 'notifications.dart';
import 'history.dart';[![enter image description here][1]][1]
import 'profile.dart';
import 'delivery.dart';
import 'aboutUs.dart';
import 'loginlogout.dart';
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
BuildContext context;
@override
Widget build(BuildContext context) {
this.context = context;
return new Scaffold(
appBar: new AppBar(
title: new Text('Welcome to WindMill South-Africa Online Tech Store',
style: new TextStyle(
color: Colors.yellowAccent,
fontWeight: FontWeight.bold,
fontSize: 25.0)),
centerTitle: true,
actions: <Widget>[
new IconButton(
icon: new Icon(
Icons.favorite,
color: Colors.white,
),
onPressed: () {
Navigator.of(context).push(new CupertinoPageRoute(
builder: (BuildContext context) =>
new WindMillFavorities()));
}),
new Stack(
children: <Widget>[
new IconButton(
icon: new Icon(
Icons.chat,
color: Colors.white,
),
onPressed: () {
Navigator.of(context).push(new CupertinoPageRoute(
builder: (BuildContext context) =>
new WindMillMassages()));
}),
new CircleAvatar(
radius: 10.0,
backgroundColor: Colors.red,
child: new Text(
'0',
style: new TextStyle(color: Colors.white, fontSize: 12.0),
),
),
],
),
],
),
body: new Container(
// child: new Container(
// width: 500,
// height: 1000,
// decoration: BoxDecoration(
// image: DecorationImage(
// image: AssetImage('assets/images/windmill.jpg'),
// fit: BoxFit.fill,
// ),
// ),
// child: new Row(
// children: <Widget>[
// new Container(
// child: new Flexible(
// child: new GridView.builder(
// gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(
// crossAxisCount: 3),
// itemCount: 4,
// itemBuilder: (BuildContext context, int index) {
// return new Card(
// child: new Stack(
// alignment: FractionalOffset.bottomCenter,
// children: <Widget>[
// new Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: <Widget>[
// new Text('itemName'),
// new Text('itemPrice'),
// ],
// ),
// ],
// ),
// );
// },
// )),
// ),
// ],
// ),
// ),
child: Row(
children: [
Container(
width: 500,
height: 1000,
decoration: BoxDecoration(
// image: DecorationImage(
// image: AssetImage('assets/images/windmill.jpg'),
// fit: BoxFit.fill,
// ),
image: DecorationImage(
image: NetworkImage(
"https://wallpaperaccess.com/full/1266627.jpg"),
fit: BoxFit.fill,
),
),
),
Container(
child: new Flexible(
child: new GridView.builder(
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3),
itemCount: 4,
itemBuilder: (BuildContext context, int index) {
return new Card(
child: new Stack(
alignment: FractionalOffset.bottomCenter,
children: <Widget>[
new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
new Text('itemName'),
new Text('itemPrice'),
],
),
],
),
);
},
)),
),
],
),
),
floatingActionButton: new Stack(
alignment: Alignment.topLeft,
children: <Widget>[
new FloatingActionButton(
onPressed: () {
Navigator.of(context).push(new CupertinoPageRoute(
builder: (BuildContext context) => new WindMillCart()));
},
child: new Icon(Icons.shopping_cart)),
new CircleAvatar(
radius: 10.0,
backgroundColor: Colors.red,
child: new Text(
'0',
style: new TextStyle(color: Colors.white, fontSize: 12.0),
),
),
],
),
drawer: new Drawer(
child: new Column(
children: <Widget>[
new UserAccountsDrawerHeader(
accountName: new Text('Corneluis J Heunis'),
accountEmail: new Text('corneluis@windmillsa.com'),
currentAccountPicture: new CircleAvatar(
backgroundColor: Colors.white,
child: new Icon(Icons.person),
),
),
new ListTile(
leading: new CircleAvatar(
child: new Icon(
Icons.notifications,
color: Colors.white,
),
),
title: new Text('Order Notifications'),
onTap: () {
Navigator.of(context).push(new CupertinoPageRoute(
builder: (BuildContext context) =>
new WindMillNotifications()));
},
),
new ListTile(
leading: new CircleAvatar(
child: new Icon(
Icons.history,
color: Colors.white,
),
),
title: new Text('Order History'),
onTap: () {
// Navigator.of(context).push(new CupertinoPageRoute(
// builder: (BuildContext context) => new WindMillHistory()));
},
),
new Divider(),
new ListTile(
leading: new CircleAvatar(
child: new Icon(
Icons.person,
color: Colors.white,
),
),
title: new Text('Profile Settings'),
onTap: () {
Navigator.of(context).push(new CupertinoPageRoute(
builder: (BuildContext context) => new WindMillProfile()));
},
),
new ListTile(
leading: new CircleAvatar(
child: new Icon(
Icons.home,
color: Colors.white,
),
),
title: new Text('Delivery Address'),
onTap: () {
Navigator.of(context).push(new CupertinoPageRoute(
builder: (BuildContext context) => new WindMillDelivery()));
},
),
new Divider(),
new ListTile(
trailing: new CircleAvatar(
child: new Icon(
Icons.help,
color: Colors.white,
),
),
title: new Text('About Us'),
onTap: () {
Navigator.of(context).push(new CupertinoPageRoute(
builder: (BuildContext context) => new WindMillAbout()));
},
),
new ListTile(
trailing: new CircleAvatar(
child: new Icon(
Icons.exit_to_app,
color: Colors.white,
),
),
title: new Text('Login'),
onTap: () {
Navigator.of(context).push(new CupertinoPageRoute(
builder: (BuildContext context) => new WindMillLogin()));
},
),
],
),
),
);
}
}
推荐阅读
- c# - 使用 C# 在 ASP.NET 服务器上保存图像时出现“GDI+ 中发生一般错误”
- python - 如何将字符串从输入转换为整数?(Python 3.9)
- enums - 不能在其枚举类声明之外 OR 2 个相同类型的枚举值
- rust - 在 nom 6.2.1 中创建错误以匹配 nom::IResult
- python - 如何从 Python 中的虚拟变量中很好地绘制决策树?
- virtual-machine - 访问托管在云虚拟机上的应用程序
- html - 从引用 Django 模板的 href 属性中删除下划线
- python - 控制台中的 Pycharm url 丢失
- html - 在轮播中调整图像大小
- python - 将单元格转换为原始的 IPython 单元格魔术