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 17:34:10 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7056288ba9f457e5704968d91c6ff289eeae1558
7056288b
1 parent
17633002
move GeoPoint to its own file
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
14 deletions
CHANGELOG.md
lib/mobile_scanner.dart
lib/src/barcode_utility.dart
lib/src/objects/barcode.dart
lib/src/objects/geo_point.dart
CHANGELOG.md
View file @
7056288
...
...
@@ -2,6 +2,7 @@
Improvements:
*
The
`type` of an `Email`
is now non-null.
*
The
`phoneNumber` of an `SMS`
is now non-null.
*
The
`latitude` and `longitude` of a `GeoPoint`
are now non-null.
## 3.5.0
New Features:
...
...
lib/mobile_scanner.dart
View file @
7056288
...
...
@@ -17,6 +17,7 @@ export 'src/objects/barcode_capture.dart';
export
'src/objects/calendar_event.dart'
;
export
'src/objects/driver_license.dart'
;
export
'src/objects/email.dart'
;
export
'src/objects/geo_point.dart'
;
export
'src/objects/mobile_scanner_arguments.dart'
;
export
'src/objects/sms.dart'
;
export
'src/objects/wifi.dart'
;
...
...
lib/src/barcode_utility.dart
View file @
7056288
...
...
@@ -2,6 +2,7 @@ import 'dart:math' as math;
import
'package:flutter/material.dart'
;
import
'package:mobile_scanner/mobile_scanner.dart'
;
import
'package:mobile_scanner/src/objects/geo_point.dart'
;
Size
toSize
(
Map
data
)
{
final
width
=
data
[
'width'
]
as
double
;
...
...
lib/src/objects/barcode.dart
View file @
7056288
...
...
@@ -9,6 +9,7 @@ import 'package:mobile_scanner/src/enums/phone_type.dart';
import
'package:mobile_scanner/src/objects/calendar_event.dart'
;
import
'package:mobile_scanner/src/objects/driver_license.dart'
;
import
'package:mobile_scanner/src/objects/email.dart'
;
import
'package:mobile_scanner/src/objects/geo_point.dart'
;
import
'package:mobile_scanner/src/objects/sms.dart'
;
import
'package:mobile_scanner/src/objects/wifi.dart'
;
...
...
@@ -242,20 +243,6 @@ class PersonName {
pronunciation
=
data
[
'pronunciation'
]
as
String
?;
}
/// GPS coordinates from a 'GEO:' or similar QRCode type.
class
GeoPoint
{
/// Gets the latitude.
final
double
?
latitude
;
/// Gets the longitude.
final
double
?
longitude
;
/// Create a [GeoPoint] from native data.
GeoPoint
.
fromNative
(
Map
data
)
:
latitude
=
data
[
'latitude'
]
as
double
?,
longitude
=
data
[
'longitude'
]
as
double
?;
}
/// Phone number info.
class
Phone
{
/// Gets phone number.
...
...
lib/src/objects/geo_point.dart
0 → 100644
View file @
7056288
/// GPS coordinates from a `GEO:` or similar QRCode type.
class
GeoPoint
{
/// Construct a new [GeoPoint] instance.
const
GeoPoint
({
required
this
.
latitude
,
required
this
.
longitude
,
});
/// Construct a [GeoPoint] from the given [data].
///
/// If the data does not contain valid GeoPoint coordinates,
/// then `0,0` is returned.
factory
GeoPoint
.
fromNative
(
Map
<
Object
?,
Object
?>
data
)
{
final
double
?
latitude
=
data
[
'latitude'
]
as
double
?;
final
double
?
longitude
=
data
[
'longitude'
]
as
double
?;
// If either is not set, then this GeoPoint is invalid.
// Return the geographic center as fallback.
if
(
latitude
==
null
||
longitude
==
null
)
{
return
const
GeoPoint
(
latitude:
0.0
,
longitude:
0.0
);
}
return
GeoPoint
(
latitude:
latitude
,
longitude:
longitude
);
}
/// The latitude of the coordinate.
final
double
latitude
;
/// The longitude of the coordinate.
final
double
longitude
;
}
...
...
Please
register
or
login
to post a comment