-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/hosted platform views #67
Commits on Oct 23, 2023
-
Configuration menu - View commit details
-
Copy full SHA for a3685af - Browse repository at this point
Copy the full SHA a3685afView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9b623ba - Browse repository at this point
Copy the full SHA 9b623baView commit details -
Configuration menu - View commit details
-
Copy full SHA for e915c52 - Browse repository at this point
Copy the full SHA e915c52View commit details -
Added bottom sheet example and made ios card component transparent
diff --git a/example/lib/main.dart b/example/lib/main.dart index cf7a81b..60e1f30 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -88,11 +88,57 @@ class _MyAppState extends State<MyApp> { MaterialPageRoute( builder: (context) => FirstRoute( repository: _adyenSessionRepository, - )), ); }, - child: const Text("Card component")), + child: const Text("Card component scroll view")), + TextButton( + onPressed: () { + showModalBottomSheet( + context: context, + isScrollControlled: true, + backgroundColor: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + builder: (BuildContext context) { + return SingleChildScrollView( + child: Column( + children: [ + Container(height: 8), + Container( + width: 48, + height: 6, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.grey), + ), + Container(height: 8), + Container( + padding: EdgeInsets.only( + bottom: + MediaQuery.of(context).viewInsets.bottom), + child: FutureBuilder<String>( + future: _adyenSessionRepository + .fetchPaymentMethods(), + builder: (BuildContext context, + AsyncSnapshot<String> snapshot) { + if (snapshot.data == null) { + return const Center( + child: CircularProgressIndicator(), + ); + } else { + return buildCardWidget(snapshot, context, + _adyenSessionRepository); + } + }, + ), + ), + ], + )); + }); + }, + child: const Text("Card component sheet")), ], ), ), diff --git a/example/lib/navigation/routes.dart b/example/lib/navigation/routes.dart index 2f48364..1f7c146 100644 --- a/example/lib/navigation/routes.dart +++ b/example/lib/navigation/routes.dart @@ -29,7 +29,7 @@ class FirstRoute extends StatelessWidget { child: Column( children: [ const FlutterLogo(size: 128), - buildCardWidget(snapshot, context), + buildCardWidget(snapshot, context, repository), Container(height: 50), Container(height: 280, color: Colors.blue), const Text( @@ -43,55 +43,60 @@ class FirstRoute extends StatelessWidget { ), )); } +} - Widget buildCardWidget(AsyncSnapshot<String> snapshot, BuildContext context) { - return AdyenCardWidget( - paymentMethods: snapshot.data!, - clientKey: Config.clientKey, - onSubmit: repository.postPayments, - onResult: (event) async { - _dialogBuilder(context, event); - }, - ); - } - _dialogBuilder(BuildContext context, PaymentResult paymentResult) { - String title = ""; - String message = ""; - switch (paymentResult) { - case PaymentAdvancedFlowFinished(): - title = "Finished"; - message = "Result code: ${paymentResult.resultCode}"; - case PaymentSessionFinished(): - title = "Finished"; - message = "Result code: ${paymentResult.resultCode}"; - case PaymentCancelledByUser(): - title = "Cancelled by user"; - message = "Drop-in cancelled by user"; - case PaymentError(): - title = "Error occurred"; - message = "${paymentResult.reason}"; - } +Widget buildCardWidget( + AsyncSnapshot<String> snapshot, + BuildContext context, + AdyenSessionsRepository repository, +) { + return AdyenCardWidget( + paymentMethods: snapshot.data!, + clientKey: Config.clientKey, + onSubmit: repository.postPayments, + onResult: (event) async { + _dialogBuilder(context, event); + }, + ); +} - return showDialog( - context: context, - builder: (BuildContext context) { - return AlertDialog( - title: Text(title), - content: Text(message), - actions: <Widget>[ - TextButton( - style: TextButton.styleFrom( - textStyle: Theme.of(context).textTheme.labelLarge, - ), - child: const Text('Close'), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - ], - ); - }, - ); +_dialogBuilder(BuildContext context, PaymentResult paymentResult) { + String title = ""; + String message = ""; + switch (paymentResult) { + case PaymentAdvancedFlowFinished(): + title = "Finished"; + message = "Result code: ${paymentResult.resultCode}"; + case PaymentSessionFinished(): + title = "Finished"; + message = "Result code: ${paymentResult.resultCode}"; + case PaymentCancelledByUser(): + title = "Cancelled by user"; + message = "Drop-in cancelled by user"; + case PaymentError(): + title = "Error occurred"; + message = "${paymentResult.reason}"; } + + return showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: Text(title), + content: Text(message), + actions: <Widget>[ + TextButton( + style: TextButton.styleFrom( + textStyle: Theme.of(context).textTheme.labelLarge, + ), + child: const Text('Close'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ); + }, + ); } diff --git a/example/lib/network/models/session_request_network_model.dart b/example/lib/network/models/session_request_network_model.dart index 232e31f..22d6f9f 100644 --- a/example/lib/network/models/session_request_network_model.dart +++ b/example/lib/network/models/session_request_network_model.dart @@ -47,6 +47,29 @@ class SessionRequestNetworkModel { String toRawJson() => json.encode(toJson()); Map<String, dynamic> toJson() { + Map<String, dynamic> installmentOptions = json.decode("""{ + "visa": { + "plans": [ + "regular" + ], + "values": [ + 2, + 4 + ] + }, + "mc": { + "values": [ + 2, + 3, + 5 + ], + "plans": [ + "regular", + "revolving" + ] + } + }"""); + final Map<String, dynamic> data = <String, dynamic>{}; data['merchantAccount'] = merchantAccount; data['amount'] = amount.toJson(); @@ -66,6 +89,7 @@ class SessionRequestNetworkModel { data['deliveryAddress'] = deliveryAddress?.toJson(); data['lineItems'] = lineItems?.map((lineItem) => lineItem.toJson()).toList(); + data['installmentOptions'] = installmentOptions; return data; } } diff --git a/ios/Classes/components/CardComponent.swift b/ios/Classes/components/CardComponent.swift index 9607bd5..703763a 100644 --- a/ios/Classes/components/CardComponent.swift +++ b/ios/Classes/components/CardComponent.swift @@ -79,7 +79,6 @@ class FLNativeView: NSObject, FlutterPlatformView, PaymentComponentDelegate { } func createNativeView(view _view: TestView, args: NSDictionary){ - _view.backgroundColor = UIColor.blue _view.handler = { let height = self.cardComponent?.viewController.preferredContentSize.height @@ -97,6 +96,7 @@ class FLNativeView: NSObject, FlutterPlatformView, PaymentComponentDelegate { self.cardComponent = component let componentViewController = component.viewController + rootViewController = getViewController() rootViewController?.addChild(componentViewController) @@ -104,6 +104,7 @@ class FLNativeView: NSObject, FlutterPlatformView, PaymentComponentDelegate { componentViewController.view.frame = CGRect(x:0.0, y:0.0, width: 0, height:0) (componentViewController.view.subviews[0].subviews[0] as? UIScrollView)?.bounces = false (componentViewController.view.subviews[0].subviews[0] as? UIScrollView)?.isScrollEnabled = false + (componentViewController.view.subviews[0].subviews[0] as? UIScrollView)?.alwaysBounceVertical = false //let formViewController = componentViewController.children[0] @@ -154,8 +155,11 @@ class FLNativeView: NSObject, FlutterPlatformView, PaymentComponentDelegate { throw PlatformError(errorDescription: "error") } + var style = FormComponentStyle() + style.backgroundColor = UIColor.clear let component = CardComponent(paymentMethod: paymentMethod, - context: adyenContext + context: adyenContext, + configuration: .init(style: style) ) component.cardComponentDelegate = self return component diff --git a/ios/Classes/components/TestView.swift b/ios/Classes/components/TestView.swift index 15c5850..f8de610 100644 --- a/ios/Classes/components/TestView.swift +++ b/ios/Classes/components/TestView.swift @@ -25,9 +25,5 @@ class TestView : UIStackView { super.layoutSubviews() handler() - - print("Layout custom view") - print(bounds.height) - print(subviews.first?.systemLayoutSizeFitting(.init(width: bounds.width, height: .greatestFiniteMagnitude))) } } diff --git a/lib/src/components/card_widget.dart b/lib/src/components/card_widget.dart index 65b390a..58c75dc 100644 --- a/lib/src/components/card_widget.dart +++ b/lib/src/components/card_widget.dart @@ -65,15 +65,10 @@ class AdyenCardWidget extends StatelessWidget { builder: (BuildContext context, AsyncSnapshot<double> snapshot) { print("value is: $snapshot"); return SizedBox( - height: snapshot.data ?? 500, + height: (snapshot.data ?? 300) + 40, child: cardView, ); }); - - // return SizedBox( - // height: 500, - // child: cardView, - // ); } Widget buildCardView(String viewType, Map<String, dynamic> creationParams) {
Configuration menu - View commit details
-
Copy full SHA for 7c076c7 - Browse repository at this point
Copy the full SHA 7c076c7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0fa9b2d - Browse repository at this point
Copy the full SHA 0fa9b2dView commit details
Commits on Oct 24, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 7e7001b - Browse repository at this point
Copy the full SHA 7e7001bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0d35ba1 - Browse repository at this point
Copy the full SHA 0d35ba1View commit details
Commits on Oct 25, 2023
-
Added separate pigeon pipe for components and added card configuratio…
…n for card component
Configuration menu - View commit details
-
Copy full SHA for 347a7c8 - Browse repository at this point
Copy the full SHA 347a7c8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9397d23 - Browse repository at this point
Copy the full SHA 9397d23View commit details
Commits on Oct 27, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 925edb4 - Browse repository at this point
Copy the full SHA 925edb4View commit details
Commits on Oct 30, 2023
-
Configuration menu - View commit details
-
Copy full SHA for d5b6015 - Browse repository at this point
Copy the full SHA d5b6015View commit details -
Configuration menu - View commit details
-
Copy full SHA for d50296a - Browse repository at this point
Copy the full SHA d50296aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9f7f741 - Browse repository at this point
Copy the full SHA 9f7f741View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9ded7ec - Browse repository at this point
Copy the full SHA 9ded7ecView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3f63efa - Browse repository at this point
Copy the full SHA 3f63efaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 964f819 - Browse repository at this point
Copy the full SHA 964f819View commit details -
Merge branch 'feature/renameDropInOutcome' into feature/hostedPlatfor…
…mViews # Conflicts: # android/src/main/kotlin/com/adyen/adyen_checkout/PlatformApi.kt # ios/Classes/PlatformApi.swift # lib/src/generated/platform_api.g.dart # pigeons/platform_api.dart
Configuration menu - View commit details
-
Copy full SHA for 2bc3e3d - Browse repository at this point
Copy the full SHA 2bc3e3dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8839ecd - Browse repository at this point
Copy the full SHA 8839ecdView commit details
Commits on Oct 31, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 425ea7f - Browse repository at this point
Copy the full SHA 425ea7fView commit details -
Configuration menu - View commit details
-
Copy full SHA for cd17cb5 - Browse repository at this point
Copy the full SHA cd17cb5View commit details -
Configuration menu - View commit details
-
Copy full SHA for e7e49ad - Browse repository at this point
Copy the full SHA e7e49adView commit details -
Configuration menu - View commit details
-
Copy full SHA for 45e2ed9 - Browse repository at this point
Copy the full SHA 45e2ed9View commit details
Commits on Nov 2, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 1ecae68 - Browse repository at this point
Copy the full SHA 1ecae68View commit details
Commits on Nov 3, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 28e36dd - Browse repository at this point
Copy the full SHA 28e36ddView commit details
Commits on Nov 6, 2023
-
Configuration menu - View commit details
-
Copy full SHA for b426015 - Browse repository at this point
Copy the full SHA b426015View commit details
Commits on Nov 7, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 71e0eeb - Browse repository at this point
Copy the full SHA 71e0eebView commit details -
Configuration menu - View commit details
-
Copy full SHA for c8afa17 - Browse repository at this point
Copy the full SHA c8afa17View commit details -
Configuration menu - View commit details
-
Copy full SHA for af2bd02 - Browse repository at this point
Copy the full SHA af2bd02View commit details
Commits on Nov 8, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 124e868 - Browse repository at this point
Copy the full SHA 124e868View commit details
Commits on Nov 9, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 4d2c375 - Browse repository at this point
Copy the full SHA 4d2c375View commit details -
Configuration menu - View commit details
-
Copy full SHA for fef8051 - Browse repository at this point
Copy the full SHA fef8051View commit details -
Configuration menu - View commit details
-
Copy full SHA for a4bdbdc - Browse repository at this point
Copy the full SHA a4bdbdcView commit details -
Configuration menu - View commit details
-
Copy full SHA for f594a16 - Browse repository at this point
Copy the full SHA f594a16View commit details
Commits on Nov 10, 2023
-
Prevented scrolling of ios native component and added more initial he…
…ight configurations
Configuration menu - View commit details
-
Copy full SHA for e8f8b9d - Browse repository at this point
Copy the full SHA e8f8b9dView commit details
Commits on Nov 14, 2023
-
Updated to Android SDK 5.0.1 Added language support for example app
Configuration menu - View commit details
-
Copy full SHA for 234417a - Browse repository at this point
Copy the full SHA 234417aView commit details
Commits on Nov 16, 2023
-
Improved native view rendering within flutter tree
Extracted redundant code into a separate widget
Configuration menu - View commit details
-
Copy full SHA for 713c841 - Browse repository at this point
Copy the full SHA 713c841View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0f08d2a - Browse repository at this point
Copy the full SHA 0f08d2aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7774c78 - Browse repository at this point
Copy the full SHA 7774c78View commit details
Commits on Nov 21, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 4e4d97b - Browse repository at this point
Copy the full SHA 4e4d97bView commit details
Commits on Nov 24, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 7fd21fe - Browse repository at this point
Copy the full SHA 7fd21feView commit details
Commits on Nov 27, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 51a0506 - Browse repository at this point
Copy the full SHA 51a0506View commit details -
Configuration menu - View commit details
-
Copy full SHA for f14aa25 - Browse repository at this point
Copy the full SHA f14aa25View commit details -
Changed ComponentFlutterAPI to ComponentFlutterInterface in pigeon to…
… apply correct class naming
Configuration menu - View commit details
-
Copy full SHA for cb276de - Browse repository at this point
Copy the full SHA cb276deView commit details -
Configuration menu - View commit details
-
Copy full SHA for ca9d11d - Browse repository at this point
Copy the full SHA ca9d11dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 185a99a - Browse repository at this point
Copy the full SHA 185a99aView commit details -
Configuration menu - View commit details
-
Copy full SHA for f11d5d1 - Browse repository at this point
Copy the full SHA f11d5d1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 83f1158 - Browse repository at this point
Copy the full SHA 83f1158View commit details -
Configuration menu - View commit details
-
Copy full SHA for 287d338 - Browse repository at this point
Copy the full SHA 287d338View commit details
Commits on Dec 1, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 863360c - Browse repository at this point
Copy the full SHA 863360cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 58af2e9 - Browse repository at this point
Copy the full SHA 58af2e9View commit details