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
Ahmed Fwela
2021-10-23 13:21:00 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b440811eecfdd688e94fa8249fc40ec32ee400ef
b440811e
1 parent
30f2a435
fix responsive
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
13 deletions
lib/get_utils/src/extensions/context_extensions.dart
lib/get_utils/src/extensions/context_extensions.dart
View file @
b440811
import
'package:collection/collection.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:collection/collection.dart'
;
import
'../platform/platform.dart'
;
extension
ContextExtensionss
on
BuildContext
{
/// The same of [MediaQuery.of(context).size]
...
...
@@ -101,17 +100,17 @@ extension ContextExtensionss on BuildContext {
/// True if width be larger than 800
bool
get
showNavbar
=>
(
width
>
800
);
/// True if the shortestSide is smaller than 600p
bool
get
isPhone
=>
(
mediaQueryShortestSide
<
600
);
/// True if the width is smaller than 600p
bool
get
isPhone
=>
(
width
<
600
);
/// True if the shortestSide is largest than 600p
bool
get
isSmallTablet
=>
(
mediaQueryShortestSide
>=
600
);
/// True if the width is largest than 600p
bool
get
isSmallTablet
=>
(
width
>=
600
);
/// True if the shortestSide is largest than 720p
bool
get
isLargeTablet
=>
(
mediaQueryShortestSide
>=
720
);
/// True if the width is largest than 720p
bool
get
isLargeTablet
=>
(
width
>=
720
);
/// True if the current device is Tablet
bool
get
isTablet
=>
isSmallTablet
||
isLargeTablet
;
bool
get
isTablet
=>
isSmallTablet
;
/// Returns a specific value according to the screen size
/// if the device width is higher than or equal to 1200 return
...
...
@@ -125,10 +124,10 @@ extension ContextExtensionss on BuildContext {
T
?
tablet
,
T
?
desktop
,
})
{
var
deviceWidth
=
mediaQuerySize
.
shortestSide
;
if
(
GetPlatform
.
isDesktop
)
{
deviceWidth
=
mediaQuerySize
.
width
;
}
assert
(
watch
!=
null
||
mobile
!=
null
||
tablet
!=
null
||
desktop
!=
null
);
var
deviceWidth
=
mediaQuerySize
.
width
;
//big screen width can display smaller sizes
final
strictValues
=
[
if
(
deviceWidth
>=
1200
)
desktop
,
//desktop is allowed
...
...
Please
register
or
login
to post a comment