Skip to content

Commit

Permalink
feat: DM Partner Branding
Browse files Browse the repository at this point in the history
  • Loading branch information
indrajit-roy committed Jun 17, 2022
1 parent a8dd801 commit 002e594
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 75 deletions.
6 changes: 6 additions & 0 deletions android/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.android.tools.build:gradle:3.5.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.7.3"
classpath 'com.google.gms:google-services:4.3.3'
Expand Down
41 changes: 32 additions & 9 deletions example/lib/gateway.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ import 'package:scgateway_flutter_plugin/scgateway_flutter_plugin.dart';
import 'package:scgateway_flutter_plugin_example/models/UserHoldingsResponse.dart';
import 'package:scgateway_flutter_plugin_example/smartinvesting.dart';

extension ColorExt on Color {
static Color fromHex(String hexString) {
try {
final buffer = StringBuffer();
if (hexString.length == 6 || hexString.length == 7) buffer.write('ff');
buffer.write(hexString.replaceFirst('#', ''));
return Color(int.parse(buffer.toString(), radix: 16));
} on Exception catch (e) {
return null;
}
}
}

class Environment {
final String gatewayName;
final GatewayEnvironment gatewayEnvironment;
Expand Down Expand Up @@ -46,7 +59,8 @@ class Environment {
}
@override
String toString() => 'Environment(gatewayName: $gatewayName, gatewayEnvironment: $gatewayEnvironment, envIndex: $envIndex)';
String toString() =>
'Environment(gatewayName: $gatewayName, gatewayEnvironment: $gatewayEnvironment, envIndex: $envIndex)';
}
class Gateway {
Expand Down Expand Up @@ -207,20 +221,29 @@ class Gateway {
return ScgatewayFlutterPlugin.launchSmallplug(smallplugData);
}
static Future<String> openSmallplugWithBranding(String smallplugEndpoint, String params, String headerColor, double headerColorOpacity, String backIconColor, double backIconOpacity) async {
static Future<String> openSmallplugWithBranding(
String smallplugEndpoint,
String params,
String headerColor,
double headerColorOpacity,
String backIconColor,
double backIconOpacity) async {
SmallplugData smallplugData = new SmallplugData();
SmallplugUiConfig smallplugUiConfig = new SmallplugUiConfig();
final hc = headerColor == null ? null : ColorExt.fromHex(headerColor);
final bc = headerColor == null ? null : ColorExt.fromHex(backIconColor);
debugPrint("hc: $hc");
SmallplugUiConfig smallplugUiConfig = new SmallplugUiConfig(
headerColor: hc,
backIconColor: bc,
headerOpacity: headerColorOpacity,
backIconOpacity: backIconOpacity);
if (smallplugEndpoint != null && smallplugEndpoint.isNotEmpty) {
smallplugData.targetEndpoint = smallplugEndpoint;
}
smallplugUiConfig.headerColor = headerColor;
smallplugUiConfig.headerColorOpacity = headerColorOpacity;
smallplugUiConfig.backIconColor = backIconColor;
smallplugUiConfig.backIconOpacity = backIconOpacity;
return ScgatewayFlutterPlugin.launchSmallplugWithBranding(smallplugData, smallplugUiConfig);
return ScgatewayFlutterPlugin.launchSmallplugWithBranding(smallplugData,
smallplugUiConfig: smallplugUiConfig);
}
static Future<String> showOrders() async {
Expand Down
4 changes: 2 additions & 2 deletions example/lib/screens/smt_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ class _SmtScreenState extends State<SmtScreen> {
child: TextFormField(
onChanged: (value) => {
this.setState(() {
_headerOpacity = value as double;
_headerOpacity = double.tryParse(value);
})
},
decoration: const InputDecoration(
Expand Down Expand Up @@ -321,7 +321,7 @@ class _SmtScreenState extends State<SmtScreen> {
child: TextFormField(
onChanged: (value) => {
this.setState(() {
_backIconOpacity = value as double;
_backIconOpacity = double.tryParse(value);
})
},
decoration: const InputDecoration(
Expand Down
35 changes: 14 additions & 21 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ packages:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.2"
version: "1.7.1"
args:
dependency: transitive
description:
Expand All @@ -28,7 +28,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.2"
version: "2.6.1"
boolean_selector:
dependency: transitive
description:
Expand Down Expand Up @@ -98,14 +98,14 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.1.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
version: "1.2.0"
checked_yaml:
dependency: transitive
description:
Expand Down Expand Up @@ -161,7 +161,7 @@ packages:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.16.0"
version: "1.15.0"
convert:
dependency: transitive
description:
Expand Down Expand Up @@ -196,7 +196,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.2.0"
file:
dependency: transitive
description:
Expand Down Expand Up @@ -304,21 +304,14 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
version: "0.12.10"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.3.0"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -346,7 +339,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.8.0"
pedantic:
dependency: transitive
description:
Expand Down Expand Up @@ -388,7 +381,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.2.0-alpha01"
version: "1.3.0"
shelf:
dependency: transitive
description:
Expand Down Expand Up @@ -421,7 +414,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
version: "1.8.1"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -463,7 +456,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.9"
version: "0.3.0"
timing:
dependency: transitive
description:
Expand All @@ -484,7 +477,7 @@ packages:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
version: "2.1.0"
watcher:
dependency: transitive
description:
Expand All @@ -507,5 +500,5 @@ packages:
source: hosted
version: "3.1.0"
sdks:
dart: ">=2.17.0-0 <3.0.0"
dart: ">=2.12.0 <3.0.0"
flutter: ">=1.16.0"
24 changes: 1 addition & 23 deletions lib/scgateway_flutter_plugin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class ScgatewayFlutterPlugin {

static const MethodChannel _channel = const MethodChannel('scgateway_flutter_plugin');

static const String _flutterPluginVersion = "1.2.0";
static const String _flutterPluginVersion = "1.3.0";

static Future<String?> getSdkVersion() async {

Expand Down Expand Up @@ -312,28 +312,6 @@ class ScgatewayFlutterPlugin {
return smallplugResponse;
}

// static Future<String?> launchSmallplugWithBranding(SmallplugData smallplugData, SmallplugUiConfig smallplugUiConfig) async {
//
// String? smallplugResponse;
//
// try {
// smallplugResponse = await _channel.invokeMethod("launchSmallplugWithBranding", <String, dynamic>{
// "targetEndpoint": smallplugData.targetEndpoint,
// "params": smallplugData.params,
// "headerColor": smallplugUiConfig.headerColor,
// "headerOpacity": smallplugUiConfig.headerOpacity,
// "backIconColor": smallplugUiConfig.backIconColor,
// "backIconOpacity": smallplugUiConfig.backIconOpacity
// });
// } on PlatformException catch (e) {
// smallplugResponse = e.code;
// }
//
// print("Smallplug response: $smallplugResponse");
//
// return smallplugResponse;
// }

static Future<String?> showOrders() async {

String? showOrdersResponse;
Expand Down
38 changes: 19 additions & 19 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.2"
version: "2.6.1"
boolean_selector:
dependency: transitive
description:
Expand All @@ -21,14 +21,14 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.1.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
version: "1.2.0"
clock:
dependency: transitive
description:
Expand All @@ -42,14 +42,14 @@ packages:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.16.0"
version: "1.15.0"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.2.0"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -66,28 +66,21 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
version: "0.12.10"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.3.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.8.0"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -99,7 +92,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
version: "1.8.1"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -134,13 +127,20 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.9"
version: "0.3.0"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
version: "2.1.0"
sdks:
dart: ">=2.17.0-0 <3.0.0"
dart: ">=2.12.0 <3.0.0"

0 comments on commit 002e594

Please sign in to comment.