Skip to content
Snippets Groups Projects
single_item.dart 7.8 KiB
Newer Older
Aayush's avatar
Aayush committed
import 'package:flutter/material.dart';
import 'package:food_app/config/colors.dart';

class SingleItem extends StatelessWidget {
  bool isBool = false;
Harshil Patel's avatar
Harshil Patel committed
  String productImage;
  String productName;
Om Akbari's avatar
Om Akbari committed
  bool wishList = false;
Harshil Patel's avatar
Harshil Patel committed
  int productPrice;
  String productId;
  int productQuantity;
Aayush's avatar
Aayush committed
  Function onDelete;
Aayush's avatar
Aayush committed
      {this.productQuantity,
      this.productId,
      this.isBool,
      this.productImage,
      this.productName,
      this.productPrice,
Om Akbari's avatar
Om Akbari committed
      this.onDelete,
      this.wishList});
Aayush's avatar
Aayush committed
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Padding(
          padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10),
          child: Row(
            children: [
              Expanded(
                child: Container(
                  height: 100,
                  child: Center(
Om Akbari's avatar
Om Akbari committed
                    child: Image.network(
                      productImage,
                    ),
Aayush's avatar
Aayush committed
                  ),
                ),
              ),
              Expanded(
                child: Container(
                  height: 100,
                  child: Column(
                    mainAxisAlignment: isBool == false
                        ? MainAxisAlignment.spaceAround
                        : MainAxisAlignment.spaceEvenly,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Column(
                        children: [
                          Text(
Harshil Patel's avatar
Harshil Patel committed
                            productName,
Aayush's avatar
Aayush committed
                            style: TextStyle(
                                color: textColor, fontWeight: FontWeight.bold),
                          ),
                          Text(
Harshil Patel's avatar
Harshil Patel committed
                            "$productPrice\$",
Aayush's avatar
Aayush committed
                            style: TextStyle(
                              color: textColor,
                              fontWeight: FontWeight.bold,
                            ),
                          ),
                        ],
                      ),
                      isBool == false
                          ? Container(
                              margin: EdgeInsets.only(right: 5),
                              padding: EdgeInsets.symmetric(horizontal: 10),
                              height: 35,
                              decoration: BoxDecoration(
                                border: Border.all(color: Colors.grey),
                                borderRadius: BorderRadius.circular(30),
                              ),
                              child: Row(
                                children: [
                                  Expanded(
                                    child: Text(
                                      "50 Gram",
                                      style: TextStyle(
                                        color: Colors.grey,
                                        fontSize: 12,
                                      ),
                                    ),
                                  ),
                                  Center(
                                    child: Icon(
                                      Icons.arrow_drop_down,
                                      size: 20,
                                      color: primaryColor,
                                    ),
                                  )
                                ],
                              ),
                            )
                          : Text("50 Gram")
                    ],
                  ),
                ),
              ),
              Expanded(
                child: Container(
                  height: 100,
                  child: Container(
                      height: 100,
                      padding: isBool == false
                          ? EdgeInsets.symmetric(horizontal: 15, vertical: 32)
                          : EdgeInsets.only(left: 15, right: 15),
                      child: isBool == false
                          ? Container(
                              height: 25,
                              width: 50,
                              decoration: BoxDecoration(
                                border: Border.all(color: Colors.grey),
                                borderRadius: BorderRadius.circular(30),
                              ),
                              child: Center(
                                child: Row(
                                  mainAxisAlignment: MainAxisAlignment.center,
                                  children: [
                                    Icon(
                                      Icons.add,
                                      color: primaryColor,
                                      size: 20,
                                    ),
                                    Text(
                                      "ADD",
                                      style: TextStyle(
                                        color: primaryColor,
                                      ),
                                    ),
                                  ],
                                ),
                              ),
                            )
Harshil Patel's avatar
Harshil Patel committed
                          : Padding(
Om Akbari's avatar
Om Akbari committed
                              padding: const EdgeInsets.only(top: 8),
                              child: Column(
Harshil Patel's avatar
Harshil Patel committed
                                children: [
                                  InkWell(
                                    onTap: onDelete,
                                    child: Icon(
                                      Icons.delete,
                                      size: 30,
                                      color: Colors.black54,
                                    ),
Aayush's avatar
Aayush committed
                                  ),
Harshil Patel's avatar
Harshil Patel committed
                                  SizedBox(
                                    height: 5,
Aayush's avatar
Aayush committed
                                  ),
Harshil Patel's avatar
Harshil Patel committed
                                  Container(
                                    height: 25,
                                    width: 70,
                                    decoration: BoxDecoration(
                                      border: Border.all(color: Colors.grey),
                                      borderRadius: BorderRadius.circular(30),
                                    ),
                                    child: Center(
                                      child: Row(
                                        mainAxisAlignment:
                                            MainAxisAlignment.center,
                                        children: [
                                          Icon(
                                            Icons.remove,
                                            color: primaryColor,
                                            size: 20,
                                          ),
                                          Text(
                                            "1",
                                            style: TextStyle(
                                              color: primaryColor,
                                            ),
                                          ),
                                          Icon(
                                            Icons.add,
Aayush's avatar
Aayush committed
                                            color: primaryColor,
Harshil Patel's avatar
Harshil Patel committed
                                            size: 20,
Aayush's avatar
Aayush committed
                                          ),
Harshil Patel's avatar
Harshil Patel committed
                                        ],
                                      ),
Aayush's avatar
Aayush committed
                                    ),
Om Akbari's avatar
Om Akbari committed
                            )),
Aayush's avatar
Aayush committed
                ),
              ),
            ],
          ),
        ),
        isBool == false
            ? Container()
            : Divider(
                height: 1,
                color: Colors.black45,
              )
      ],
    );
  }
}