Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
flutter_mdd_simulator
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
open_share
flutter_mdd_simulator
Commits
58351685
Commit
58351685
authored
Dec 09, 2021
by
MDDmac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update simulator prepaid_lib_flutter
parent
b622eaab
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
122 additions
and
255 deletions
+122
-255
Debug.xcconfig
ios/Flutter/Debug.xcconfig
+1
-0
Release.xcconfig
ios/Flutter/Release.xcconfig
+1
-0
Podfile
ios/Podfile
+41
-0
PreferencesHelper.dart
lib/PreferencesHelper.dart
+0
-35
main.dart
lib/main.dart
+67
-66
pubspec.lock
pubspec.lock
+7
-152
pubspec.yaml
pubspec.yaml
+5
-2
No files found.
ios/Flutter/Debug.xcconfig
View file @
58351685
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
ios/Flutter/Release.xcconfig
View file @
58351685
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
ios/Podfile
0 → 100644
View file @
58351685
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV
[
'COCOAPODS_DISABLE_STATS'
]
=
'true'
project
'Runner'
,
{
'Debug'
=>
:debug
,
'Profile'
=>
:release
,
'Release'
=>
:release
,
}
def
flutter_root
generated_xcode_build_settings_path
=
File
.
expand_path
(
File
.
join
(
'..'
,
'Flutter'
,
'Generated.xcconfig'
),
__FILE__
)
unless
File
.
exist?
(
generated_xcode_build_settings_path
)
raise
"
#{
generated_xcode_build_settings_path
}
must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File
.
foreach
(
generated_xcode_build_settings_path
)
do
|
line
|
matches
=
line
.
match
(
/FLUTTER_ROOT\=(.*)/
)
return
matches
[
1
].
strip
if
matches
end
raise
"FLUTTER_ROOT not found in
#{
generated_xcode_build_settings_path
}
. Try deleting Generated.xcconfig, then run flutter pub get"
end
require
File
.
expand_path
(
File
.
join
(
'packages'
,
'flutter_tools'
,
'bin'
,
'podhelper'
),
flutter_root
)
flutter_ios_podfile_setup
target
'Runner'
do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods
File
.
dirname
(
File
.
realpath
(
__FILE__
))
end
post_install
do
|
installer
|
installer
.
pods_project
.
targets
.
each
do
|
target
|
flutter_additional_ios_build_settings
(
target
)
end
end
lib/PreferencesHelper.dart
deleted
100644 → 0
View file @
b622eaab
import
'package:shared_preferences/shared_preferences.dart'
;
class
PreferencesHelper
{
static
Future
<
SharedPreferences
>
get
_instance
async
=>
_prefsInstance
??=
await
SharedPreferences
.
getInstance
();
static
SharedPreferences
_prefsInstance
;
static
void
init
()
async
{
_prefsInstance
=
await
_instance
;
}
static
String
getString
(
String
key
,
[
String
defValue
])
{
return
_prefsInstance
.
getString
(
key
)
??
defValue
??
"0"
;
}
static
void
setString
(
String
key
,
String
value
)
async
{
_prefsInstance
.
setString
(
key
,
value
);
}
static
int
getInt
(
String
key
,
[
String
defValue
])
{
return
_prefsInstance
.
getInt
(
key
)
??
defValue
??
0
;
}
static
void
setInt
(
String
key
,
int
value
)
async
{
_prefsInstance
.
setInt
(
key
,
value
);
}
static
bool
getBool
(
String
key
,
[
var
defValue
])
{
return
_prefsInstance
.
getBool
(
key
)
??
defValue
??
false
;
}
static
void
setBool
(
String
key
,
var
value
)
async
{
_prefsInstance
.
setBool
(
key
,
value
);
}
}
\ No newline at end of file
lib/main.dart
View file @
58351685
import
'package:flutter/material.dart'
;
import
'package:flutter/painting.dart'
;
import
'package:flutter_mdd_simulator/screen/TapCard.dart'
;
import
'package:intl/intl.dart'
;
import
'package:prepaid_lib_flutter/unik_lib_flutter.dart'
;
import
'PreferencesHelper.dart'
;
import
'package:intl/intl.dart'
;
void
main
(
)
{
WidgetsFlutterBinding
.
ensureInitialized
();
PreferencesHelper
.
init
();
runApp
(
MyApp
());
}
...
...
@@ -36,47 +34,72 @@ class _MyAppState extends State<NfcScan> {
String
paidAmount
;
String
_identifier
=
'Unknown'
;
String
_bankName
;
bool
isSuccessInit
;
@override
void
initState
()
{
super
.
initState
();
String
mid
=
"1234567abc"
;
int
env
=
0
;
// 0 = dev, 1 = prod
UnikLibFlutter
.
initUnikLib
(
mid
,
env
);
//initial library
initLibrary
();
}
void
initLibrary
()
async
{
isSuccessInit
=
await
UnikLibFlutter
.
initUnikLib
(
"49df5f81d59fae23ec6f542372fc9497"
/*"1234567abc"*/
,
1
);
print
(
"isSuccessInit
$isSuccessInit
"
);
}
//function to get card info
void
getCardInfo
()
async
{
/// optional you can use List<String> varName = List<String>.filled(1, "");
List
<
String
>
cardUid
=
List
(
1
);
List
<
String
>
cardNumber
=
List
(
1
);
List
<
String
>
balance
=
List
(
1
);
List
<
String
>
bankName
=
List
(
1
);
List
<
String
>
cardAttr
=
List
(
1
);
List
<
String
>
cardInfo
=
List
(
1
);
bool
isSuccess
=
await
UnikLibFlutter
.
getCardInfo
(
cardUid
,
cardNumber
,
balance
,
bankName
,
cardAttr
,
cardInfo
);
cardUid
,
cardNumber
,
balance
,
bankName
,
startPooling:
true
,
callbackTimeout:
(
bool
isTimeout
)
=>
print
(
"timeout
$isTimeout
"
),
errorNfc:
(
bool
nfcIsNotDetected
)
=>
print
(
"--> errorNfc
$nfcIsNotDetected
"
));
print
(
"isSuccess
$isSuccess
, cardNumber
${cardNumber[0]}
, balance
${balance[0]}
, bankName
${bankName[0]}
"
);
_setStateCard
(
isSuccess
,
cardNumber
[
0
],
balance
[
0
],
bankName
[
0
]);
}
//function to update balance
void
updateBalance
()
async
{
List
<
String
>
status
=
List
(
1
);
List
<
String
>
cardNumber
=
List
(
1
);
List
<
String
>
balance
=
List
(
1
);
List
<
String
>
bankName
=
List
(
1
);
List
<
String
>
status
=
[
null
];
List
<
String
>
cardNumber
=
[
null
];
List
<
String
>
balance
=
[
null
];
List
<
String
>
bankName
=
[
null
];
List
<
String
>
beforeBalance
=
[
null
];
if
(
isSuccessInit
)
{
bool
isSuccess
=
await
UnikLibFlutter
.
updateBalance
(
status
,
cardNumber
,
balance
,
bankName
);
status
,
cardNumber
,
balance
,
bankName
,
beforeBalance
,
"085735442829"
,
"developer@mdd.co.id"
,
callbackState:
(
String
stateOperation
)
=>
(
stateOperation
==
UnikLibFlutter
.
WAITING_STATUS
)
?
print
(
"state operation WAITING"
)
:
print
(
"state operation DONE"
),
callbackTimeout:
(
bool
isTimeout
)
=>
print
(
"timeout
$isTimeout
"
),
errorNfc:
(
bool
value
)
=>
print
(
"error nfc
$value
"
));
print
(
"isSuccess
$isSuccess
"
);
print
(
"status update
${status[0]}
"
);
this
.
setState
(()
{
_status
=
status
[
0
];
});
_setStateCard
(
isSuccess
,
cardNumber
[
0
],
balance
[
0
],
bankName
[
0
]);
}
}
//function to change UI card and balance information
void
_setStateCard
(
bool
isSuccess
,
String
cardNumber
,
String
balance
,
String
bankName
)
{
void
_setStateCard
(
bool
isSuccess
,
String
cardNumber
,
String
balance
,
String
bankName
)
{
if
(
isSuccess
)
{
this
.
setState
(()
{
_cardNumber
=
cardNumber
??
"0000000000000000"
;
...
...
@@ -110,10 +133,7 @@ class _MyAppState extends State<NfcScan> {
context:
context
,
builder:
(
builder
)
{
return
new
Container
(
height:
MediaQuery
.
of
(
context
)
.
size
.
height
*
height
,
height:
MediaQuery
.
of
(
context
).
size
.
height
*
height
,
color:
Colors
.
transparent
,
//could change this to Color(0xFF737373),
//so you don't have to change MaterialApp canvasColor
...
...
@@ -127,23 +147,14 @@ class _MyAppState extends State<NfcScan> {
return
Scaffold
(
body:
Container
(
height:
MediaQuery
.
of
(
context
)
.
size
.
height
,
width:
MediaQuery
.
of
(
context
)
.
size
.
width
,
height:
MediaQuery
.
of
(
context
).
size
.
height
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
[
Container
(
width:
MediaQuery
.
of
(
context
)
.
size
.
width
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
height:
200
,
decoration:
BoxDecoration
(
image:
DecorationImage
(
...
...
@@ -186,10 +197,11 @@ class _MyAppState extends State<NfcScan> {
Text
(
_cardNumber
.
replaceAllMapped
(
RegExp
(
r".{4}"
),
(
match
)
=>
"
${match.group(
0)}
"
),
(
match
)
=>
"
${match.group(0)}
"
),
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
18
)),
color:
Colors
.
white
,
fontSize:
18
)
??
"0000000000000000"
),
SizedBox
(
height:
17
,
),
...
...
@@ -203,7 +215,7 @@ class _MyAppState extends State<NfcScan> {
Text
(
NumberFormat
.
simpleCurrency
(
locale:
'id_ID'
)
.
format
(
int
.
parse
(
_balance
)),
.
format
(
int
.
parse
(
_balance
)
??
"0"
),
style:
TextStyle
(
color:
Colors
.
white
)),
],
))
...
...
@@ -229,16 +241,21 @@ class _MyAppState extends State<NfcScan> {
),
Align
(
alignment:
Alignment
.
center
,
child:
_isLoading
?
CircularProgressIndicator
()
:
Text
(
_status
),
child:
_isLoading
?
CircularProgressIndicator
()
:
Text
(
_status
??
"Unknown"
),
)
],
),
)),
floatingActionButton:
FloatingActionButton
(
onPressed:
()
{
if
(
isSuccessInit
)
{
getCardInfo
();
_showBottomSheet
(
TapCard
(),
0.50
);
}
else
{
print
(
"Init Failed"
);
}
},
child:
const
Icon
(
Icons
.
cached
),
backgroundColor:
Colors
.
blue
,
...
...
@@ -246,20 +263,4 @@ class _MyAppState extends State<NfcScan> {
);
}
Future
<
void
>
initPlatformState
()
async
{
// String identifier;
// try {
// identifier = await UniqueIdentifier.serial;
// } on PlatformException {
// identifier = 'Failed to get Unique Identifier';
// }
//
// if (!mounted) return;
//
// setState(() {
// _identifier = identifier;
// });
//
// print("Unique $_identifier");
}
}
pubspec.lock
View file @
58351685
...
...
@@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.
5.0
"
version: "2.
8.1
"
boolean_selector:
dependency: transitive
description:
...
...
@@ -28,7 +28,7 @@ packages:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.
2.0
"
version: "1.
3.1
"
clock:
dependency: transitive
description:
...
...
@@ -64,20 +64,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
ffi:
dependency: transitive
description:
name: ffi
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
file:
dependency: transitive
description:
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.1"
flutter:
dependency: "direct main"
description: flutter
...
...
@@ -102,25 +88,6 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
http:
dependency: transitive
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.3"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
intl:
dependency: "direct main"
description:
...
...
@@ -128,13 +95,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.16.1"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3"
json_annotation:
dependency: transitive
description:
...
...
@@ -155,7 +115,7 @@ packages:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.
3
.0"
version: "1.
7
.0"
ndef:
dependency: transitive
description:
...
...
@@ -170,104 +130,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1+2"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.5"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.0"
platform:
dependency: transitive
description:
name: platform
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
prepaid_lib_flutter:
dependency: "direct main"
description:
name: prepaid_lib_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.7"
process:
dependency: transitive
description:
name: process
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.1"
shared_preferences:
dependency: "direct main"
description:
name: shared_preferences
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.12+4"
shared_preferences_linux:
dependency: transitive
description:
name: shared_preferences_linux
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.2+4"
shared_preferences_macos:
dependency: transitive
description:
name: shared_preferences_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1+11"
shared_preferences_platform_interface:
dependency: transitive
description:
name: shared_preferences_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
shared_preferences_web:
dependency: transitive
description:
name: shared_preferences_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2+7"
shared_preferences_windows:
dependency: transitive
description:
name: shared_preferences_windows
url: "https://pub.dartlang.org"
url: "http://202.158.132.228:4000"
source: hosted
version: "0.0.
2+3
"
version: "0.0.
6
"
sky_engine:
dependency: transitive
description: flutter
...
...
@@ -279,7 +148,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.
0
"
version: "1.8.
1
"
stack_trace:
dependency: transitive
description:
...
...
@@ -314,7 +183,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.
2.19
"
version: "0.
4.2
"
typed_data:
dependency: transitive
description:
...
...
@@ -336,20 +205,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
win32:
dependency: transitive
description:
name: win32
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
xdg_directories:
dependency: transitive
description:
name: xdg_directories
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
sdks:
dart: ">=2.12.0 <3.0.0"
flutter: ">=1.20.0"
pubspec.yaml
View file @
58351685
...
...
@@ -28,11 +28,14 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons
:
^1.0.2
shared_preferences
:
^0.5.12+4
flutter_nfc_kit
:
^2.2.1
flutter_gifimage
:
^1.0.1
intl
:
^0.16.1
prepaid_lib_flutter
:
^0.0.7
prepaid_lib_flutter
:
hosted
:
name
:
prepaid_lib_flutter
url
:
http://202.158.132.228:4000
version
:
0.0.6
dev_dependencies
:
flutter_test
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment