From 4a9330f42b87fbd072ca4d1e5f102009cc47f006 Mon Sep 17 00:00:00 2001 From: cho4u4o Date: Wed, 25 Sep 2024 15:30:09 +0900 Subject: [PATCH 1/4] feat : modify Product model --- lib/models/product.dart | 101 +++++++++++++++++++++++----------------- 1 file changed, 58 insertions(+), 43 deletions(-) diff --git a/lib/models/product.dart b/lib/models/product.dart index d97b309..0c8039f 100644 --- a/lib/models/product.dart +++ b/lib/models/product.dart @@ -1,53 +1,68 @@ class Product { - int? id; - String? brand; - String? name; - String? description; - String? color; - String? storage; - String? grade; - String? imageUrl; - double? price; - int? stock; + int id; + String deviceType; + String name; + String description; + int price; + int stock; + List images; Product({ - this.id, - this.brand, - this.name, - this.description, - this.color, - this.storage, - this.grade, - this.imageUrl, - this.price, - this.stock, + required this.id, + required this.deviceType, + required this.name, + required this.description, + required this.price, + required this.stock, + required this.images, }); - Product.fromJson(Map json) { - id = int.parse(json['id']); - brand = json['brand']; - name = json['name']; - description = json['description']; - color = json['color']; - storage = json['storage']; - grade = json['grade']; - imageUrl = json['imageUrl']; - price = double.parse(json['price']); - stock = int.parse(json['stock']); + factory Product.fromJson(Map json) { + return Product( + id: json['id'], + deviceType: json['deviceType'], + name: json['name'], + description: json['description'], + price: json['price'], + stock: json['stock'], + images: List.from( + json['images'].map((image) => ImageInfo.fromJson(image))), + ); } Map toJson() { - final Map data = {}; - data['id'] = id; - data['brand'] = brand; - data['name'] = name; - data['description'] = description; - data['color'] = color; - data['storage'] = storage; - data['grade'] = grade; - data['imageUrl'] = imageUrl; - data['price'] = price; - data['stock'] = stock; - return data; + return { + 'id': id, + 'deviceType': deviceType, + 'name': name, + 'description': description, + 'price': price, + 'stock': stock, + 'images': images.map((image) => image.toJson()).toList(), + }; + } +} + +class ImageInfo { + String name; + String url; + + ImageInfo({ + required this.name, + required this.url, + }); + + factory ImageInfo.fromJson(Map json) { + return ImageInfo( + name: json['name'], + url: json['url'], + ); + } + + Map toJson() { + return { + 'name': name, + 'url': url, + }; } } From 389d12f81a9d5d8beb80db3a5ccc0b1939fa30d0 Mon Sep 17 00:00:00 2001 From: cho4u4o Date: Sun, 29 Sep 2024 16:47:34 +0900 Subject: [PATCH 2/4] feat : change product model --- lib/models/product.dart | 49 +++---- lib/screens/main/main_screen.dart | 129 ++++++------------ lib/screens/products/product_detail_page.dart | 80 ++++++----- lib/screens/purchase/purchase_page.dart | 45 +++--- .../purchase/purchase_process_page.dart | 24 +++- lib/widgets/product_card.dart | 28 ++-- 6 files changed, 163 insertions(+), 192 deletions(-) diff --git a/lib/models/product.dart b/lib/models/product.dart index 0c8039f..0efa7f7 100644 --- a/lib/models/product.dart +++ b/lib/models/product.dart @@ -3,9 +3,13 @@ class Product { String deviceType; String name; String description; - int price; + double price; int stock; - List images; + Map images; // 이미지 정보를 Map으로 저장 + String brand; + String color; + String storage; + String grade; Product({ required this.id, @@ -15,6 +19,10 @@ class Product { required this.price, required this.stock, required this.images, + required this.brand, + required this.color, + required this.storage, + required this.grade, }); factory Product.fromJson(Map json) { @@ -25,8 +33,11 @@ class Product { description: json['description'], price: json['price'], stock: json['stock'], - images: List.from( - json['images'].map((image) => ImageInfo.fromJson(image))), + images: Map.from(json['images']), // 직접 변환 + brand: json['brand'], + color: json['color'], + storage: json['storage'], + grade: json['grade'], ); } @@ -38,31 +49,11 @@ class Product { 'description': description, 'price': price, 'stock': stock, - 'images': images.map((image) => image.toJson()).toList(), - }; - } -} - -class ImageInfo { - String name; - String url; - - ImageInfo({ - required this.name, - required this.url, - }); - - factory ImageInfo.fromJson(Map json) { - return ImageInfo( - name: json['name'], - url: json['url'], - ); - } - - Map toJson() { - return { - 'name': name, - 'url': url, + 'images': images, // 직접 저장 + 'brand': brand, + 'color': color, + 'storage': storage, + 'grade': grade, }; } } diff --git a/lib/screens/main/main_screen.dart b/lib/screens/main/main_screen.dart index 6b88e1a..d092021 100644 --- a/lib/screens/main/main_screen.dart +++ b/lib/screens/main/main_screen.dart @@ -1,5 +1,8 @@ +import 'dart:async'; + import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; +import 'package:dio/dio.dart'; import 'package:saphy/models/product.dart'; import 'package:saphy/utils/colors.dart'; import 'package:saphy/utils/textstyles.dart'; @@ -16,87 +19,25 @@ class MainScreen extends StatefulWidget { class _MainScreenState extends State { final NumberFormat numberFormat = NumberFormat('###,###,###,###'); final int productLength = 6; - List productList = [ - // 그냥 구현용 샘플 데이터 - Product( - id: 1, - brand: "Apple", - name: "iPhone 13", - description: 'Latest iPhone model with A15 Bionic chip', - color: 'Black', - storage: '128GB', - grade: 'A', - imageUrl: - 'https://i.pinimg.com/564x/f3/54/dc/f354dc1f040fc1fc4dfc4c436ad52159.jpg', - price: 250000, - stock: 50, - ), - Product( - id: 2, - brand: "Apple", - name: "iPhone 13", - description: 'Latest iPhone model with A15 Bionic chip', - color: 'White', - storage: '128GB', - grade: 'A', - imageUrl: - 'https://i.pinimg.com/564x/f3/54/dc/f354dc1f040fc1fc4dfc4c436ad52159.jpg', - price: 250000, - stock: 45, - ), - Product( - id: 3, - brand: "Apple", - name: "iPhone 13", - description: 'Latest iPhone model with A15 Bionic chip', - color: 'Blue', - storage: '256GB', - grade: 'B', - imageUrl: - 'https://i.pinimg.com/564x/f3/54/dc/f354dc1f040fc1fc4dfc4c436ad52159.jpg', - price: 270000, - stock: 40, - ), - Product( - id: 4, - brand: "Apple", - name: "iPhone 13", - description: 'Latest iPhone model with A15 Bionic chip', - color: 'Red', - storage: '256GB', - grade: 'A', - imageUrl: - 'https://i.pinimg.com/564x/f3/54/dc/f354dc1f040fc1fc4dfc4c436ad52159.jpg', - price: 280000, - stock: 35, - ), - Product( - id: 5, - brand: "Apple", - name: "iPhone 13", - description: 'Latest iPhone model with A15 Bionic chip', - color: 'Green', - storage: '128GB', - grade: 'C', - imageUrl: - 'https://i.pinimg.com/564x/f3/54/dc/f354dc1f040fc1fc4dfc4c436ad52159.jpg', - price: 240000, - stock: 30, - ), - Product( - id: 6, - brand: "Apple", - name: "iPhone 13", - description: 'Latest iPhone model with A15 Bionic chip', - color: 'Pink', - storage: '512GB', - grade: 'B', - imageUrl: + // Future> getProduct = getProducts(); + + Product product = Product( + id: 1, + name: "iPhone 14", + brand: "Apple", + images: { + "name": "iPhone 14", + 'url': 'https://i.pinimg.com/564x/f3/54/dc/f354dc1f040fc1fc4dfc4c436ad52159.jpg', - price: 290000, - stock: 20, - ), - ]; + }, + price: 130000.0, + description: "Latest model from Apple with advanced features.", + color: "Green", + storage: "128GB", + grade: "A", + deviceType: "phone", + stock: 10, + ); @override Widget build(BuildContext context) { @@ -127,12 +68,9 @@ class _MainScreenState extends State { spacing: 15, runSpacing: 15, children: [ - for (int i = 0; i < productLength; i++) - ProductCard( - brand: productList[i].brand ?? "", - name: productList[i].name ?? "", - imageUrl: productList[i].imageUrl ?? "", - price: productList[i].price ?? 0), + ProductCard( + product: product, + ) ], ), ), @@ -141,4 +79,23 @@ class _MainScreenState extends State { ), ); } + + Future> getProducts() async { + final dio = Dio(); + try { + final response = await dio.get('https://saphy.site/item-wishes'); + if (response.statusCode == 200) { + List products = (response.data as List) + .map((item) => Product.fromJson(item)) + .toList(); + return products; + } else { + throw Exception('Failed to load products'); + } + } catch (e) { + // ignore: avoid_print + print('Error: $e'); + return []; // Return an empty list in case of error + } + } } diff --git a/lib/screens/products/product_detail_page.dart b/lib/screens/products/product_detail_page.dart index f817af1..a4e99e0 100644 --- a/lib/screens/products/product_detail_page.dart +++ b/lib/screens/products/product_detail_page.dart @@ -4,26 +4,17 @@ import 'package:intl/intl.dart'; import 'package:saphy/screens/purchase/purchase_page.dart'; import 'package:saphy/utils/colors.dart'; import 'package:saphy/utils/textstyles.dart'; +import 'package:saphy/models/product.dart'; class ProductDetail extends StatelessWidget { - final String productBrand; - final String productName; - final String productImageUrl; - final double price; + final Product product; - const ProductDetail({ - super.key, - required this.productBrand, - required this.productName, - required this.productImageUrl, - required this.price, - }); + const ProductDetail({super.key, required this.product}); @override Widget build(BuildContext context) { final NumberFormat numberFormat = NumberFormat('###,###,###,###'); var screenWidth = MediaQuery.of(context).size.width; - var screenHeight = MediaQuery.of(context).size.height; return Scaffold( appBar: AppBar( backgroundColor: altWhite, @@ -58,7 +49,8 @@ class ProductDetail extends StatelessWidget { width: double.infinity, decoration: BoxDecoration( image: DecorationImage( - image: CachedNetworkImageProvider(productImageUrl), + image: CachedNetworkImageProvider( + product.images["url"] ?? ""), fit: BoxFit.cover, ), ), @@ -71,18 +63,18 @@ class ProductDetail extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - const Text.rich( + Text.rich( TextSpan( text: "출고가 ", - style: TextStyle( + style: const TextStyle( fontFamily: "Pretendard", fontSize: 15, color: gray700, ), children: [ TextSpan( - text: "500,000원", - style: TextStyle( + text: numberFormat.format(product.price), + style: const TextStyle( decoration: TextDecoration.lineThrough, decorationColor: gray700, fontFamily: "Pretendard", @@ -107,13 +99,13 @@ class ProductDetail extends StatelessWidget { color: mainPrimary, )), TextSpan( - text: "${numberFormat.format(price)}원", + text: "${numberFormat.format(product.price)}원", ), ], ), ), Text( - productName, + product.name, style: const TextStyle( fontWeight: FontWeight.w600, fontFamily: "Pretendard", @@ -229,7 +221,7 @@ class ProductDetail extends StatelessWidget { style: bodyText(), ), Text( - "Grade A", + "Grade ${product.grade}", style: titleText30(), ) ], @@ -335,8 +327,9 @@ class ProductDetail extends StatelessWidget { Navigator.push( context, MaterialPageRoute( - builder: (context) => - const PurchasePage()), + builder: (context) => PurchasePage( + product: product, + )), ); }, child: Container( @@ -452,23 +445,36 @@ class ProductDetail extends StatelessWidget { Navigator.push( context, MaterialPageRoute( - builder: (context) => const PurchasePage()), + builder: (context) => PurchasePage( + product: product, + )), ); }, - child: Container( - height: 50, - decoration: BoxDecoration( - color: const Color(0xff404756), - borderRadius: BorderRadius.circular(10), - ), - child: const Center( - child: Text( - "구매하기", - style: TextStyle( - fontWeight: FontWeight.bold, - fontFamily: "Pretendard", - fontSize: 15, - color: white, + child: InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PurchasePage( + product: product, + )), + ); + }, + child: Container( + height: 50, + decoration: BoxDecoration( + color: const Color(0xff404756), + borderRadius: BorderRadius.circular(10), + ), + child: const Center( + child: Text( + "구매하기", + style: TextStyle( + fontWeight: FontWeight.bold, + fontFamily: "Pretendard", + fontSize: 15, + color: white, + ), ), ), ), diff --git a/lib/screens/purchase/purchase_page.dart b/lib/screens/purchase/purchase_page.dart index 357abfc..4b4582b 100644 --- a/lib/screens/purchase/purchase_page.dart +++ b/lib/screens/purchase/purchase_page.dart @@ -3,9 +3,15 @@ import 'package:saphy/screens/purchase/purchase_process_page.dart'; import 'package:saphy/utils/colors.dart'; import 'package:saphy/widgets/normal_button.dart'; import 'package:saphy/widgets/purchase_info.dart'; +import 'package:saphy/models/product.dart'; class PurchasePage extends StatelessWidget { - const PurchasePage({super.key}); + final Product product; + + const PurchasePage({ + super.key, + required this.product, + }); @override Widget build(BuildContext context) { @@ -24,29 +30,28 @@ class PurchasePage extends StatelessWidget { topRight: Radius.circular(30), ), ), - child: const Padding( - padding: EdgeInsets.symmetric( + child: Padding( + padding: const EdgeInsets.symmetric( horizontal: 20, vertical: 40, ), child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - PurchaseHeader(), - SizedBox(height: 10), + const PurchaseHeader(), + const SizedBox(height: 10), Padding( - padding: EdgeInsets.symmetric(horizontal: 40.0), + padding: const EdgeInsets.symmetric(horizontal: 40.0), child: PurchaseInfo( - // 요기는 나중에는 상품 모델 백엔이랑 해서 정해지면 모델에서 정보 받아올듯 - productCondition: "A", - productColor: "그린", - productName: "Iphone 14", - price: 130000, - productStorage: "128G", + productCondition: product.grade, + productColor: product.color, + productName: product.name, + price: product.price, + productStorage: product.storage, ), ), - Spacer(), - PurchaseFooter(), + const Spacer(), + PurchaseFooter(product: product), ], ), ), @@ -59,7 +64,12 @@ class PurchasePage extends StatelessWidget { } class PurchaseFooter extends StatefulWidget { - const PurchaseFooter({super.key}); + final Product product; + + const PurchaseFooter({ + super.key, + required this.product, + }); @override State createState() => _PurchaseFooterState(); @@ -108,7 +118,10 @@ class _PurchaseFooterState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => (const PurchaseProcessPage())), + builder: (context) => PurchaseProcessPage( + product: widget.product, // widget.product 사용 + ), + ), ); } : () { diff --git a/lib/screens/purchase/purchase_process_page.dart b/lib/screens/purchase/purchase_process_page.dart index 880e362..cfebefe 100644 --- a/lib/screens/purchase/purchase_process_page.dart +++ b/lib/screens/purchase/purchase_process_page.dart @@ -1,10 +1,17 @@ import 'package:flutter/material.dart'; +import 'package:saphy/screens/purchase/payment_page.dart'; import 'package:saphy/utils/colors.dart'; import 'package:saphy/utils/textstyles.dart'; import 'package:saphy/widgets/normal_button.dart'; +import 'package:saphy/models/product.dart'; class PurchaseProcessPage extends StatefulWidget { - const PurchaseProcessPage({super.key}); + final Product product; + + const PurchaseProcessPage({ + super.key, + required this.product, + }); @override State createState() => _PurchaseProcessPageState(); @@ -56,7 +63,13 @@ class _PurchaseProcessPageState extends State { child: NormalButton( title: "결제", bgColor: black, - onTap: () {}, + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => Payment(product: widget.product)), + ); + }, flag: true, txtColor: white), ), @@ -104,10 +117,11 @@ class _PurchaseProcessPageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text("Iphone 14", style: subTitleText()), - Text("256GB, Black", style: bodyText()), + Text(widget.product.name, style: subTitleText()), + Text("${widget.product.storage}, ${widget.product.color}", + style: bodyText()), const Spacer(), - Text("1,000,000원", style: subTitleText()), + Text("${widget.product.price}", style: subTitleText()), ], ), ), diff --git a/lib/widgets/product_card.dart b/lib/widgets/product_card.dart index 210490c..66b3e42 100644 --- a/lib/widgets/product_card.dart +++ b/lib/widgets/product_card.dart @@ -3,20 +3,12 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:intl/intl.dart'; import 'package:saphy/screens/products/product_detail_page.dart'; import 'package:saphy/utils/textstyles.dart'; +import "package:saphy/models/product.dart"; class ProductCard extends StatelessWidget { - final String brand; - final String name; - final String imageUrl; - final double price; + final Product product; - const ProductCard({ - super.key, - required this.brand, - required this.name, - required this.imageUrl, - required this.price, - }); + const ProductCard({super.key, required this.product}); @override Widget build(BuildContext context) { @@ -28,10 +20,7 @@ class ProductCard extends StatelessWidget { context, MaterialPageRoute( builder: (context) => ProductDetail( - productBrand: brand, - productName: name, - productImageUrl: imageUrl, - price: price, + product: product, ), ), ); @@ -51,7 +40,8 @@ class ProductCard extends StatelessWidget { decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), image: DecorationImage( - image: CachedNetworkImageProvider(imageUrl), + image: + CachedNetworkImageProvider(product.images["url"] ?? ""), fit: BoxFit.cover, ), ), @@ -66,9 +56,9 @@ class ProductCard extends StatelessWidget { Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - Text(name, style: bodyBoldText()), + Text(product.name, style: bodyBoldText()), Text( - brand, + product.brand, style: const TextStyle( fontFamily: "Pretendard", fontSize: 10, @@ -80,7 +70,7 @@ class ProductCard extends StatelessWidget { height: 4, ), Text( - "${numberFormat.format(price)}원", + "${numberFormat.format(product.price)}원", style: const TextStyle( fontWeight: FontWeight.w800, fontFamily: "Pretendard", From 029474ee8fd1afdb7e9a3e33a4c4ba9c40756a4d Mon Sep 17 00:00:00 2001 From: cho4u4o Date: Sun, 29 Sep 2024 17:41:18 +0900 Subject: [PATCH 3/4] chore : add payment package and page --- lib/screens/purchase/payment_page.dart | 137 +++++--------- linux/flutter/generated_plugin_registrant.cc | 4 + linux/flutter/generated_plugins.cmake | 1 + macos/Flutter/GeneratedPluginRegistrant.swift | 4 +- pubspec.lock | 176 +++++++----------- pubspec.yaml | 2 +- .../flutter/generated_plugin_registrant.cc | 6 +- windows/flutter/generated_plugins.cmake | 2 +- 8 files changed, 130 insertions(+), 202 deletions(-) diff --git a/lib/screens/purchase/payment_page.dart b/lib/screens/purchase/payment_page.dart index 443aa7a..f3bbef6 100644 --- a/lib/screens/purchase/payment_page.dart +++ b/lib/screens/purchase/payment_page.dart @@ -1,102 +1,57 @@ import 'package:flutter/material.dart'; -import 'package:tosspayments_widget_sdk_flutter/model/payment_info.dart'; -import 'package:tosspayments_widget_sdk_flutter/model/payment_widget_options.dart'; -import 'package:tosspayments_widget_sdk_flutter/payment_widget.dart'; -import 'package:tosspayments_widget_sdk_flutter/widgets/agreement.dart'; -import 'package:tosspayments_widget_sdk_flutter/widgets/payment_method.dart'; -class PaymentPage extends StatefulWidget { - const PaymentPage({super.key}); - @override - State createState() { - return _PaymentPageState(); - } -} +/* 아임포트 결제 모듈을 불러옵니다. */ +import 'package:iamport_flutter/iamport_payment.dart'; +/* 아임포트 결제 데이터 모델을 불러옵니다. */ +import 'package:iamport_flutter/model/payment_data.dart'; -class _PaymentPageState extends State { - late PaymentWidget _paymentWidget; - PaymentMethodWidgetControl? _paymentMethodWidgetControl; - AgreementWidgetControl? _agreementWidgetControl; - @override - void initState() { - super.initState(); - _paymentWidget = PaymentWidget( - clientKey: "test_gck_docs_Ovk5rk1EwkEbP0W43n07xlzm", - customerKey: "ynygwDdyclboRnSIgyNqw", - // 결제위젯에 브랜드페이 추가하기 - // paymentWidgetOptions: PaymentWidgetOptions(brandPayOption: BrandPayOption("리다이렉트 URL")) // Access Token 발급에 사용되는 리다이렉트 URL - ); - _paymentWidget - .renderPaymentMethods( - selector: 'methods', - amount: Amount(value: 300, currency: Currency.KRW, country: "KR"), - options: RenderPaymentMethodsOptions(variantKey: "DEFAULT")) - .then((control) { - _paymentMethodWidgetControl = control; - }); - _paymentWidget.renderAgreement(selector: 'agreement').then((control) { - _agreementWidgetControl = control; - }); - } +class Payment extends StatelessWidget { + const Payment({super.key}); @override Widget build(BuildContext context) { - return Scaffold( - body: SafeArea( - child: Column( - children: [ - Expanded( - child: ListView( - children: [ - PaymentMethodWidget( - paymentWidget: _paymentWidget, - selector: 'methods', - ), - AgreementWidget( - paymentWidget: _paymentWidget, selector: 'agreement'), - ElevatedButton( - onPressed: () async { - final paymentResult = - await _paymentWidget.requestPayment( - paymentInfo: const PaymentInfo( - orderId: '_t1fPAFA2Lm84f08Gkw2x', - orderName: '토스 티셔츠 외 2건')); - if (paymentResult.success != null) { - // 결제 성공 처리 - } else if (paymentResult.fail != null) { - // 결제 실패 처리 - } - }, - child: const Text('결제하기')), - // ElevatedButton( - // onPressed: () async { - // final selectedPaymentMethod = - // await _paymentMethodWidgetControl - // ?.getSelectedPaymentMethod(); - // print( - // '${selectedPaymentMethod?.method} ${selectedPaymentMethod?.easyPay?.provider ?? ''}'); - // }, - // child: const Text('선택한 결제수단 출력')), - // ElevatedButton( - // onPressed: () async { - // final agreementStatus = - // await _agreementWidgetControl?.getAgreementStatus(); - // print('${agreementStatus?.agreedRequiredTerms}'); - // }, - // child: const Text('약관 동의 상태 출력')), - // ElevatedButton( - // onPressed: () async { - // await _paymentMethodWidgetControl?.updateAmount( - // amount: 300); - // print('결제 금액이 300원으로 변경되었습니다.'); - // }, - // child: const Text('결제 금액 변경')) - ], - ), - ) - ], + return IamportPayment( + appBar: AppBar( + title: const Text('아임포트 결제'), + ), + /* 웹뷰 로딩 컴포넌트 */ + initialChild: Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset('assets/images/iamport-logo.png'), + const Padding(padding: EdgeInsets.symmetric(vertical: 15)), + const Text('잠시만 기다려주세요...', style: TextStyle(fontSize: 20)), + ], + ), ), ), + /* [필수입력] 가맹점 식별코드 */ + userCode: 'iamport', + /* [필수입력] 결제 데이터 */ + data: PaymentData( + pg: 'html5_inicis', // PG사 + payMethod: 'card', // 결제수단 + name: '아임포트 결제데이터 분석', // 주문명 + merchantUid: 'mid_${DateTime.now().millisecondsSinceEpoch}', // 주문번호 + amount: 39000, // 결제금액 + buyerName: '홍길동', // 구매자 이름 + buyerTel: '01012345678', // 구매자 연락처 + buyerEmail: 'example@naver.com', // 구매자 이메일 + buyerAddr: '서울시 강남구 신사동 661-16', // 구매자 주소 + buyerPostcode: '06018', // 구매자 우편번호 + appScheme: 'example', // 앱 URL scheme + cardQuota: [2, 3] //결제창 UI 내 할부개월수 제한 + ), + /* [필수입력] 콜백 함수 */ + callback: (Map result) { + Navigator.pushReplacementNamed( + context, + '/result', + arguments: result, + ); + }, ); } } diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index 38dd0bc..5a27a5d 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -7,12 +7,16 @@ #include "generated_plugin_registrant.h" #include +#include #include void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) flutter_secure_storage_linux_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterSecureStorageLinuxPlugin"); flutter_secure_storage_linux_plugin_register_with_registrar(flutter_secure_storage_linux_registrar); + g_autoptr(FlPluginRegistrar) gtk_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "GtkPlugin"); + gtk_plugin_register_with_registrar(gtk_registrar); g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 65240e9..98d181b 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -4,6 +4,7 @@ list(APPEND FLUTTER_PLUGIN_LIST flutter_secure_storage_linux + gtk url_launcher_linux ) diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index ffa1237..af513e9 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,9 +5,9 @@ import FlutterMacOS import Foundation +import app_links import firebase_auth import firebase_core -import flutter_inappwebview_macos import flutter_secure_storage_macos import google_sign_in_ios import path_provider_foundation @@ -16,9 +16,9 @@ import sqflite import url_launcher_macos func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + AppLinksMacosPlugin.register(with: registry.registrar(forPlugin: "AppLinksMacosPlugin")) FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin")) FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) - InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin")) FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin")) FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) diff --git a/pubspec.lock b/pubspec.lock index 04d54d7..669b6de 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -33,6 +33,38 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.2" + app_links: + dependency: transitive + description: + name: app_links + sha256: ad1a6d598e7e39b46a34f746f9a8b011ee147e4c275d407fa457e7a62f84dd99 + url: "https://pub.dev" + source: hosted + version: "6.3.2" + app_links_linux: + dependency: transitive + description: + name: app_links_linux + sha256: f5f7173a78609f3dfd4c2ff2c95bd559ab43c80a87dc6a095921d96c05688c81 + url: "https://pub.dev" + source: hosted + version: "1.0.3" + app_links_platform_interface: + dependency: transitive + description: + name: app_links_platform_interface + sha256: "05f5379577c513b534a29ddea68176a4d4802c46180ee8e2e966257158772a3f" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + app_links_web: + dependency: transitive + description: + name: app_links_web + sha256: af060ed76183f9e2b87510a9480e56a5352b6c249778d07bd2c95fc35632a555 + url: "https://pub.dev" + source: hosted + version: "1.0.4" archive: dependency: transitive description: @@ -326,70 +358,6 @@ packages: url: "https://pub.dev" source: hosted version: "5.1.0" - flutter_inappwebview: - dependency: transitive - description: - name: flutter_inappwebview - sha256: "9f023eaa11c91330344aca4c45cd537aba9ccd92ef74b41cd9e112a862530a4f" - url: "https://pub.dev" - source: hosted - version: "6.1.2" - flutter_inappwebview_android: - dependency: transitive - description: - name: flutter_inappwebview_android - sha256: "6b24fbbaa69168da2d2ab4ddb2d65677468e2a0a0d593d629558537f710786dc" - url: "https://pub.dev" - source: hosted - version: "1.1.0+4" - flutter_inappwebview_internal_annotations: - dependency: transitive - description: - name: flutter_inappwebview_internal_annotations - sha256: "5f80fd30e208ddded7dbbcd0d569e7995f9f63d45ea3f548d8dd4c0b473fb4c8" - url: "https://pub.dev" - source: hosted - version: "1.1.1" - flutter_inappwebview_ios: - dependency: transitive - description: - name: flutter_inappwebview_ios - sha256: "571b0bfdb963548fcb945b9abe357352b4a523c249b4f9816fc5a83e2a71d9ec" - url: "https://pub.dev" - source: hosted - version: "1.1.0+3" - flutter_inappwebview_macos: - dependency: transitive - description: - name: flutter_inappwebview_macos - sha256: e5e7f09dabd7b5b2ef15b00c07ed4da4a45bd597db0c4221702485665b6628b7 - url: "https://pub.dev" - source: hosted - version: "1.1.0+3" - flutter_inappwebview_platform_interface: - dependency: transitive - description: - name: flutter_inappwebview_platform_interface - sha256: da6c7bf193beba655bdfcd825b6c7f7b51da4944e1eb76bf9faddf685ca15fa2 - url: "https://pub.dev" - source: hosted - version: "1.1.1" - flutter_inappwebview_web: - dependency: transitive - description: - name: flutter_inappwebview_web - sha256: ee1389bfec8c9ef07ba4be48a117207c9392dbdbf366330aa26d69f67a826978 - url: "https://pub.dev" - source: hosted - version: "1.1.0+2" - flutter_inappwebview_windows: - dependency: transitive - description: - name: flutter_inappwebview_windows - sha256: "3ad92e93bafc2984f90f627783c3f5fc705842fb8d4f7213f92bb9027c6eac94" - url: "https://pub.dev" - source: hosted - version: "0.3.0+1" flutter_lints: dependency: "direct dev" description: @@ -536,6 +504,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.12.2+1" + gtk: + dependency: transitive + description: + name: gtk + sha256: e8ce9ca4b1df106e4d72dad201d345ea1a036cc12c360f1a7d5a758f78ffa42c + url: "https://pub.dev" + source: hosted + version: "2.1.0" html: dependency: transitive description: @@ -560,6 +536,22 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.2" + iamport_flutter: + dependency: "direct main" + description: + name: iamport_flutter + sha256: "7409b500204c4d39e796affa638c59fc4f691e203a48ff0741defe295479a1b7" + url: "https://pub.dev" + source: hosted + version: "0.10.19" + iamport_webview_flutter: + dependency: transitive + description: + name: iamport_webview_flutter + sha256: "27aeba02a2b8a4439f734b8aa8079b21d23d419fb7abd0efc2ea99fdbe088ad5" + url: "https://pub.dev" + source: hosted + version: "3.0.7" image: dependency: transitive description: @@ -644,18 +636,18 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" url: "https://pub.dev" source: hosted - version: "10.0.5" + version: "10.0.4" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" url: "https://pub.dev" source: hosted - version: "3.0.5" + version: "3.0.3" leak_tracker_testing: dependency: transitive description: @@ -700,18 +692,18 @@ packages: dependency: transitive description: name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.11.1" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.12.0" octo_image: dependency: transitive description: @@ -720,14 +712,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.0" - os_info_plugin: - dependency: transitive - description: - name: os_info_plugin - sha256: "381a8ba0a6ab663565a63e40d2eb859e227b022fd458b4ea01cb32459286285f" - url: "https://pub.dev" - source: hosted - version: "0.0.1" package_config: dependency: transitive description: @@ -1041,10 +1025,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" url: "https://pub.dev" source: hosted - version: "0.7.2" + version: "0.7.0" toggle_list: dependency: "direct main" description: @@ -1053,22 +1037,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.3.1" - tosspayments_webview_flutter: - dependency: transitive - description: - name: tosspayments_webview_flutter - sha256: b2c61c5275dda9128f05fe13af9b642087ecb71f4ddece454f0b3dbb7e3c76c6 - url: "https://pub.dev" - source: hosted - version: "1.0.4" - tosspayments_widget_sdk_flutter: - dependency: "direct main" - description: - name: tosspayments_widget_sdk_flutter - sha256: c8bc1f2db6c7f1eabc40114b21fc6662a7e089bda666e47531fd2b6dee440ad4 - url: "https://pub.dev" - source: hosted - version: "2.0.6" typed_data: dependency: transitive description: @@ -1097,10 +1065,10 @@ packages: dependency: transitive description: name: url_launcher_android - sha256: e35a698ac302dd68e41f73250bd9517fe3ab5fa4f18fe4647a0872db61bacbab + sha256: f0c73347dfcfa5b3db8bc06e1502668265d39c08f310c29bff4e28eea9699f79 url: "https://pub.dev" source: hosted - version: "6.3.10" + version: "6.3.9" url_launcher_ios: dependency: transitive description: @@ -1193,10 +1161,10 @@ packages: dependency: transitive description: name: vm_service - sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" url: "https://pub.dev" source: hosted - version: "14.2.5" + version: "14.2.1" watcher: dependency: transitive description: @@ -1278,5 +1246,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.5.0 <4.0.0" - flutter: ">=3.24.0" + dart: ">=3.4.0 <4.0.0" + flutter: ">=3.22.0" diff --git a/pubspec.yaml b/pubspec.yaml index 109e4d3..11edb72 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -54,7 +54,7 @@ dependencies: simple_shadow: ^0.3.1 toggle_list: ^0.3.1 carousel_slider: ^5.0.0 - tosspayments_widget_sdk_flutter: ^2.0.6 + iamport_flutter: ^0.10.0 dev_dependencies: flutter_lints: ^4.0.0 diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index b333ccb..cf7eadf 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,19 +6,19 @@ #include "generated_plugin_registrant.h" +#include #include #include -#include #include #include void RegisterPlugins(flutter::PluginRegistry* registry) { + AppLinksPluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("AppLinksPluginCApi")); FirebaseAuthPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("FirebaseAuthPluginCApi")); FirebaseCorePluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("FirebaseCorePluginCApi")); - FlutterInappwebviewWindowsPluginCApiRegisterWithRegistrar( - registry->GetRegistrarForPlugin("FlutterInappwebviewWindowsPluginCApi")); FlutterSecureStorageWindowsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin")); UrlLauncherWindowsRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 0e1bc02..3b45a00 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,9 +3,9 @@ # list(APPEND FLUTTER_PLUGIN_LIST + app_links firebase_auth firebase_core - flutter_inappwebview_windows flutter_secure_storage_windows url_launcher_windows ) From cb694d756d6d714b9958365a2ac55eb8f480aec9 Mon Sep 17 00:00:00 2001 From: cho4u4o Date: Sun, 29 Sep 2024 17:41:34 +0900 Subject: [PATCH 4/4] feat : modify product model and pages --- lib/screens/products/liked_list_page.dart | 94 +------------------ .../purchase/purchase_process_page.dart | 7 +- 2 files changed, 5 insertions(+), 96 deletions(-) diff --git a/lib/screens/products/liked_list_page.dart b/lib/screens/products/liked_list_page.dart index 484d685..1f19fe5 100644 --- a/lib/screens/products/liked_list_page.dart +++ b/lib/screens/products/liked_list_page.dart @@ -17,87 +17,6 @@ class LikedListPage extends StatefulWidget { class _LikedListPageState extends State { final NumberFormat numberFormat = NumberFormat('###,###,###,###'); final int productLength = 6; - List productList = [ - // 그냥 구현용 샘플 데이터 - Product( - id: 1, - brand: "Apple", - name: "iPhone 13", - description: 'Latest iPhone model with A15 Bionic chip', - color: 'Black', - storage: '128GB', - grade: 'A', - imageUrl: - 'https://i.pinimg.com/564x/f3/54/dc/f354dc1f040fc1fc4dfc4c436ad52159.jpg', - price: 250000, - stock: 50, - ), - Product( - id: 2, - brand: "Apple", - name: "iPhone 13", - description: 'Latest iPhone model with A15 Bionic chip', - color: 'White', - storage: '128GB', - grade: 'A', - imageUrl: - 'https://i.pinimg.com/564x/f3/54/dc/f354dc1f040fc1fc4dfc4c436ad52159.jpg', - price: 250000, - stock: 45, - ), - Product( - id: 3, - brand: "Apple", - name: "iPhone 13", - description: 'Latest iPhone model with A15 Bionic chip', - color: 'Blue', - storage: '256GB', - grade: 'B', - imageUrl: - 'https://i.pinimg.com/564x/f3/54/dc/f354dc1f040fc1fc4dfc4c436ad52159.jpg', - price: 270000, - stock: 40, - ), - Product( - id: 4, - brand: "Apple", - name: "iPhone 13", - description: 'Latest iPhone model with A15 Bionic chip', - color: 'Red', - storage: '256GB', - grade: 'A', - imageUrl: - 'https://i.pinimg.com/564x/f3/54/dc/f354dc1f040fc1fc4dfc4c436ad52159.jpg', - price: 280000, - stock: 35, - ), - Product( - id: 5, - brand: "Apple", - name: "iPhone 13", - description: 'Latest iPhone model with A15 Bionic chip', - color: 'Green', - storage: '128GB', - grade: 'C', - imageUrl: - 'https://i.pinimg.com/564x/f3/54/dc/f354dc1f040fc1fc4dfc4c436ad52159.jpg', - price: 240000, - stock: 30, - ), - Product( - id: 6, - brand: "Apple", - name: "iPhone 13", - description: 'Latest iPhone model with A15 Bionic chip', - color: 'Pink', - storage: '512GB', - grade: 'B', - imageUrl: - 'https://i.pinimg.com/564x/f3/54/dc/f354dc1f040fc1fc4dfc4c436ad52159.jpg', - price: 290000, - stock: 20, - ), - ]; @override Widget build(BuildContext context) { @@ -290,22 +209,15 @@ class _LikedListPageState extends State { ), ), ), - SliverPadding( - padding: const EdgeInsets.all(20), + const SliverPadding( + padding: EdgeInsets.all(20), sliver: SliverToBoxAdapter( child: Wrap( direction: Axis.horizontal, alignment: WrapAlignment.spaceBetween, spacing: 15, runSpacing: 15, - children: [ - for (int i = 0; i < productLength; i++) - ProductCard( - brand: productList[i].brand ?? "", - name: productList[i].name ?? "", - imageUrl: productList[i].imageUrl ?? "", - price: productList[i].price ?? 0), - ], + children: [], ), ), ), diff --git a/lib/screens/purchase/purchase_process_page.dart b/lib/screens/purchase/purchase_process_page.dart index cfebefe..667b6a9 100644 --- a/lib/screens/purchase/purchase_process_page.dart +++ b/lib/screens/purchase/purchase_process_page.dart @@ -64,11 +64,8 @@ class _PurchaseProcessPageState extends State { title: "결제", bgColor: black, onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => Payment(product: widget.product)), - ); + Navigator.push(context, + MaterialPageRoute(builder: (context) => (Container()))); }, flag: true, txtColor: white),