Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
mobile_scanner
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Navaron Bracke
2023-10-23 23:04:40 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
680c4f066174d0d78f28b74cb103b0581fdec601
680c4f06
1 parent
ffd0c02c
remove unused helpers from barcode utility
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
174 deletions
lib/src/barcode_utility.dart
lib/src/barcode_utility.dart
View file @
680c4f0
import
'dart:math'
as
math
;
import
'package:flutter/material.dart'
;
import
'package:mobile_scanner/mobile_scanner.dart'
;
...
...
@@ -55,175 +53,3 @@ BarcodeFormat toFormat(int value) {
return
BarcodeFormat
.
unknown
;
}
}
CalendarEvent
?
toCalendarEvent
(
Map
?
data
)
{
if
(
data
!=
null
)
{
return
CalendarEvent
.
fromNative
(
data
);
}
else
{
return
null
;
}
}
DateTime
?
toDateTime
(
Map
<
String
,
dynamic
>?
data
)
{
if
(
data
!=
null
)
{
final
year
=
data
[
'year'
]
as
int
;
final
month
=
data
[
'month'
]
as
int
;
final
day
=
data
[
'day'
]
as
int
;
final
hour
=
data
[
'hours'
]
as
int
;
final
minute
=
data
[
'minutes'
]
as
int
;
final
second
=
data
[
'seconds'
]
as
int
;
return
data
[
'isUtc'
]
as
bool
?
DateTime
.
utc
(
year
,
month
,
day
,
hour
,
minute
,
second
)
:
DateTime
(
year
,
month
,
day
,
hour
,
minute
,
second
);
}
else
{
return
null
;
}
}
ContactInfo
?
toContactInfo
(
Map
?
data
)
{
if
(
data
!=
null
)
{
return
ContactInfo
.
fromNative
(
data
);
}
else
{
return
null
;
}
}
PersonName
?
toName
(
Map
?
data
)
{
if
(
data
!=
null
)
{
return
PersonName
.
fromNative
(
data
);
}
else
{
return
null
;
}
}
DriverLicense
?
toDriverLicense
(
Map
?
data
)
{
if
(
data
!=
null
)
{
return
DriverLicense
.
fromNative
(
data
);
}
else
{
return
null
;
}
}
Email
?
toEmail
(
Map
?
data
)
{
if
(
data
!=
null
)
{
return
Email
.
fromNative
(
data
);
}
else
{
return
null
;
}
}
GeoPoint
?
toGeoPoint
(
Map
?
data
)
{
if
(
data
!=
null
)
{
return
GeoPoint
.
fromNative
(
data
);
}
else
{
return
null
;
}
}
Phone
?
toPhone
(
Map
?
data
)
{
if
(
data
!=
null
)
{
return
Phone
.
fromNative
(
data
);
}
else
{
return
null
;
}
}
SMS
?
toSMS
(
Map
?
data
)
{
if
(
data
!=
null
)
{
return
SMS
.
fromNative
(
data
);
}
else
{
return
null
;
}
}
UrlBookmark
?
toUrl
(
Map
?
data
)
{
if
(
data
!=
null
)
{
return
UrlBookmark
.
fromNative
(
data
);
}
else
{
return
null
;
}
}
WiFi
?
toWiFi
(
Map
?
data
)
{
if
(
data
!=
null
)
{
return
WiFi
.
fromNative
(
data
);
}
else
{
return
null
;
}
}
Size
applyBoxFit
(
BoxFit
fit
,
Size
input
,
Size
output
)
{
if
(
input
.
height
<=
0.0
||
input
.
width
<=
0.0
||
output
.
height
<=
0.0
||
output
.
width
<=
0.0
)
{
return
Size
.
zero
;
}
Size
destination
;
final
inputAspectRatio
=
input
.
width
/
input
.
height
;
final
outputAspectRatio
=
output
.
width
/
output
.
height
;
switch
(
fit
)
{
case
BoxFit
.
fill
:
destination
=
output
;
break
;
case
BoxFit
.
contain
:
if
(
outputAspectRatio
>
inputAspectRatio
)
{
destination
=
Size
(
input
.
width
*
output
.
height
/
input
.
height
,
output
.
height
,
);
}
else
{
destination
=
Size
(
output
.
width
,
input
.
height
*
output
.
width
/
input
.
width
,
);
}
break
;
case
BoxFit
.
cover
:
if
(
outputAspectRatio
>
inputAspectRatio
)
{
destination
=
Size
(
output
.
width
,
input
.
height
*
(
output
.
width
/
input
.
width
),
);
}
else
{
destination
=
Size
(
input
.
width
*
(
output
.
height
/
input
.
height
),
output
.
height
,
);
}
break
;
case
BoxFit
.
fitWidth
:
destination
=
Size
(
output
.
width
,
input
.
height
*
(
output
.
width
/
input
.
width
),
);
break
;
case
BoxFit
.
fitHeight
:
destination
=
Size
(
input
.
width
*
(
output
.
height
/
input
.
height
),
output
.
height
,
);
break
;
case
BoxFit
.
none
:
destination
=
Size
(
math
.
min
(
input
.
width
,
output
.
width
),
math
.
min
(
input
.
height
,
output
.
height
),
);
break
;
case
BoxFit
.
scaleDown
:
destination
=
input
;
if
(
destination
.
height
>
output
.
height
)
{
destination
=
Size
(
output
.
height
*
inputAspectRatio
,
output
.
height
);
}
if
(
destination
.
width
>
output
.
width
)
{
destination
=
Size
(
output
.
width
,
output
.
width
/
inputAspectRatio
);
}
break
;
}
return
destination
;
}
...
...
Please
register
or
login
to post a comment