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
Committed by
Nipodemos
2020-07-18 21:22:45 -0300
Commit
b6fa36aaa04221035b67cf54e5503890aaafa3af
b6fa36aa
1 parent
85eca983
create test files + update test on double
Hide 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 @
b6fa36a
...
...
@@ -51,45 +51,45 @@ extension MDQ on BuildContext {
widthTransformer
(
dividedBy:
dividedBy
,
reducedBy:
reducedByW
);
}
/// similar to
[MediaQuery.of(context).padding]
/// similar to
`MediaQuery.of(this).padding`.
EdgeInsets
get
mediaQueryPadding
=>
MediaQuery
.
of
(
this
).
padding
;
/// similar to
[MediaQuery.of(context).viewPadding]
/// similar to
`MediaQuery.of(this).viewPadding`.
EdgeInsets
get
mediaQueryViewPadding
=>
MediaQuery
.
of
(
this
).
viewPadding
;
/// similar to
[MediaQuery.of(context).viewInsets]
/// similar to
`MediaQuery.of(this).viewInsets`.
EdgeInsets
get
mediaQueryViewInsets
=>
MediaQuery
.
of
(
this
).
viewInsets
;
/// similar to
[MediaQuery.of(context).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 @
b6fa36a
test/src/extensions/double_extensions_test.dart
0 → 100644
View file @
b6fa36a
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 @
b6fa36a
test/src/extensions/num_extensions_test.dart
0 → 100644
View file @
b6fa36a
test/src/extensions/widget_extensions_test.dart
0 → 100644
View file @
b6fa36a
Please
register
or
login
to post a comment