From 6359d500084c0841e7ee6ce6efb942549fbdc22b Mon Sep 17 00:00:00 2001
From: Matthew Patrick <Matthew.535200018@stu.untar.ac.id>
Date: Thu, 28 Apr 2022 13:55:31 +0700
Subject: [PATCH 1/4] Made checkout_items.dart

---
 lib/components/checkout_items.dart | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 lib/components/checkout_items.dart

diff --git a/lib/components/checkout_items.dart b/lib/components/checkout_items.dart
new file mode 100644
index 0000000..e69de29

From 55ee837fbe1d0f84bb4d2f9e7f10d08000d84e41 Mon Sep 17 00:00:00 2001
From: Matthew Patrick <Matthew.535200018@stu.untar.ac.id>
Date: Thu, 28 Apr 2022 13:56:12 +0700
Subject: [PATCH 2/4] checkout_items - added stateful widget template

---
 lib/components/checkout_items.dart | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/lib/components/checkout_items.dart b/lib/components/checkout_items.dart
index e69de29..0a2f987 100644
--- a/lib/components/checkout_items.dart
+++ b/lib/components/checkout_items.dart
@@ -0,0 +1,15 @@
+import 'package:flutter/material.dart';
+
+class CheckoutItems extends StatefulWidget {
+  CheckoutItems({Key? key}) : super(key: key);
+
+  @override
+  State<CheckoutItems> createState() => _CheckoutItemsState();
+}
+
+class _CheckoutItemsState extends State<CheckoutItems> {
+  @override
+  Widget build(BuildContext context) {
+    return Container();
+  }
+}

From 4b22f9510814e33f2fdb9d383de4fec04686e295 Mon Sep 17 00:00:00 2001
From: Matthew Patrick <Matthew.535200018@stu.untar.ac.id>
Date: Thu, 28 Apr 2022 13:58:21 +0700
Subject: [PATCH 3/4] checkout - Linked checkout_items component

---
 lib/screens/checkout.dart | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/screens/checkout.dart b/lib/screens/checkout.dart
index 608170a..5ff5c28 100644
--- a/lib/screens/checkout.dart
+++ b/lib/screens/checkout.dart
@@ -1,5 +1,6 @@
 import 'package:flutter/material.dart';
 import 'package:nekoya_flutter/components/checkout_form.dart';
+import 'package:nekoya_flutter/components/checkout_items.dart';
 
 class Checkout extends StatefulWidget {
   const Checkout({Key? key}) : super(key: key);
@@ -22,6 +23,7 @@ class _CheckoutState extends State<Checkout> {
         child: SingleChildScrollView(
           child: Column(
             children: [
+              CheckoutItems(),
               CheckoutForm(),
             ],
           ),

From 7fefe9943172a193e754159d51a1f57be2e09e09 Mon Sep 17 00:00:00 2001
From: Matthew Patrick <Matthew.535200018@stu.untar.ac.id>
Date: Thu, 28 Apr 2022 14:20:01 +0700
Subject: [PATCH 4/4] checkout_items - Added a card with list of items in cart

---
 lib/components/checkout_items.dart | 82 +++++++++++++++++++++++++++++-
 1 file changed, 81 insertions(+), 1 deletion(-)

diff --git a/lib/components/checkout_items.dart b/lib/components/checkout_items.dart
index 0a2f987..4ced287 100644
--- a/lib/components/checkout_items.dart
+++ b/lib/components/checkout_items.dart
@@ -1,4 +1,7 @@
 import 'package:flutter/material.dart';
+import 'package:nekoya_flutter/api/api.dart';
+import 'package:nekoya_flutter/data/cart.dart';
+import 'package:nekoya_flutter/components/cart_box.dart';
 
 class CheckoutItems extends StatefulWidget {
   CheckoutItems({Key? key}) : super(key: key);
@@ -8,8 +11,85 @@ class CheckoutItems extends StatefulWidget {
 }
 
 class _CheckoutItemsState extends State<CheckoutItems> {
+  Future<dynamic> _viewCart = viewCart();
   @override
   Widget build(BuildContext context) {
-    return Container();
+    return Container(
+      margin: const EdgeInsets.fromLTRB(10, 10, 10, 5),
+      child: Card(
+        color: const Color(0xff212226),
+        shape: RoundedRectangleBorder(
+          borderRadius: BorderRadius.circular(15),
+        ),
+        child: Column(
+          children: [
+            const SizedBox(
+              height: 20,
+            ),
+            const Center(
+              child: Text(
+                "Items in Cart",
+                style: TextStyle(
+                    color: Colors.white,
+                    fontWeight: FontWeight.bold,
+                    fontSize: 30),
+              ),
+            ),
+            FutureBuilder<dynamic>(
+              future: _viewCart,
+              builder: (context, snapshot) {
+                if (snapshot.hasData) {
+                  var data = snapshot.data;
+                  return ListView.builder(
+                    scrollDirection: Axis.vertical,
+                    shrinkWrap: true,
+                    physics: const NeverScrollableScrollPhysics(),
+                    itemCount: data!.length,
+                    itemBuilder: (context, index) {
+                      return FutureBuilder<dynamic>(
+                        future: getProduct(data[index]["product_id"]),
+                        builder: (context, snapshotx) {
+                          if (snapshotx.hasData) {
+                            var productData = snapshotx.data;
+                            if (productData != null) {
+                              return CartBox(
+                                  controller: false,
+                                  imageUrl: 'https://nekoya.moe.team/img/' +
+                                      productData[0]['IMAGE'],
+                                  title: productData[0]['TITLE'],
+                                  quantity: data[index]["quantity"],
+                                  plus: () {},
+                                  minus: () {},
+                                  remove: () {});
+                            }
+                          }
+
+                          return CartBox(
+                            controller: false,
+                            imageUrl:
+                                'https://i.ibb.co/QJFLZC4/La-Darknesss-Portrait.webp',
+                            title: 'Loading...',
+                            quantity: 0,
+                            plus: () {},
+                            minus: () {},
+                            remove: () {},
+                          );
+                        },
+                      );
+                    },
+                  );
+                }
+
+                return const Center(
+                  child: CircularProgressIndicator(
+                    color: Color(0xff8B0000),
+                  ),
+                );
+              },
+            ),
+          ],
+        ),
+      ),
+    );
   }
 }