Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
fluttertpc_get
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
=William Cunha Cardoso
2020-07-18 10:38:25 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8c88413d6c16bf8446f34b7e247dc5067c32a6cd
8c88413d
1 parent
888b4665
create test files + update test on double
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
14 deletions
lib/src/extensions/context_extensions.dart
test/src/extensions/context_extensions_test.dart
test/src/extensions/double_extensions_test.dart
test/src/extensions/dynamic_extensions_test.dart
test/src/extensions/num_extensions_test.dart
test/src/extensions/widget_extensions_test.dart
lib/src/extensions/context_extensions.dart
View file @
8c88413
...
...
@@ -26,45 +26,45 @@ extension MDQ on BuildContext {
widthTransformer
(
dividedBy:
dividedBy
,
reducedBy:
reducedByW
);
}
/// similar to
MediaQuery.of(this).padding
/// similar to
`MediaQuery.of(this).padding`.
EdgeInsets
get
mediaQueryPadding
=>
MediaQuery
.
of
(
this
).
padding
;
/// similar to
MediaQuery.of(this).viewPadding
/// similar to
`MediaQuery.of(this).viewPadding`.
EdgeInsets
get
mediaQueryViewPadding
=>
MediaQuery
.
of
(
this
).
viewPadding
;
/// similar to
MediaQuery.of(this).viewInsets;
/// similar to
`MediaQuery.of(this).viewInsets`.
EdgeInsets
get
mediaQueryViewInsets
=>
MediaQuery
.
of
(
this
).
viewInsets
;
/// similar to
MediaQuery.of(this).orientation;
/// similar to
`MediaQuery.of(this).orientation`.
Orientation
get
orientation
=>
MediaQuery
.
of
(
this
).
orientation
;
/// check if device is on
landscape mode
/// check if device is on
LANDSCAPE mode.
bool
get
isLandscape
=>
orientation
==
Orientation
.
landscape
;
/// check if device is on
portrait mode
/// check if device is on
PORTRAIT mode.
bool
get
isPortrait
=>
orientation
==
Orientation
.
portrait
;
/// similar to
MediaQuery.of(this).devicePixelRatio;
/// similar to
`MediaQuery.of(this).devicePixelRatio`.
double
get
devicePixelRatio
=>
MediaQuery
.
of
(
this
).
devicePixelRatio
;
/// similar to
MediaQuery.of(this).textScaleFactor;
/// similar to
`MediaQuery.of(this).textScaleFactor`.
double
get
textScaleFactor
=>
MediaQuery
.
of
(
this
).
textScaleFactor
;
/// get the
shortestSide from screen
/// get the
`shortestSide` from screen.
double
get
mediaQueryShortestSide
=>
mediaQuerySize
.
shortestSide
;
/// True if
width be larger than 800
/// True if
`width` is larger than 800p.
bool
get
showNavbar
=>
(
width
>
800
);
/// True if the
shortestSide is smaller than 600p
/// True if the
`shortestSide` is smaller than 600p.
bool
get
isPhone
=>
(
mediaQueryShortestSide
<
600
);
/// True if the
shortestSide is largest than 600p
/// True if the
`shortestSide` is largest than 600p.
bool
get
isSmallTablet
=>
(
mediaQueryShortestSide
>=
600
);
/// True if the
shortestSide is largest than 720p
/// True if the
`shortestSide` is largest than 720p.
bool
get
isLargeTablet
=>
(
mediaQueryShortestSide
>=
720
);
/// True if the current device is T
ablet
/// True if the current device is T
ABLET.
bool
get
isTablet
=>
isSmallTablet
||
isLargeTablet
;
}
...
...
test/src/extensions/context_extensions_test.dart
0 → 100644
View file @
8c88413
test/src/extensions/double_extensions_test.dart
0 → 100644
View file @
8c88413
import
'package:flutter_test/flutter_test.dart'
;
import
'package:get/utils.dart'
;
void
main
(
)
{
test
(
'Test for toPrecision on Double'
,
()
{
double
testVar
=
5.4545454
;
expect
(
testVar
.
toPrecision
(
2
),
equals
(
5.45
));
});
}
...
...
test/src/extensions/dynamic_extensions_test.dart
0 → 100644
View file @
8c88413
test/src/extensions/num_extensions_test.dart
0 → 100644
View file @
8c88413
test/src/extensions/widget_extensions_test.dart
0 → 100644
View file @
8c88413
Please
register
or
login
to post a comment