diff --git a/.fvmrc b/.fvmrc index 1670fb70a3..dceb80ddbd 100644 --- a/.fvmrc +++ b/.fvmrc @@ -1,3 +1,3 @@ { - "flutter": "3.35.5" + "flutter": "3.38.2" } diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70b0b64745..f7054754b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -235,11 +235,27 @@ jobs: - name: Setup uv uses: astral-sh/setup-uv@v6 - - name: Setup Flutter - uses: kuhnroyal/flutter-fvm-config-action/setup@v3 + - name: Configure Flutter version + uses: kuhnroyal/flutter-fvm-config-action/config@v3 + id: fvm-config-action with: path: '.fvmrc' - cache: true + + - name: Setup Flutter + id: flutter-action + uses: subosito/flutter-action@v2 + with: + flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }} + channel: ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }} + cache: false + + # TODO: Remove when https://github.com/actions/runner-images/issues/13341 is fixed + - name: Cache Flutter + id: cache-flutter + uses: actions/cache@v4 + with: + path: ${{ steps.flutter-action.outputs.CACHE-PATH }} + key: ${{ steps.flutter-action.outputs.CACHE-KEY }} - name: Build Flutter macOS client shell: bash diff --git a/.github/workflows/macos-integration-tests.yml b/.github/workflows/macos-integration-tests.yml index b266500d85..7f7ed5d84e 100644 --- a/.github/workflows/macos-integration-tests.yml +++ b/.github/workflows/macos-integration-tests.yml @@ -45,12 +45,27 @@ jobs: - name: Setup uv uses: astral-sh/setup-uv@v6 - - name: Setup Flutter - uses: kuhnroyal/flutter-fvm-config-action/setup@v3 + - name: Configure Flutter version + uses: kuhnroyal/flutter-fvm-config-action/config@v3 id: fvm-config-action with: path: '.fvmrc' - cache: true + + - name: Setup Flutter + id: flutter-action + uses: subosito/flutter-action@v2 + with: + flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }} + channel: ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }} + cache: false + + # TODO: Remove when https://github.com/actions/runner-images/issues/13341 is fixed + - name: Cache Flutter + id: cache-flutter + uses: actions/cache@v4 + with: + path: ${{ steps.flutter-action.outputs.CACHE-PATH }} + key: ${{ steps.flutter-action.outputs.CACHE-KEY }} - name: Show tool versions run: | diff --git a/client/integration_test/flutter_tester.dart b/client/integration_test/flutter_tester.dart index 6affc6bd79..50e83e1c18 100644 --- a/client/integration_test/flutter_tester.dart +++ b/client/integration_test/flutter_tester.dart @@ -14,6 +14,7 @@ class FlutterWidgetTester implements Tester { final IntegrationTestWidgetsFlutterBinding _binding; final lock = Lock(); final Completer _teardown = Completer(); + TestGesture? _gesture; FlutterWidgetTester(this._tester, this._binding); @@ -21,8 +22,9 @@ class FlutterWidgetTester implements Tester { Future pumpAndSettle({Duration? duration}) async { await lock.acquire(); try { - await _tester - .pumpAndSettle(duration ?? const Duration(milliseconds: 100)); + await _tester.pumpAndSettle( + duration ?? const Duration(milliseconds: 100), + ); } finally { lock.release(); } @@ -60,7 +62,8 @@ class FlutterWidgetTester implements Tester { if (defaultTargetPlatform != TargetPlatform.android && defaultTargetPlatform != TargetPlatform.iOS) { throw Exception( - "Full app screenshots are only available on Android and iOS."); + "Full app screenshots are only available on Android and iOS.", + ); } if (defaultTargetPlatform == TargetPlatform.android) { await _binding.convertFlutterSurfaceToImage(); @@ -71,25 +74,34 @@ class FlutterWidgetTester implements Tester { } @override - Future tap(TestFinder finder, int finderIndex) => - _tester.tap((finder as FlutterTestFinder).raw.at(finderIndex)); + Future tap(TestFinder finder, int finderIndex) async { + await _tester.tap((finder as FlutterTestFinder).raw.at(finderIndex)); + } @override - Future longPress(TestFinder finder, int finderIndex) => - _tester.longPress((finder as FlutterTestFinder).raw.at(finderIndex)); + Future longPress(TestFinder finder, int finderIndex) async { + await _tester.longPress((finder as FlutterTestFinder).raw.at(finderIndex)); + } + @override - Future enterText(TestFinder finder, int finderIndex, String text) => - _tester.enterText( - (finder as FlutterTestFinder).raw.at(finderIndex), text); + Future enterText( + TestFinder finder, int finderIndex, String text) async { + await _tester.enterText( + (finder as FlutterTestFinder).raw.at(finderIndex), + text, + ); + } @override Future mouseHover(TestFinder finder, int finderIndex) async { - final center = - _tester.getCenter((finder as FlutterTestFinder).raw.at(finderIndex)); - final gesture = await _tester.createGesture(kind: PointerDeviceKind.mouse); - await gesture.addPointer(); - await gesture.moveTo(center); - await pumpAndSettle(); + final center = _tester.getCenter( + (finder as FlutterTestFinder).raw.at(finderIndex), + ); + + await _mouseExit(); + _gesture = await _tester.createGesture(kind: PointerDeviceKind.mouse); + await _gesture?.addPointer(); + await _gesture?.moveTo(center); } @override @@ -97,4 +109,11 @@ class FlutterWidgetTester implements Tester { @override Future waitForTeardown() => _teardown.future; + + Future _mouseExit() async { + if (_gesture != null) { + await _gesture?.removePointer(); + _gesture = null; + } + } } diff --git a/client/macos/Flutter/GeneratedPluginRegistrant.swift b/client/macos/Flutter/GeneratedPluginRegistrant.swift index 18f1748490..3370f49189 100644 --- a/client/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/client/macos/Flutter/GeneratedPluginRegistrant.swift @@ -12,7 +12,6 @@ import geolocator_apple import media_kit_libs_macos_video import media_kit_video import package_info_plus -import path_provider_foundation import record_macos import rive_common import screen_retriever_macos @@ -32,7 +31,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { MediaKitLibsMacosVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitLibsMacosVideoPlugin")) MediaKitVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitVideoPlugin")) FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) - PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) RecordMacOsPlugin.register(with: registry.registrar(forPlugin: "RecordMacOsPlugin")) RivePlugin.register(with: registry.registrar(forPlugin: "RivePlugin")) ScreenRetrieverMacosPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverMacosPlugin")) diff --git a/client/pubspec.lock b/client/pubspec.lock index 6f8197566b..d562ba781a 100644 --- a/client/pubspec.lock +++ b/client/pubspec.lock @@ -133,18 +133,18 @@ packages: dependency: transitive description: name: cross_file - sha256: "7caf6a750a0c04effbb52a676dce9a4a592e10ad35c34d6d2d0e4811160d5670" + sha256: "701dcfc06da0882883a2657c445103380e53e647060ad8d9dfb710c100996608" url: "https://pub.dev" source: hosted - version: "0.3.4+2" + version: "0.3.5+1" crypto: dependency: transitive description: name: crypto - sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" + sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf url: "https://pub.dev" source: hosted - version: "3.0.6" + version: "3.0.7" cupertino_icons: dependency: "direct main" description: @@ -189,10 +189,10 @@ packages: dependency: transitive description: name: device_info_plus - sha256: "49413c8ca514dea7633e8def233b25efdf83ec8522955cc2c0e3ad802927e7c6" + sha256: dd0e8e02186b2196c7848c9d394a5fd6e5b57a43a546082c5820b1ec72317e33 url: "https://pub.dev" source: hosted - version: "12.1.0" + version: "12.2.0" device_info_plus_platform_interface: dependency: transitive description: @@ -237,10 +237,10 @@ packages: dependency: transitive description: name: file_picker - sha256: f2d9f173c2c14635cc0e9b14c143c49ef30b4934e8d1d274d6206fcb0086a06f + sha256: "7872545770c277236fd32b022767576c562ba28366204ff1a5628853cf8f2200" url: "https://pub.dev" source: hosted - version: "10.3.3" + version: "10.3.7" fixnum: dependency: transitive description: @@ -422,10 +422,10 @@ packages: dependency: transitive description: name: flutter_plugin_android_lifecycle - sha256: c2fe1001710127dfa7da89977a08d591398370d099aacdaa6d44da7eb14b8476 + sha256: ee8068e0e1cd16c4a82714119918efdeed33b3ba7772c54b5d094ab53f9b7fd1 url: "https://pub.dev" source: hosted - version: "2.0.31" + version: "2.0.33" flutter_svg: dependency: transitive description: @@ -754,10 +754,10 @@ packages: dependency: transitive description: name: meta - sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c + sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.17.0" mgrs_dart: dependency: transitive description: @@ -782,6 +782,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.0" + objective_c: + dependency: transitive + description: + name: objective_c + sha256: "1f81ed9e41909d44162d7ec8663b2c647c202317cc0b56d3d56f6a13146a0b64" + url: "https://pub.dev" + source: hosted + version: "9.1.0" package_info_plus: dependency: transitive description: @@ -826,18 +834,18 @@ packages: dependency: transitive description: name: path_provider_android - sha256: "3b4c1fc3aa55ddc9cd4aa6759984330d5c8e66aa7702a6223c61540dc6380c37" + sha256: f2c65e21139ce2c3dad46922be8272bb5963516045659e71bb16e151c93b580e url: "https://pub.dev" source: hosted - version: "2.2.19" + version: "2.2.22" path_provider_foundation: dependency: transitive description: name: path_provider_foundation - sha256: "16eef174aacb07e09c351502740fa6254c165757638eba1e9116b0a781201bbd" + sha256: "6192e477f34018ef1ea790c56fffc7302e3bc3efede9e798b934c252c8c105ba" url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "2.5.0" path_provider_linux: dependency: transitive description: @@ -966,6 +974,14 @@ packages: url: "https://pub.dev" source: hosted version: "6.1.5+1" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585" + url: "https://pub.dev" + source: hosted + version: "2.2.0" record: dependency: transitive description: @@ -978,18 +994,18 @@ packages: dependency: transitive description: name: record_android - sha256: f05677eeed074898327f890f232f9eb49cd99d1c20d0daaf22b5612f4b2301bb + sha256: "9aaf3f151e61399b09bd7c31eb5f78253d2962b3f57af019ac5a2d1a3afdcf71" url: "https://pub.dev" source: hosted - version: "1.4.3" + version: "1.4.5" record_ios: dependency: transitive description: name: record_ios - sha256: "765b42ac1be019b1674ddd809b811fc721fe5a93f7bb1da7803f0d16772fd6d7" + sha256: "69fcd37c6185834e90254573599a9165db18a2cbfa266b6d1e46ffffeb06a28c" url: "https://pub.dev" source: hosted - version: "1.1.4" + version: "1.1.5" record_linux: dependency: transitive description: @@ -1018,10 +1034,10 @@ packages: dependency: transitive description: name: record_web - sha256: "4f0adf20c9ccafcc02d71111fd91fba1ca7b17a7453902593e5a9b25b74a5c56" + sha256: "3feeffbc0913af3021da9810bb8702a068db6bc9da52dde1d19b6ee7cb9edb51" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.2" record_windows: dependency: transitive description: @@ -1146,18 +1162,18 @@ packages: dependency: transitive description: name: shared_preferences_android - sha256: "34266009473bf71d748912da4bf62d439185226c03e01e2d9687bc65bbfcb713" + sha256: "46a46fd64659eff15f4638bbe19de43f9483f0e0bf024a9fb6b3582064bacc7b" url: "https://pub.dev" source: hosted - version: "2.4.15" + version: "2.4.17" shared_preferences_foundation: dependency: transitive description: name: shared_preferences_foundation - sha256: "6a52cfcdaeac77cad8c97b539ff688ccfc458c007b4db12be584fbe5c0e49e03" + sha256: "4e7eaffc2b17ba398759f1151415869a34771ba11ebbccd1b0145472a619a64f" url: "https://pub.dev" source: hosted - version: "2.5.4" + version: "2.5.6" shared_preferences_linux: dependency: transitive description: @@ -1203,14 +1219,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.10.1" - sprintf: - dependency: transitive - description: - name: sprintf - sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" - url: "https://pub.dev" - source: hosted - version: "7.0.0" stack_trace: dependency: transitive description: @@ -1263,10 +1271,10 @@ packages: dependency: transitive description: name: test_api - sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00" + sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55 url: "https://pub.dev" source: hosted - version: "0.7.6" + version: "0.7.7" torch_light: dependency: transitive description: @@ -1319,34 +1327,34 @@ packages: dependency: transitive description: name: url_launcher_android - sha256: "5c8b6c2d89a78f5a1cca70a73d9d5f86c701b36b42f9c9dac7bad592113c28e9" + sha256: "767344bf3063897b5cf0db830e94f904528e6dd50a6dfaf839f0abf509009611" url: "https://pub.dev" source: hosted - version: "6.3.24" + version: "6.3.28" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - sha256: d80b3f567a617cb923546034cc94bfe44eb15f989fe670b37f26abdb9d939cb7 + sha256: cfde38aa257dae62ffe79c87fab20165dfdf6988c1d31b58ebf59b9106062aad url: "https://pub.dev" source: hosted - version: "6.3.4" + version: "6.3.6" url_launcher_linux: dependency: transitive description: name: url_launcher_linux - sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935" + sha256: d5e14138b3bc193a0f63c10a53c94b91d399df0512b1f29b94a043db7482384a url: "https://pub.dev" source: hosted - version: "3.2.1" + version: "3.2.2" url_launcher_macos: dependency: transitive description: name: url_launcher_macos - sha256: c043a77d6600ac9c38300567f33ef12b0ef4f4783a2c1f00231d2b1941fea13f + sha256: "368adf46f71ad3c21b8f06614adb38346f193f3a59ba8fe9a2fd74133070ba18" url: "https://pub.dev" source: hosted - version: "3.2.3" + version: "3.2.5" url_launcher_platform_interface: dependency: transitive description: @@ -1367,18 +1375,18 @@ packages: dependency: transitive description: name: url_launcher_windows - sha256: "3284b6d2ac454cf34f114e1d3319866fdd1e19cdc329999057e44ffe936cfa77" + sha256: "712c70ab1b99744ff066053cbe3e80c73332b38d46e5e945c98689b2e66fc15f" url: "https://pub.dev" source: hosted - version: "3.1.4" + version: "3.1.5" uuid: dependency: transitive description: name: uuid - sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff + sha256: a11b666489b1954e01d992f3d601b1804a33937b5a8fe677bd26b8a9f96f96e8 url: "https://pub.dev" source: hosted - version: "4.5.1" + version: "4.5.2" vector_graphics: dependency: transitive description: @@ -1487,10 +1495,10 @@ packages: dependency: transitive description: name: webview_flutter_android - sha256: e5201c620eb2637dca88a756961fae4a7191bb30b4f2271e08b746405ffdf3fd + sha256: "3fcca88ee2ae568807ebd42deed235bb8dd8e62b3e4d5caff67daa6bce062cca" url: "https://pub.dev" source: hosted - version: "4.10.5" + version: "4.10.9" webview_flutter_platform_interface: dependency: transitive description: @@ -1511,10 +1519,10 @@ packages: dependency: transitive description: name: webview_flutter_wkwebview - sha256: fea63576b3b7e02b2df8b78ba92b48ed66caec2bb041e9a0b1cbd586d5d80bfd + sha256: a57b76a081bed3bf3a71a486bdf83642b00f1a7342043d50367cea68f338b1af url: "https://pub.dev" source: hosted - version: "3.23.1" + version: "3.23.4" win32: dependency: transitive description: diff --git a/packages/flet/lib/src/controls/cupertino_checkbox.dart b/packages/flet/lib/src/controls/cupertino_checkbox.dart index d8ef3513d9..46019af455 100644 --- a/packages/flet/lib/src/controls/cupertino_checkbox.dart +++ b/packages/flet/lib/src/controls/cupertino_checkbox.dart @@ -116,6 +116,7 @@ class _CheckboxControlState extends State { var label = widget.control.buildTextOrWidget("label", textStyle: labelStyle); if (label != null) { + var spacing = widget.control.getDouble("spacing", 10)!; label = widget.control.disabled ? label : MouseRegion(cursor: SystemMouseCursors.click, child: label); @@ -125,8 +126,9 @@ class _CheckboxControlState extends State { child: GestureDetector( onTap: !widget.control.disabled ? _toggleValue : null, child: labelPosition == LabelPosition.right - ? Row(children: [cupertinoCheckbox, label]) - : Row(children: [label, cupertinoCheckbox]))); + ? Row(spacing: spacing, children: [cupertinoCheckbox, label]) + : Row( + spacing: spacing, children: [label, cupertinoCheckbox]))); } // Apply width and height if provided diff --git a/packages/flet/lib/src/controls/snack_bar.dart b/packages/flet/lib/src/controls/snack_bar.dart index 48126875cb..25fc295451 100644 --- a/packages/flet/lib/src/controls/snack_bar.dart +++ b/packages/flet/lib/src/controls/snack_bar.dart @@ -79,6 +79,7 @@ class SnackBarControl extends StatelessWidget { elevation: control.getDouble("elevation"), duration: control.getDuration("duration", const Duration(milliseconds: 4000))!, + persist: control.getBool("persist"), ); } diff --git a/sdk/python/examples/controls/snack_bar/action.py b/sdk/python/examples/controls/snack_bar/action.py index e2b8651e36..8bc496c38f 100644 --- a/sdk/python/examples/controls/snack_bar/action.py +++ b/sdk/python/examples/controls/snack_bar/action.py @@ -15,6 +15,7 @@ def open_custom_action(e: ft.Event[ft.Button]): page.show_dialog( ft.SnackBar( ft.Text("The directory has been deleted."), + persist=False, action=ft.SnackBarAction( label="Undo delete", text_color=ft.Colors.YELLOW, diff --git a/sdk/python/packages/flet-cli/src/flet_cli/commands/build.py b/sdk/python/packages/flet-cli/src/flet_cli/commands/build.py index b4470b51e0..575715fbec 100644 --- a/sdk/python/packages/flet-cli/src/flet_cli/commands/build.py +++ b/sdk/python/packages/flet-cli/src/flet_cli/commands/build.py @@ -36,7 +36,7 @@ PYODIDE_ROOT_URL = "https://cdn.jsdelivr.net/pyodide/v0.27.7/full" DEFAULT_TEMPLATE_URL = "gh:flet-dev/flet-build-template" -MINIMAL_FLUTTER_VERSION = version.Version("3.35.5") +MINIMAL_FLUTTER_VERSION = version.Version("3.38.2") no_rich_output = get_bool_env_var("FLET_CLI_NO_RICH_OUTPUT") diff --git a/sdk/python/packages/flet/integration_tests/controls/cupertino/golden/macos/cupertino_checkbox/basic.png b/sdk/python/packages/flet/integration_tests/controls/cupertino/golden/macos/cupertino_checkbox/basic.png index 60b207ba42..4ff0115116 100644 Binary files a/sdk/python/packages/flet/integration_tests/controls/cupertino/golden/macos/cupertino_checkbox/basic.png and b/sdk/python/packages/flet/integration_tests/controls/cupertino/golden/macos/cupertino_checkbox/basic.png differ diff --git a/sdk/python/packages/flet/integration_tests/controls/cupertino/golden/macos/cupertino_checkbox/basic_checked.png b/sdk/python/packages/flet/integration_tests/controls/cupertino/golden/macos/cupertino_checkbox/basic_checked.png new file mode 100644 index 0000000000..070520892e Binary files /dev/null and b/sdk/python/packages/flet/integration_tests/controls/cupertino/golden/macos/cupertino_checkbox/basic_checked.png differ diff --git a/sdk/python/packages/flet/integration_tests/controls/cupertino/golden/macos/cupertino_checkbox/label.png b/sdk/python/packages/flet/integration_tests/controls/cupertino/golden/macos/cupertino_checkbox/label.png new file mode 100644 index 0000000000..fc735f8628 Binary files /dev/null and b/sdk/python/packages/flet/integration_tests/controls/cupertino/golden/macos/cupertino_checkbox/label.png differ diff --git a/sdk/python/packages/flet/integration_tests/controls/cupertino/golden/macos/cupertino_checkbox/label_position.png b/sdk/python/packages/flet/integration_tests/controls/cupertino/golden/macos/cupertino_checkbox/label_position.png new file mode 100644 index 0000000000..88b98a6af3 Binary files /dev/null and b/sdk/python/packages/flet/integration_tests/controls/cupertino/golden/macos/cupertino_checkbox/label_position.png differ diff --git a/sdk/python/packages/flet/integration_tests/controls/cupertino/golden/macos/cupertino_checkbox/position.png b/sdk/python/packages/flet/integration_tests/controls/cupertino/golden/macos/cupertino_checkbox/position.png deleted file mode 100644 index 01295a8547..0000000000 Binary files a/sdk/python/packages/flet/integration_tests/controls/cupertino/golden/macos/cupertino_checkbox/position.png and /dev/null differ diff --git a/sdk/python/packages/flet/integration_tests/controls/cupertino/golden/macos/cupertino_checkbox/tristate_1.png b/sdk/python/packages/flet/integration_tests/controls/cupertino/golden/macos/cupertino_checkbox/tristate_1.png index 793fbfdecc..2bec6e6176 100644 Binary files a/sdk/python/packages/flet/integration_tests/controls/cupertino/golden/macos/cupertino_checkbox/tristate_1.png and b/sdk/python/packages/flet/integration_tests/controls/cupertino/golden/macos/cupertino_checkbox/tristate_1.png differ diff --git a/sdk/python/packages/flet/integration_tests/controls/cupertino/golden/macos/cupertino_checkbox/tristate_2.png b/sdk/python/packages/flet/integration_tests/controls/cupertino/golden/macos/cupertino_checkbox/tristate_2.png index f5cb043577..b96245bfc7 100644 Binary files a/sdk/python/packages/flet/integration_tests/controls/cupertino/golden/macos/cupertino_checkbox/tristate_2.png and b/sdk/python/packages/flet/integration_tests/controls/cupertino/golden/macos/cupertino_checkbox/tristate_2.png differ diff --git a/sdk/python/packages/flet/integration_tests/controls/cupertino/test_cupertino_checkbox.py b/sdk/python/packages/flet/integration_tests/controls/cupertino/test_cupertino_checkbox.py index 080f18d609..1bb11772dd 100644 --- a/sdk/python/packages/flet/integration_tests/controls/cupertino/test_cupertino_checkbox.py +++ b/sdk/python/packages/flet/integration_tests/controls/cupertino/test_cupertino_checkbox.py @@ -12,14 +12,6 @@ ft.ControlState.SELECTED: ft.Colors.DEEP_ORANGE_200, ft.ControlState.DEFAULT: ft.Colors.TEAL_200, }, - key="tristate", -) - -ccb = ft.CupertinoCheckbox( - label="Cupertino Checkbox circle border", - value=True, - shape=ft.CircleBorder(), - key="circleborder", ) @@ -44,14 +36,38 @@ async def test_tristate_2(flet_app: ftt.FletTestApp, request): async def test_basic(flet_app: ftt.FletTestApp, request): await flet_app.assert_control_screenshot( request.node.name, - ccb, + ft.CupertinoCheckbox(), + ) + + +@pytest.mark.asyncio(loop_scope="module") +async def test_basic_checked(flet_app: ftt.FletTestApp, request): + await flet_app.assert_control_screenshot( + request.node.name, + ft.CupertinoCheckbox( + value=True, + ), + ) + + +@pytest.mark.asyncio(loop_scope="module") +async def test_label_position(flet_app: ftt.FletTestApp, request): + await flet_app.assert_control_screenshot( + request.node.name, + ft.CupertinoCheckbox( + label="Cupertino Checkbox with circle border", + label_position=ft.LabelPosition.LEFT, + value=True, + shape=ft.CircleBorder(), + ), ) @pytest.mark.asyncio(loop_scope="module") -async def test_position(flet_app: ftt.FletTestApp, request): - ccb.label_position = ft.LabelPosition.LEFT +async def test_label(flet_app: ftt.FletTestApp, request): await flet_app.assert_control_screenshot( request.node.name, - ccb, + ft.CupertinoCheckbox( + label="Cupertino Checkbox with label", + ), ) diff --git a/sdk/python/packages/flet/integration_tests/controls/material/golden/macos/dropdown/theme_1.png b/sdk/python/packages/flet/integration_tests/controls/material/golden/macos/dropdown/theme_1.png index 70612bb061..c597652d1e 100644 Binary files a/sdk/python/packages/flet/integration_tests/controls/material/golden/macos/dropdown/theme_1.png and b/sdk/python/packages/flet/integration_tests/controls/material/golden/macos/dropdown/theme_1.png differ diff --git a/sdk/python/packages/flet/integration_tests/controls/material/golden/macos/menu_bar/menu_bar_basic_open.png b/sdk/python/packages/flet/integration_tests/controls/material/golden/macos/menu_bar/menu_bar_basic_open.png index 6368277e64..80bf8a3ee8 100644 Binary files a/sdk/python/packages/flet/integration_tests/controls/material/golden/macos/menu_bar/menu_bar_basic_open.png and b/sdk/python/packages/flet/integration_tests/controls/material/golden/macos/menu_bar/menu_bar_basic_open.png differ diff --git a/sdk/python/packages/flet/integration_tests/controls/material/golden/macos/navigation_bar/theme_3.png b/sdk/python/packages/flet/integration_tests/controls/material/golden/macos/navigation_bar/theme_3.png index ef9b08a344..59497fa8de 100644 Binary files a/sdk/python/packages/flet/integration_tests/controls/material/golden/macos/navigation_bar/theme_3.png and b/sdk/python/packages/flet/integration_tests/controls/material/golden/macos/navigation_bar/theme_3.png differ diff --git a/sdk/python/packages/flet/integration_tests/controls/material/golden/macos/time_picker/basic.png b/sdk/python/packages/flet/integration_tests/controls/material/golden/macos/time_picker/basic.png index 49180bfb76..1a54ee0c8a 100644 Binary files a/sdk/python/packages/flet/integration_tests/controls/material/golden/macos/time_picker/basic.png and b/sdk/python/packages/flet/integration_tests/controls/material/golden/macos/time_picker/basic.png differ diff --git a/sdk/python/packages/flet/integration_tests/controls/material/golden/macos/time_picker/hour_format_12.png b/sdk/python/packages/flet/integration_tests/controls/material/golden/macos/time_picker/hour_format_12.png index d21b6630ea..80d7facc86 100644 Binary files a/sdk/python/packages/flet/integration_tests/controls/material/golden/macos/time_picker/hour_format_12.png and b/sdk/python/packages/flet/integration_tests/controls/material/golden/macos/time_picker/hour_format_12.png differ diff --git a/sdk/python/packages/flet/integration_tests/controls/material/golden/macos/time_picker/hour_format_24.png b/sdk/python/packages/flet/integration_tests/controls/material/golden/macos/time_picker/hour_format_24.png index dab4e6d3c8..3c0d045164 100644 Binary files a/sdk/python/packages/flet/integration_tests/controls/material/golden/macos/time_picker/hour_format_24.png and b/sdk/python/packages/flet/integration_tests/controls/material/golden/macos/time_picker/hour_format_24.png differ diff --git a/sdk/python/packages/flet/integration_tests/controls/material/test_navigation_bar.py b/sdk/python/packages/flet/integration_tests/controls/material/test_navigation_bar.py index 98d801c257..a8fae9e85b 100644 --- a/sdk/python/packages/flet/integration_tests/controls/material/test_navigation_bar.py +++ b/sdk/python/packages/flet/integration_tests/controls/material/test_navigation_bar.py @@ -58,10 +58,13 @@ async def test_theme(flet_app: ftt.FletTestApp): elevation=100, destinations=[ ft.NavigationBarDestination(icon=ft.Icons.EXPLORE, label="Explore"), - ft.NavigationBarDestination(key="add", icon=ft.Icon(ft.Icons.ADD)), ft.NavigationBarDestination( + key="add", icon=ft.Icon(ft.Icons.ADD), label="Add" + ), + ft.NavigationBarDestination( + key="phone", icon=ft.Icons.PHONE_ENABLED, - label="Explore", + label="Phone", ), ], ) @@ -87,7 +90,6 @@ async def test_theme(flet_app: ftt.FletTestApp): # click to check label behaviour await flet_app.tester.tap(add) - flet_app.page.update() await flet_app.tester.pump_and_settle() flet_app.assert_screenshot( diff --git a/sdk/python/packages/flet/integration_tests/examples/cupertino/golden/macos/cupertino_checkbox/image_for_docs.png b/sdk/python/packages/flet/integration_tests/examples/cupertino/golden/macos/cupertino_checkbox/image_for_docs.png index 3c0e681b84..26f345cfa7 100644 Binary files a/sdk/python/packages/flet/integration_tests/examples/cupertino/golden/macos/cupertino_checkbox/image_for_docs.png and b/sdk/python/packages/flet/integration_tests/examples/cupertino/golden/macos/cupertino_checkbox/image_for_docs.png differ diff --git a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/submenu_button/basic.png b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/submenu_button/basic.png index 9952d00055..ce7976851c 100644 Binary files a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/submenu_button/basic.png and b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/submenu_button/basic.png differ diff --git a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/submenu_button/image_for_docs.png b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/submenu_button/image_for_docs.png index 795beb8bcb..545ed1d2cc 100644 Binary files a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/submenu_button/image_for_docs.png and b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/submenu_button/image_for_docs.png differ diff --git a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/basic.png b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/basic.png index 602ff9a1da..a9c9a9b99e 100644 Binary files a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/basic.png and b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/basic.png differ diff --git a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats.gif b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats.gif index e5b76f00af..1e7061dda0 100644 Binary files a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats.gif and b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats.gif differ diff --git a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_1.png b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_1.png index 96ed0eabd3..492f8e0c4e 100644 Binary files a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_1.png and b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_1.png differ diff --git a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_10.png b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_10.png index ac5e67bd39..3907a9d142 100644 Binary files a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_10.png and b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_10.png differ diff --git a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_11.png b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_11.png index b45a0baec1..922be3654a 100644 Binary files a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_11.png and b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_11.png differ diff --git a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_2.png b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_2.png index e7882b74f1..f29e0de912 100644 Binary files a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_2.png and b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_2.png differ diff --git a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_3.png b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_3.png index 85f0ee73e9..e36d975921 100644 Binary files a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_3.png and b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_3.png differ diff --git a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_4.png b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_4.png index 3ce0e134b3..c3ee17e8c0 100644 Binary files a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_4.png and b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_4.png differ diff --git a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_5.png b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_5.png index ab37911926..9023c9df13 100644 Binary files a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_5.png and b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_5.png differ diff --git a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_6.png b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_6.png index fa5bc37bdc..11403ac8ed 100644 Binary files a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_6.png and b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_6.png differ diff --git a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_7.png b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_7.png index ab37911926..9023c9df13 100644 Binary files a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_7.png and b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_7.png differ diff --git a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_8.png b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_8.png index a5c40b5a4a..d0ce8fe7d4 100644 Binary files a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_8.png and b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_8.png differ diff --git a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_9.png b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_9.png index f72778ad23..d24aaae6d1 100644 Binary files a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_9.png and b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/hour_formats_9.png differ diff --git a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/image_for_docs.png b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/image_for_docs.png index ad6744fdbc..c8e716a2f4 100644 Binary files a/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/image_for_docs.png and b/sdk/python/packages/flet/integration_tests/examples/material/golden/macos/time_picker/image_for_docs.png differ diff --git a/sdk/python/packages/flet/src/flet/controls/cupertino/cupertino_checkbox.py b/sdk/python/packages/flet/src/flet/controls/cupertino/cupertino_checkbox.py index e53c3d282a..35aadcf35b 100644 --- a/sdk/python/packages/flet/src/flet/controls/cupertino/cupertino_checkbox.py +++ b/sdk/python/packages/flet/src/flet/controls/cupertino/cupertino_checkbox.py @@ -11,6 +11,7 @@ ColorValue, LabelPosition, MouseCursor, + Number, ) __all__ = ["CupertinoCheckbox"] @@ -46,6 +47,11 @@ class CupertinoCheckbox(LayoutControl): Defines on which side of this checkbox the [`label`][(c).] should be shown. """ + spacing: Optional[Number] = 10 + """ + The space between this checkbox and the [`label`][(c).]. + """ + value: Optional[bool] = False """ The value of this checkbox. diff --git a/sdk/python/packages/flet/src/flet/controls/material/snack_bar.py b/sdk/python/packages/flet/src/flet/controls/material/snack_bar.py index 83e27e9afb..1e51f1bcd8 100644 --- a/sdk/python/packages/flet/src/flet/controls/material/snack_bar.py +++ b/sdk/python/packages/flet/src/flet/controls/material/snack_bar.py @@ -228,6 +228,19 @@ class SnackBar(DialogControl): ValueError: If it is not between `0.0` and `1.0` inclusive. """ + persist: Optional[bool] = None + """ + Whether the snack bar will stay or auto-dismiss after timeout. + + If `True`, the snack bar remains visible even after the timeout, + until the user taps the action button or the close icon. + + If `False`, the snack bar will be dismissed after the timeout. + + If not provided, but the snackbar ['action'][c.] is not null, + the snackbar will persist as well. + """ + on_action: Optional[ControlEventHandler["SnackBar"]] = None """ Called when action button is clicked.