我想在产品上做这个功能,但我不知道怎么做,因为我太新鲜了.
这是我想要的画面
这是我的密码。
  child: GridTile(
              footer: Container(
                color: Colors.white,
                child: Row(
                  children: [
                    Expanded(
                      flex: 8,
                      child: Text(product_name),
                    ),
                    Text("\$$product_price",
                        style: const TextStyle(fontWeight: FontWeight.w600)),
                  TextButton(
                    onPressed: (){
                    debugPrint('added to cart');
                  },
                      child: Text("ADD TO CARD"),
                    style: TextButton.styleFrom(
                      primary: Colors.lightBlue[800],
                      shadowColor: Colors.deepPurple,
                      // elevation: 5,
                    ),
                  ),
                  ],
                ),
              ),
              child: Image.asset(
                product_picture,
                fit: BoxFit.cover,
              ),
            ),
          ),
        ),
      ),这就是它的样子看上去怎么样
我会感谢你的帮助!
发布于 2022-01-12 22:01:54
发布于 2022-01-13 10:36:03
下面是一些类似于示例的内容
     GridView.count( 
        shrinkWrap: true,
        childAspectRatio: .8,
        crossAxisCount: 2,
        mainAxisSpacing: 4,
        crossAxisSpacing: 4,
        children: List.generate(10, (index) {
          return Container(
            padding: const EdgeInsets.all(8.0),
            decoration: BoxDecoration(
              color: Colors.white,
              borderRadius: BorderRadius.circular(8),
            ),
            child: Stack(
              children: [
                Column(
                  crossAxisAlignment: CrossAxisAlignment.center,
                  mainAxisSize: MainAxisSize.min,
                  children: [
                    ClipRRect(
                      borderRadius: BorderRadius.circular(5),
                      child: Image.network('https://i.ytimg.com/vi/6OovMIjDtAM/maxresdefault.jpg',)
                    ),
                    const SizedBox(height: 14),
                    const Text('My Drink 101',
                      style: TextStyle(color: Colors.black, fontSize: 16, fontWeight: FontWeight.w600),
                    ),
                    const SizedBox(height: 14),
                    Padding(
                      padding: const EdgeInsets.symmetric(horizontal: 8.0),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text('500 ml', style: TextStyle(color: Colors.black, fontSize: 14, fontWeight: FontWeight.w300)),
                          Text('\$500 ml', style: TextStyle(color: Colors.black, fontSize: 14, fontWeight: FontWeight.w300)),
                        ],
                      ),
                    ),
                    const SizedBox(height: 16),
                    Container(
                      alignment: Alignment.centerRight,
                      child: InkWell(
                        onTap: () {
                          // add to cart
                        },
                        child: Icon(Icons.shopping_cart_outlined, color: Colors.blue,),
                      ),
                    ),
                  ],
                ),
                Align(
                  alignment: Alignment.topLeft,
                  child: InkWell(
                    onTap: () {
                      // add to favourite
                    },
                    child: const Padding(
                      padding: EdgeInsets.all(8.0),
                      child: Icon(
                        Icons.favorite_border,
                        color: Colors.white,
                      ),
                    ),
                  ),
                ),
              ],
            ),
          );
        }),
      )https://stackoverflow.com/questions/70687313
复制相似问题