diff --git a/assets/icons/amazon.svg b/assets/icons/amazon.svg
new file mode 100644
index 0000000..ef7d110
--- /dev/null
+++ b/assets/icons/amazon.svg
@@ -0,0 +1,3 @@
+
diff --git a/lib/main.dart b/lib/main.dart
index f0ddc6a..ef8512f 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -1,12 +1,13 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:shopping_assistant_mobile_client/screens/wishlists.dart';
+import 'package:shopping_assistant_mobile_client/screens/cart.dart';
void main() {
runApp(const MyApp());
}
-class MyApp extends StatefulWidget {
+class MyApp extends StatelessWidget {
const MyApp({super.key});
static const List _pageNameOptions = [
@@ -24,90 +25,99 @@ class MyApp extends StatefulWidget {
static const Color _selectedColor = Color.fromRGBO(36, 36, 36, 1);
static const Color _unselectedColor = Color.fromRGBO(144, 144, 144, 1);
- @override
- State createState() => _MyAppState();
-}
-
-class _MyAppState extends State {
- int _selectedIndex = 0;
-
- void _onItemTapped(int index) {
- setState(() {
- _selectedIndex = index;
- });
- }
-
@override
Widget build(BuildContext context) {
return MaterialApp(
- theme: ThemeData(
- useMaterial3: true,
- appBarTheme: AppBarTheme(),
- textTheme: TextTheme(
- bodyMedium: TextStyle(
- fontSize: 16,
- fontWeight: FontWeight.w500,
- ),
- ),
- ),
- home: Scaffold(
- appBar: AppBar(
- title: Text(MyApp._pageNameOptions[_selectedIndex]),
- centerTitle: true,
- bottom: PreferredSize(
- preferredSize: const Size.fromHeight(1),
- child: Container(
- color: Color.fromRGBO(234, 234, 234, 1),
- height: 1,
- ),
- ),
- ),
- body: MyApp._widgetOptions[_selectedIndex],
- bottomNavigationBar: BottomNavigationBar(
- items: [
- BottomNavigationBarItem(
- icon: SvgPicture.asset(
- 'assets/icons/wishlists.svg',
- color: _selectedIndex == 0
- ? MyApp._selectedColor
- : MyApp._unselectedColor,
- ),
- label: 'Wishlists',
- ),
- BottomNavigationBarItem(
- icon: SvgPicture.asset(
- 'assets/icons/start-new-search.svg',
- color: _selectedIndex == 1
- ? MyApp._selectedColor
- : MyApp._unselectedColor,
- ),
- label: 'New Chat',
- ),
- BottomNavigationBarItem(
- icon: SvgPicture.asset(
- 'assets/icons/settings.svg',
- color: _selectedIndex == 2
- ? MyApp._selectedColor
- : MyApp._unselectedColor,
- ),
- label: 'Settings',
- ),
- ],
- selectedItemColor: MyApp._selectedColor,
- unselectedItemColor: MyApp._unselectedColor,
- selectedFontSize: 14,
- unselectedFontSize: 14,
- currentIndex: _selectedIndex,
- onTap: _onItemTapped,
- ),
- ),
+ home: CartScreen()
);
}
+ //State createState() => _MyAppState();
}
-// Use to seed wishlists for new user
-// final ApiClient client = ApiClient();
+// class _MyAppState extends State {
+// int _selectedIndex = 0;
+//
+// void _onItemTapped(int index) {
+// setState(() {
+// _selectedIndex = index;
+// });
+// }
+//
+// @override
+// Widget build(BuildContext context) {
+// return MaterialApp(
+// theme: ThemeData(
+// useMaterial3: true,
+// appBarTheme: AppBarTheme(),
+// textTheme: TextTheme(
+// bodyMedium: TextStyle(
+// fontSize: 16,
+// fontWeight: FontWeight.w500,
+// ),
+// ),
+// ),
+// home: Scaffold(
+// appBar: AppBar(
+// title: Text(MyApp._pageNameOptions[_selectedIndex]),
+// centerTitle: true,
+// bottom: PreferredSize(
+// preferredSize: const Size.fromHeight(1),
+// child: Container(
+// color: Color.fromRGBO(234, 234, 234, 1),
+// height: 1,
+// ),
+// ),
+// ),
+// body: MyApp._widgetOptions[_selectedIndex],
+// bottomNavigationBar: BottomNavigationBar(
+// items: [
+// BottomNavigationBarItem(
+// icon: SvgPicture.asset(
+// 'assets/icons/wishlists.svg',
+// color: _selectedIndex == 0
+// ? MyApp._selectedColor
+// : MyApp._unselectedColor,
+// ),
+// label: 'Wishlists',
+// ),
+// BottomNavigationBarItem(
+// icon: SvgPicture.asset(
+// 'assets/icons/start-new-search.svg',
+// color: _selectedIndex == 1
+// ? MyApp._selectedColor
+// : MyApp._unselectedColor,
+// ),
+// label: 'New Chat',
+// ),
+// BottomNavigationBarItem(
+// icon: SvgPicture.asset(
+// 'assets/icons/settings.svg',
+// color: _selectedIndex == 2
+// ? MyApp._selectedColor
+// : MyApp._unselectedColor,
+// ),
+// label: 'Settings',
+// ),
+// ],
+// selectedItemColor: MyApp._selectedColor,
+// unselectedItemColor: MyApp._unselectedColor,
+// selectedFontSize: 14,
+// unselectedFontSize: 14,
+// currentIndex: _selectedIndex,
+// onTap: _onItemTapped,
+// ),
+// ),
+// );
+// }
+// }
+
+
+
+
+// Use to seed wishlists for new user
+//final ApiClient client = ApiClient();
+//
// const String startPersonalWishlistMutations = r'''
// mutation startPersonalWishlist($dto: WishlistCreateDtoInput!) {
// startPersonalWishlist(dto: $dto) {
diff --git a/lib/models/product.dart b/lib/models/product.dart
new file mode 100644
index 0000000..df75e1e
--- /dev/null
+++ b/lib/models/product.dart
@@ -0,0 +1,25 @@
+class Product {
+ Product({
+ required this.id,
+ required this.name,
+ required this.url,
+ required this.imageUrls,
+ required this.rating,
+ required this.price
+});
+
+ String id;
+ String name;
+ String url;
+ List imageUrls;
+ double rating;
+ double price;
+
+ Product.fromJson(Map json)
+ : id = json['id'] as String,
+ name = json['name'] as String,
+ url = json['url'] as String,
+ imageUrls = json['imageUrls'] as List,
+ rating = json['rating'] as double,
+ price = json['name'] as double;
+}
\ No newline at end of file
diff --git a/lib/screens/cart.dart b/lib/screens/cart.dart
new file mode 100644
index 0000000..52c2861
--- /dev/null
+++ b/lib/screens/cart.dart
@@ -0,0 +1,245 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_svg/svg.dart';
+import 'package:graphql/client.dart';
+import 'package:shopping_assistant_mobile_client/models/product.dart';
+import 'package:shopping_assistant_mobile_client/network/api_client.dart';
+
+const String defaultUrl = 'https://s3-alpha-sig.figma.com/img/b8d6/7b6f/59839f0f3abfdeed91ca32d3501cbfa3?Expires=1702252800&Signature=aDWc2xO9d01Criwp829ZjhWE1pu~XGezZiM9oNOGkVZOYyGwxfDq5lVOSV0WOEkYdBR83hW7a-I2LY-U5R9evtoKf0BRGY1VVZ0H1wkp5WOHlC196gKr5tLPfseWahP2GWsQNSxfsgxg0cg8l8LamgqS1sUmD1Qt8jWdsqVcwlvTBY8X0q~ScDeCGn1n-7Npj315r4CbVLYMLfZWjpXROcR~Jpx-sqKVaxakw5OWdjegw7YBn~MAY6~yNi~Ylf44oFLkBpzI2aA65Z-TiRMPJ7HoLqJ3id8Eq7NoJ2PKxL88aZ2cOk9ZduRU7jI8FO-PvEBT-Qiwz0tUyEzmbiziDg__&Key-Pair-Id=APKAQ4GOSFWCVNEHN3O4';
+
+
+class CartScreen extends StatefulWidget {
+ const CartScreen({super.key});
+
+ @override
+ State createState() => _CartScreenState();
+}
+
+class _CartScreenState extends State {
+ // final _products = [
+ // Product(name : '1', id: "Belkin USB C to VGA + Charge Adapter - USB C to VGA Cable for MacBook", price: 12.57, rating: 4.34, url: 'a', imageUrls: [defaultUrl,'a','b']),
+ // Product(id : '1', name: "USB C to VGA 2", price: 12.57, rating: 4.5, url: 'a', imageUrls: [defaultUrl,'a','b']),
+ // Product(id : '1', name: "USB C to VGA 2", price: 12.57, rating: 4.2, url: 'a', imageUrls: [defaultUrl,'a','b']),
+ // Product(id : '1', name: "USB C to VGA 2", price: 12.57, rating: 4.7, url: 'a', imageUrls: [defaultUrl,'a','b']),
+ // Product(id : '1', name: "USB C to VGA 2", price: 12.57, rating: 4.8, url: 'a', imageUrls: [defaultUrl,'a','b'])
+ // ];
+
+ var client = ApiClient();
+
+ late Future _productsFuture;
+ late List _products;
+
+ @override
+ void initState(){
+ super.initState();
+ _productsFuture = _fetchProducts();
+ }
+
+ Future _fetchProducts() async {
+ const String productsPageFromPersonalWishlistQuery = r'''
+ query ProductsPageFromPersonalWishlist($wishlistId: String!, $pageNumber: Int!, $pageSize: Int!) {
+ productsPageFromPersonalWishlist(
+ wishlistId: $wishlistId,
+ pageNumber: $pageNumber,
+ pageSize: $pageSize
+ ) {
+ items {
+ id
+ url
+ name
+ rating
+ price
+ imagesUrls
+ }
+ }
+}''';
+
+ QueryOptions queryOptions = QueryOptions(
+ document: gql(productsPageFromPersonalWishlistQuery),
+ variables: const {
+ 'wishlistId': "657310c6892da98a23091bdf",
+ 'pageNumber': 1,
+ 'pageSize': 10,
+ });
+
+ var result = await client.query(queryOptions);
+ print(result);
+
+ _products = List