Skip to content

Commit 02efed1

Browse files
committed
Remove ResponsiveWrapper References
1 parent 9b08033 commit 02efed1

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

lib/responsive_breakpoints.dart

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,7 @@ class ResponsiveBreakpointsState extends State<ResponsiveBreakpoints>
159159
bool get isLandscapePlatform =>
160160
(widget.landscapePlatforms ?? _landscapePlatforms).contains(platform);
161161

162-
bool get isLandscape =>
163-
orientation == Orientation.landscape && isLandscapePlatform;
162+
bool get isLandscape => true;
164163

165164
bool get useShortestSide => widget.useShortestSide;
166165

@@ -253,7 +252,7 @@ class ResponsiveBreakpointsState extends State<ResponsiveBreakpoints>
253252
@override
254253
void didUpdateWidget(ResponsiveBreakpoints oldWidget) {
255254
super.didUpdateWidget(oldWidget);
256-
// When [ResponsiveWrapper]'s constructor is
255+
// When [ResponsiveBreakpoints]'s constructor is
257256
// used directly in the widget tree and a parent
258257
// MediaQueryData changes, update state.
259258
// The screen dimensions are passed immediately.
@@ -268,7 +267,7 @@ class ResponsiveBreakpointsState extends State<ResponsiveBreakpoints>
268267
setPlatform();
269268

270269
return InheritedResponsiveBreakpoints(
271-
data: ResponsiveBreakpointsData.fromResponsiveWrapper(this),
270+
data: ResponsiveBreakpointsData.fromWidgetState(this),
272271
child: widget.child,
273272
);
274273
}
@@ -298,7 +297,7 @@ class ResponsiveBreakpointsData {
298297

299298
/// Creates responsive data with explicit values.
300299
///
301-
/// Alternatively, use [ResponsiveBreakpointsData.fromResponsiveWrapper]
300+
/// Alternatively, use [ResponsiveBreakpointsData.fromWidgetState]
302301
/// to create data based on the [ResponsiveBreakpoints] state.
303302
const ResponsiveBreakpointsData({
304303
this.screenWidth = 0,
@@ -313,7 +312,7 @@ class ResponsiveBreakpointsData {
313312
});
314313

315314
/// Creates data based on the [ResponsiveBreakpoints] state.
316-
static ResponsiveBreakpointsData fromResponsiveWrapper(
315+
static ResponsiveBreakpointsData fromWidgetState(
317316
ResponsiveBreakpointsState state) {
318317
return ResponsiveBreakpointsData(
319318
screenWidth: state.screenWidth,
@@ -330,7 +329,7 @@ class ResponsiveBreakpointsData {
330329

331330
@override
332331
String toString() =>
333-
'ResponsiveWrapperData(breakpoint: $breakpoint, breakpoints: ${breakpoints.asMap()}, isMobile: $isMobile, isPhone: $isPhone, isTablet: $isTablet, isDesktop: $isDesktop)';
332+
'ResponsiveBreakpoints(breakpoint: $breakpoint, breakpoints: ${breakpoints.asMap()}, isMobile: $isMobile, isPhone: $isPhone, isTablet: $isTablet, isDesktop: $isDesktop)';
334333

335334
/// Returns if the active breakpoint is [name].
336335
bool equals(String name) => breakpoint.name == name;
@@ -395,10 +394,6 @@ class ResponsiveBreakpointsData {
395394
/// Creates an immutable widget that exposes [ResponsiveBreakpointsData]
396395
/// to child widgets.
397396
///
398-
/// Access values such as the [ResponsiveBreakpointsData.scaledWidth]
399-
/// property through [ResponsiveBreakpoints.of]
400-
/// `ResponsiveWrapper.of(context).scaledWidth`.
401-
///
402397
/// Querying this widget with [ResponsiveBreakpoints.of]
403398
/// creates a dependency that causes an automatic
404399
/// rebuild whenever the [ResponsiveBreakpointsData]

lib/responsive_value.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class ResponsiveValue<T> {
2525
ResponsiveValue(this.context,
2626
{required this.conditionalValues, this.defaultValue}) {
2727
// Breakpoint reference check. Verify a parent
28-
// [ResponsiveWrapper] exists if a reference is found.
28+
// [ResponsiveBreakpoint] exists if a reference is found.
2929
if (conditionalValues.firstWhereOrNull((element) => element.name != null) !=
3030
null) {
3131
try {
@@ -35,8 +35,8 @@ class ResponsiveValue<T> {
3535
ErrorSummary(
3636
'A conditional value was caught referencing a nonexistent breakpoint.'),
3737
ErrorDescription(
38-
'ResponsiveValue requires a parent ResponsiveWrapper '
39-
'to reference breakpoints. Add a ResponsiveWrapper or remove breakpoint references.')
38+
'ResponsiveValue requires a parent ResponsiveBreakpoint '
39+
'to reference breakpoints. Add a ResponsiveBreakpoint or remove breakpoint references.')
4040
]);
4141
}
4242
}
@@ -76,13 +76,13 @@ class ResponsiveValue<T> {
7676
/// Returns null if no Active Condition is found.
7777
Condition? getActiveCondition(
7878
BuildContext context, List<Condition> conditions) {
79-
ResponsiveBreakpointsData responsiveWrapperData =
79+
ResponsiveBreakpointsData responsiveBreakpointsData =
8080
ResponsiveBreakpoints.of(context);
81-
double screenWidth = responsiveWrapperData.screenWidth;
81+
double screenWidth = responsiveBreakpointsData.screenWidth;
8282

8383
for (Condition condition in conditions.reversed) {
8484
if (condition.condition == Conditional.EQUALS) {
85-
if (condition.name == responsiveWrapperData.breakpoint.name) {
85+
if (condition.name == responsiveBreakpointsData.breakpoint.name) {
8686
return condition;
8787
}
8888

@@ -100,7 +100,7 @@ class ResponsiveValue<T> {
100100

101101
if (condition.condition == Conditional.SMALLER_THAN) {
102102
if (condition.name != null) {
103-
if (responsiveWrapperData.smallerThan(condition.name!)) {
103+
if (responsiveBreakpointsData.smallerThan(condition.name!)) {
104104
return condition;
105105
}
106106
}
@@ -116,7 +116,7 @@ class ResponsiveValue<T> {
116116

117117
if (condition.condition == Conditional.LARGER_THAN) {
118118
if (condition.name != null) {
119-
if (responsiveWrapperData.largerThan(condition.name!)) {
119+
if (responsiveBreakpointsData.largerThan(condition.name!)) {
120120
return condition;
121121
}
122122
}

0 commit comments

Comments
 (0)