【问题标题】:How to add my products to the right side of my Image?如何将我的产品添加到我的图片右侧?
【发布时间】:2021-03-10 10:26:08
【问题描述】:

我正在构建一个颤振的网络应用程序我的图像在页面的左侧而不是全屏,现在我想 在我的图片旁边显示我的产品,但我不想让我工作。我试图用和列包裹它但没有运气我试着用一行包裹它也没有运气look at image move products from left to open space

【问题讨论】:

    标签: image flutter web product


    【解决方案1】:
    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()));
                  },
                ),
              ],
            ),
          ),
        );
      }
    }
    

    here is the output what i understand

    【讨论】:

    • 我不确定你是否理解我不希望图像正确只有产品正确的问题??
    • 从那里开始查看我的代码的第 80 行我有一个问题 new Flexible 有一个 gridview 构建器所以我不确定我在哪里做错了请帮助
    • 你想要的在左边
    • 嗨,Akshay 看看我发布的带有问题的图片。所以我想要的是左侧的图像和右侧的产品如果你看图片它表明产品在图像内狭窄我想在右侧显示产品
    • 嗨,AKSHAY,感谢您的帮助,这正是我所需要的
    猜你喜欢
    • 2018-11-28
    • 1970-01-01
    • 2011-09-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-24
    • 2020-10-23
    • 2023-02-08
    相关资源
    最近更新 更多