Skip to content

Commit

Permalink
Merge branch 'main' into pigeon_tile
Browse files Browse the repository at this point in the history
  • Loading branch information
yaakovschectman authored Aug 23, 2024
2 parents 8a1d3d8 + 25795a4 commit 730fb00
Show file tree
Hide file tree
Showing 174 changed files with 14,136 additions and 3,338 deletions.
2 changes: 1 addition & 1 deletion .ci/flutter_master.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e7da16df76cd239ec9ed07f0d0caf78154e63986
b8f89f70bf4e8c304fc909b58e23f2358983bb41
2 changes: 1 addition & 1 deletion .ci/flutter_stable.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
5874a72aa4c779a02553007c47dacbefba2374dc
1 change: 0 additions & 1 deletion packages/camera/camera/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,6 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
showInSnackBar('Audio access is restricted.');
default:
_showCameraException(e);
break;
}
}

Expand Down
1 change: 0 additions & 1 deletion packages/camera/camera_android/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,6 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
showInSnackBar('Unknown permission error.');
default:
_showCameraException(e);
break;
}
}

Expand Down
5 changes: 5 additions & 0 deletions packages/camera/camera_android_camerax/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.6.8+3

* Removes dependency on org.jetbrains.kotlin:kotlin-bom.
* Updates minimum supported SDK version to Flutter 3.24/Dart 3.5.

## 0.6.8+2

* Marks uses of `Camera2Interop` with `@OptIn` annotation.
Expand Down
4 changes: 0 additions & 4 deletions packages/camera/camera_android_camerax/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,4 @@ dependencies {
testImplementation 'org.mockito:mockito-inline:5.0.0'
testImplementation 'androidx.test:core:1.4.0'
testImplementation 'org.robolectric:robolectric:4.10.3'

// org.jetbrains.kotlin:kotlin-bom artifact purpose is to align kotlin stdlib and related code versions.
// See: https://youtrack.jetbrains.com/issue/KT-55297/kotlin-stdlib-should-declare-constraints-on-kotlin-stdlib-jdk8-and-kotlin-stdlib-jdk7
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.10"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,6 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
showInSnackBar('Audio access is restricted.');
default:
_showCameraException(e);
break;
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/camera/camera_android_camerax/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ description: Demonstrates how to use the camera_android_camerax plugin.
publish_to: 'none'

environment:
sdk: ^3.4.0
flutter: ">=3.22.0"
sdk: ^3.5.0
flutter: ">=3.24.0"

dependencies:
camera_android_camerax:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class CameraStateError extends JavaObject {
default:
description =
'There was an unspecified issue with the current camera state.';
break;
}

return '$code : $description';
Expand Down
6 changes: 3 additions & 3 deletions packages/camera/camera_android_camerax/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: camera_android_camerax
description: Android implementation of the camera plugin using the CameraX library.
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android_camerax
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
version: 0.6.8+2
version: 0.6.8+3

environment:
sdk: ^3.4.0
flutter: ">=3.22.0"
sdk: ^3.5.0
flutter: ">=3.24.0"

flutter:
plugin:
Expand Down
1 change: 0 additions & 1 deletion packages/camera/camera_avfoundation/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,6 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
showInSnackBar('Unknown permission error.');
default:
_showCameraException(e);
break;
}
}

Expand Down
5 changes: 5 additions & 0 deletions packages/file_selector/file_selector_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.5.1+7

* Removes dependency on org.jetbrains.kotlin:kotlin-bom.
* Updates minimum supported SDK version to Flutter 3.24/Dart 3.5.

## 0.5.1+6

* Bumps androidx.annotation:annotation from 1.8.1 to 1.8.2.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ android {
testImplementation 'org.mockito:mockito-inline:5.1.0'
testImplementation 'androidx.test:core:1.3.0'
testImplementation "org.robolectric:robolectric:4.12.1"

// org.jetbrains.kotlin:kotlin-bom artifact purpose is to align kotlin stdlib and related code versions.
// See: https://youtrack.jetbrains.com/issue/KT-55297/kotlin-stdlib-should-declare-constraints-on-kotlin-stdlib-jdk8-and-kotlin-stdlib-jdk7
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.10"))
}

lintOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath 'com.android.tools.build:gradle:8.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ description: Demonstrates how to use the file_selector_android plugin.
publish_to: 'none'

environment:
sdk: ^3.3.0
flutter: ">=3.19.0"
sdk: ^3.5.0
flutter: ">=3.24.0"

dependencies:
file_selector_android:
Expand Down
6 changes: 3 additions & 3 deletions packages/file_selector/file_selector_android/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: file_selector_android
description: Android implementation of the file_selector package.
repository: https://github.com/flutter/packages/tree/main/packages/file_selector/file_selector_android
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+file_selector%22
version: 0.5.1+6
version: 0.5.1+7

environment:
sdk: ^3.4.0
flutter: ">=3.22.0"
sdk: ^3.5.0
flutter: ">=3.24.0"

flutter:
plugin:
Expand Down
4 changes: 4 additions & 0 deletions packages/flutter_adaptive_scaffold/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.2.2

* Fix a bug where landscape would not show body when using `andUp`.

## 0.2.1

* Add `Breakpoint.activeBreakpointOf(context)` to find the currently active breakpoint.
Expand Down
133 changes: 64 additions & 69 deletions packages/flutter_adaptive_scaffold/lib/src/breakpoints.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Breakpoints {
/// case that no other breakpoint is active.
///
/// It is active from a width of -1 dp to infinity.
static const Breakpoint standard = Breakpoint(beginWidth: -1);
static const Breakpoint standard = Breakpoint.standard();

/// A window whose width is less than 600 dp and greater than 0 dp.
static const Breakpoint small = Breakpoint.small();
Expand Down Expand Up @@ -86,6 +86,30 @@ class Breakpoints {
/// A mobile window whose width is greater than 1600 dp.
static const Breakpoint extraLargeMobile =
Breakpoint.extraLarge(platform: Breakpoint.mobile);

/// A list of all the standard breakpoints.
static const List<Breakpoint> all = <Breakpoint>[
smallDesktop,
smallMobile,
small,
mediumDesktop,
mediumMobile,
medium,
mediumLargeDesktop,
mediumLargeMobile,
mediumLarge,
largeDesktop,
largeMobile,
large,
extraLargeDesktop,
extraLargeMobile,
extraLarge,
smallAndUp,
mediumAndUp,
mediumLargeAndUp,
largeAndUp,
standard,
];
}

/// A class to define the conditions that distinguish between types of
Expand Down Expand Up @@ -113,10 +137,19 @@ class Breakpoint {
this.endWidth,
this.beginHeight,
this.endHeight,
this.platform,
this.andUp = false,
this.platform,
});

/// Returns a [Breakpoint] that can be used as a fallthrough in the
/// case that no other breakpoint is active.
const Breakpoint.standard({this.platform})
: beginWidth = -1,
endWidth = null,
beginHeight = null,
endHeight = null,
andUp = true;

/// Returns a [Breakpoint] with the given constraints for a small screen.
const Breakpoint.small({this.andUp = false, this.platform})
: beginWidth = 0,
Expand Down Expand Up @@ -166,7 +199,7 @@ class Breakpoint {
TargetPlatform.iOS,
};

/// When set to true, it will include any size above the set width.
/// When set to true, it will include any size above the set width and set height.
final bool andUp;

/// The beginning width dp value. If left null then the [Breakpoint] will have
Expand Down Expand Up @@ -213,9 +246,9 @@ class Breakpoint {

final bool isHeightActive = isDesktop ||
orientation == Orientation.portrait ||
(orientation == Orientation.landscape &&
height >= lowerBoundHeight &&
height < upperBoundHeight);
(orientation == Orientation.landscape && andUp
? isWidthActive || height >= lowerBoundHeight
: height >= lowerBoundHeight && height < upperBoundHeight);

return isWidthActive && isHeightActive && isRightPlatform;
}
Expand All @@ -225,78 +258,40 @@ class Breakpoint {
static Breakpoint? maybeActiveBreakpointFromSlotLayout(BuildContext context) {
final SlotLayout? slotLayout =
context.findAncestorWidgetOfExactType<SlotLayout>();
Breakpoint? fallbackBreakpoint;

if (slotLayout != null) {
for (final MapEntry<Breakpoint, SlotLayoutConfig?> config
in slotLayout.config.entries) {
if (config.key.isActive(context)) {
if (config.key.platform != null) {
return config.key;
} else {
fallbackBreakpoint ??= config.key;
}
}
}
}
return fallbackBreakpoint;

return slotLayout != null
? activeBreakpointIn(context, slotLayout.config.keys.toList())
: null;
}

/// Returns the default [Breakpoint] based on the [BuildContext].
static Breakpoint defaultBreakpointOf(BuildContext context) {
final TargetPlatform host = Theme.of(context).platform;
final bool isDesktop = Breakpoint.desktop.contains(host);
final bool isMobile = Breakpoint.mobile.contains(host);

for (final Breakpoint breakpoint in <Breakpoint>[
Breakpoints.small,
Breakpoints.medium,
Breakpoints.mediumLarge,
Breakpoints.large,
Breakpoints.extraLarge,
]) {
if (breakpoint.isActive(context)) {
if (isDesktop) {
switch (breakpoint) {
case Breakpoints.small:
return Breakpoints.smallDesktop;
case Breakpoints.medium:
return Breakpoints.mediumDesktop;
case Breakpoints.mediumLarge:
return Breakpoints.mediumLargeDesktop;
case Breakpoints.large:
return Breakpoints.largeDesktop;
case Breakpoints.extraLarge:
return Breakpoints.extraLargeDesktop;
default:
return Breakpoints.standard;
}
} else if (isMobile) {
switch (breakpoint) {
case Breakpoints.small:
return Breakpoints.smallMobile;
case Breakpoints.medium:
return Breakpoints.mediumMobile;
case Breakpoints.mediumLarge:
return Breakpoints.mediumLargeMobile;
case Breakpoints.large:
return Breakpoints.largeMobile;
case Breakpoints.extraLarge:
return Breakpoints.extraLargeMobile;
default:
return Breakpoints.standard;
}
} else {
return breakpoint;
}
}
}
return Breakpoints.standard;
return activeBreakpointIn(context, Breakpoints.all) ?? Breakpoints.standard;
}

/// Returns the currently active [Breakpoint].
static Breakpoint activeBreakpointOf(BuildContext context) {
return maybeActiveBreakpointFromSlotLayout(context) ??
defaultBreakpointOf(context);
}

/// Returns the currently active [Breakpoint] based on the [BuildContext] and
/// a list of [Breakpoint]s.
static Breakpoint? activeBreakpointIn(
BuildContext context, List<Breakpoint> breakpoints) {
Breakpoint? currentBreakpoint;

for (final Breakpoint breakpoint in breakpoints) {
if (breakpoint.isActive(context)) {
if (breakpoint.platform != null) {
// Prioritize platform-specific breakpoints.
return breakpoint;
} else {
// Fallback to non-platform-specific.
currentBreakpoint = breakpoint;
}
}
}
return currentBreakpoint;
}
}
25 changes: 5 additions & 20 deletions packages/flutter_adaptive_scaffold/lib/src/slot_layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,11 @@ class SlotLayout extends StatefulWidget {
/// be chosen from the config under the context's conditions.
static SlotLayoutConfig? pickWidget(
BuildContext context, Map<Breakpoint, SlotLayoutConfig?> config) {
SlotLayoutConfig? chosenWidget;

for (final Breakpoint breakpoint in config.keys) {
if (breakpoint.isActive(context)) {
final SlotLayoutConfig? pickedWidget = config[breakpoint];
if (pickedWidget != null) {
if (breakpoint.platform != null) {
// Prioritize platform-specific breakpoints.
return pickedWidget;
} else {
// Fallback to non-platform-specific.
chosenWidget = pickedWidget;
}
} else {
chosenWidget = null;
}
}
}

return chosenWidget;
final Breakpoint? breakpoint =
Breakpoint.activeBreakpointIn(context, config.keys.toList());
return breakpoint != null && config.containsKey(breakpoint)
? config[breakpoint]
: null;
}

/// Maps [Breakpoint]s to [SlotLayoutConfig]s to determine what Widget to
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_adaptive_scaffold/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_adaptive_scaffold
description: Widgets to easily build adaptive layouts, including navigation elements.
version: 0.2.1
version: 0.2.2
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+flutter_adaptive_scaffold%22
repository: https://github.com/flutter/packages/tree/main/packages/flutter_adaptive_scaffold

Expand Down
Loading

0 comments on commit 730fb00

Please sign in to comment.