Ahmed Fwela

fix responsive

  1 +import 'package:collection/collection.dart';
1 import 'package:flutter/material.dart'; 2 import 'package:flutter/material.dart';
2 import 'package:flutter/widgets.dart'; 3 import 'package:flutter/widgets.dart';
3 -import 'package:collection/collection.dart';  
4 -import '../platform/platform.dart';  
5 4
6 extension ContextExtensionss on BuildContext { 5 extension ContextExtensionss on BuildContext {
7 /// The same of [MediaQuery.of(context).size] 6 /// The same of [MediaQuery.of(context).size]
@@ -101,17 +100,17 @@ extension ContextExtensionss on BuildContext { @@ -101,17 +100,17 @@ extension ContextExtensionss on BuildContext {
101 /// True if width be larger than 800 100 /// True if width be larger than 800
102 bool get showNavbar => (width > 800); 101 bool get showNavbar => (width > 800);
103 102
104 - /// True if the shortestSide is smaller than 600p  
105 - bool get isPhone => (mediaQueryShortestSide < 600); 103 + /// True if the width is smaller than 600p
  104 + bool get isPhone => (width < 600);
106 105
107 - /// True if the shortestSide is largest than 600p  
108 - bool get isSmallTablet => (mediaQueryShortestSide >= 600); 106 + /// True if the width is largest than 600p
  107 + bool get isSmallTablet => (width >= 600);
109 108
110 - /// True if the shortestSide is largest than 720p  
111 - bool get isLargeTablet => (mediaQueryShortestSide >= 720); 109 + /// True if the width is largest than 720p
  110 + bool get isLargeTablet => (width >= 720);
112 111
113 /// True if the current device is Tablet 112 /// True if the current device is Tablet
114 - bool get isTablet => isSmallTablet || isLargeTablet; 113 + bool get isTablet => isSmallTablet;
115 114
116 /// Returns a specific value according to the screen size 115 /// Returns a specific value according to the screen size
117 /// if the device width is higher than or equal to 1200 return 116 /// if the device width is higher than or equal to 1200 return
@@ -125,10 +124,10 @@ extension ContextExtensionss on BuildContext { @@ -125,10 +124,10 @@ extension ContextExtensionss on BuildContext {
125 T? tablet, 124 T? tablet,
126 T? desktop, 125 T? desktop,
127 }) { 126 }) {
128 - var deviceWidth = mediaQuerySize.shortestSide;  
129 - if (GetPlatform.isDesktop) {  
130 - deviceWidth = mediaQuerySize.width;  
131 - } 127 + assert(
  128 + watch != null || mobile != null || tablet != null || desktop != null);
  129 +
  130 + var deviceWidth = mediaQuerySize.width;
132 //big screen width can display smaller sizes 131 //big screen width can display smaller sizes
133 final strictValues = [ 132 final strictValues = [
134 if (deviceWidth >= 1200) desktop, //desktop is allowed 133 if (deviceWidth >= 1200) desktop, //desktop is allowed