@@ -5,7 +5,8 @@ import 'package:flutter/widgets.dart';
55import 'package:responsive_builder2/responsive_builder2.dart' ;
66import 'package:universal_platform/universal_platform.dart' ;
77
8- import 'device_width.dart' as width;
8+ import 'device_width.dart' if (dart.library.js_interop) 'device_width_web.dart'
9+ as width;
910
1011/// Determines if the current platform is web or desktop (WASM compatible)
1112final _isWebOrDesktop = kIsWeb ||
@@ -30,15 +31,23 @@ DeviceScreenType getDeviceType(Size size,
3031 isWebOrDesktop = isWebOrDesktop ?? = _isWebOrDesktop;
3132 double deviceWidth = width.deviceWidth (size, isWebOrDesktop);
3233
33- // Replaces the defaults with the user defined definitions
34+ // Use provided breakpoint with middle (normal) threshold
3435 if (breakpoint != null ) {
35- if (deviceWidth > breakpoint.large) {
36+ // Desktop or Tablet for very large widths
37+ if (deviceWidth >= breakpoint.large) {
3638 return _desktopOrTablet (isWebOrDesktop);
3739 }
3840
41+ // Watch for very small widths
3942 if (deviceWidth < breakpoint.small) {
4043 return DeviceScreenType .watch;
4144 }
45+
46+ // Classify phone/tablet using normal
47+ if (deviceWidth < breakpoint.normal) {
48+ return DeviceScreenType .phone;
49+ }
50+ return DeviceScreenType .tablet;
4251 }
4352
4453 if (deviceWidth >= ResponsiveSizingConfig .instance.breakpoints.large) {
@@ -49,7 +58,12 @@ DeviceScreenType getDeviceType(Size size,
4958 return DeviceScreenType .watch;
5059 }
5160
52- return DeviceScreenType .phone;
61+ // Use global normal threshold
62+ final globalNormal = ResponsiveSizingConfig .instance.breakpoints.normal;
63+ if (deviceWidth < globalNormal) {
64+ return DeviceScreenType .phone;
65+ }
66+ return DeviceScreenType .tablet;
5367}
5468
5569/// Helper function to determine if a large screen should be treated as desktop
@@ -98,6 +112,9 @@ RefinedSize getRefinedSize(
98112 if (deviceWidth >= refinedBreakpoint.desktopNormal) {
99113 return RefinedSize .normal;
100114 }
115+
116+ // Below desktopNormal threshold
117+ return RefinedSize .small;
101118 }
102119
103120 if (deviceScreenType == DeviceScreenType .tablet) {
@@ -112,6 +129,9 @@ RefinedSize getRefinedSize(
112129 if (deviceWidth >= refinedBreakpoint.tabletNormal) {
113130 return RefinedSize .normal;
114131 }
132+
133+ // Below tabletNormal threshold
134+ return RefinedSize .small;
115135 }
116136
117137 if (deviceScreenType == DeviceScreenType .phone) {
@@ -126,6 +146,9 @@ RefinedSize getRefinedSize(
126146 if (deviceWidth >= refinedBreakpoint.mobileNormal) {
127147 return RefinedSize .normal;
128148 }
149+
150+ // Below mobileNormal threshold
151+ return RefinedSize .small;
129152 }
130153
131154 if (deviceScreenType == DeviceScreenType .watch) {
0 commit comments