Showing
1 changed file
with
9 additions
and
3 deletions
@@ -130,12 +130,18 @@ extension ContextExtensionss on BuildContext { | @@ -130,12 +130,18 @@ extension ContextExtensionss on BuildContext { | ||
130 | deviceWidth = mediaQuerySize.width; | 130 | deviceWidth = mediaQuerySize.width; |
131 | } | 131 | } |
132 | //big screen width can display smaller sizes | 132 | //big screen width can display smaller sizes |
133 | - final values = [ | 133 | + final strictValues = [ |
134 | if (deviceWidth >= 1200) desktop, //desktop is allowed | 134 | if (deviceWidth >= 1200) desktop, //desktop is allowed |
135 | if (deviceWidth >= 600) tablet, //tablet is allowed | 135 | if (deviceWidth >= 600) tablet, //tablet is allowed |
136 | if (deviceWidth >= 300) mobile, //mobile is allowed | 136 | if (deviceWidth >= 300) mobile, //mobile is allowed |
137 | watch, //watch is allowed | 137 | watch, //watch is allowed |
138 | - ]; | ||
139 | - return values.whereType<T>().first; | 138 | + ].whereType<T>(); |
139 | + final looseValues = [ | ||
140 | + watch, | ||
141 | + mobile, | ||
142 | + tablet, | ||
143 | + desktop, | ||
144 | + ].whereType<T>(); | ||
145 | + return strictValues.firstOrNull ?? looseValues.first; | ||
140 | } | 146 | } |
141 | } | 147 | } |
-
Please register or login to post a comment