首页 > 解决方案 > 如何将我的产品添加到我的图片右侧?

问题描述

我正在构建一个颤动的网络应用程序,我的图像在页面的左侧而不是全屏,现在我想在我的图像旁边显示我的产品,但我不想让我工作。我试着用和列,但没有运气我试着用一行包裹它也没有运气看图像将产品从左侧移动到开放空间

标签: imageflutterwebproduct

解决方案


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()));
              },
            ),
          ],
        ),
      ),
    );
  }
}

这是我理解的输出


推荐阅读