It’s time for the stable release of Flutter again – we’re very proud to announce Flutter 3! Just three months ago, we announced Flutter support for Windows. Today, we’re excited to announce that Flutter is now stable on macOS and Linux in addition to Windows!
Thanks to the hard work of our Flutter contributors, we’ve merged 5248 pull requests!
As part of this release, we have several exciting things to announce, including updates to Flutter’s support for macOS and Linux, significant performance improvements, mobile and web updates – and more. Additionally, we have news about dropping support for older versions of Windows, and a short list of breaking changes. So, let’s get down to business!
Ready for production on all desktop platforms
Linux and macOS have reached stable, including the following features.
Cascading menus and support for the macOS system menu bar
You can now create platform-rendered menu bars on macOS using the PlatformMenuBar widget, which supports the insertion of platform-specific menus and controls what appears in macOS application menus.
The gif is too big, bye.
Full support for international text input on all desktop platforms
International text input, including languages using text input method editors (IMEs) such as Chinese, Japanese, and Korean, is fully supported on all three desktop platforms, including third-party input methods such as Sogou and Google Japanese Input.
Accessibility on all desktop platforms
Flutter for Windows, macOS, and Linux supports accessibility services such as screen readers, accessible navigation, and color inversion.
Universal binaries by default on macOS
Starting with Flutter 3, the Flutter macOS desktop app is built as a universal binary with native support for existing Intel-based Macs and Apple’s latest Apple Silicon devices.
Deprecating Windows 7/8 for development
In this release, we have increased the recommended Windows version for development to Windows 10. While we have not blocked development on older versions (Windows 7, Windows 8, Windows 8.1) that are no longer supported by Microsoft, we provide limited testing on these versions. While we will continue to provide “best efforts” support for older versions, we encourage you to upgrade.
Note: We continue to provide support for Flutter apps running on Windows 7 and Windows 8; this change only affects the recommended development environment.
Mobile updates
Our updates to the mobile platform include the following.
Foldable phone support
Flutter 3 version supports foldable mobile devices. In a collaboration spearheaded by Microsoft, new features and widgets allow you to create dynamic and delightful experiences on foldable devices.
As part of this work, MediaQuery now contains a list of DisplayFeatures describing the bounds and states of device elements such as hinges, folds, and cutouts. Additionally, the DisplayFeatureSubScreen widget now positions its child widgets without overlapping the bounds of DisplayFeatures, and has been integrated with the framework’s default dialogs and popups, enabling Flutter to sense and respond to changes in these elements.
Big thanks to the Microsoft team, especially @andreidiaconu, for their contributions!
Try the Surface Duo emulator Sample: https://docs.microsoft.com/en-us/dual-screen/flutter/samples, includes a sample with a special branch of the Flutter gallery, take a look at Flutter’s dual monitors operation.
iOS variable refresh rate support
Flutter now supports variable refresh rates on iOS devices with ProMotion displays, including the iPhone 13 Pro and iPad Pro. On these devices, Flutter apps can render at refresh rates up to 120 Hz, which was previously limited to 60 Hz. This makes for a smoother experience in fast animations like scrolling. See flutter.dev/go/variable-refresh-rate for more details.
Simplified iOS releases
We’ve added new options to the flutter build ipa command to simplify publishing your iOS app. When you’re ready to publish to TestFlight or the App Store, run flutter build ipa to build an Xcode archive (.xcarchive file) and an app bundle (.ipa file). You can choose to add –export-method ad-hoc, –export-method development, or –export-method enterprise. Once the app is bundled, upload it to Apple via the Apple Transport macOS app or using xcrun altool from the command line (run man altool for App Store Connect API key verification instructions). Once uploaded, your app can be published to TestFlight or the App Store. After setting the initial Xcode project settings such as display name and app icon, you no longer need to open Xcode to publish your app.
Gradle version update
If you create a new project with the Flutter tools, you may notice that the generated files now use the latest version of Gradle and the Android Gradle plugin. For existing projects, you need to manually upgrade the Gradle version to 7.4 and the Android Gradle plugin to 7.1.2.
Sunset 32-bit iOS/iOS 9/iOS 10
As we announced the 2.10 stable release in February 2022, Flutter’s support for 32-bit iOS devices and iOS 9 and 10 versions is coming to an end. This change affects the iPhone 4S, iPhone 5, iPhone 5C, and second-, third-, and fourth-generation iPad devices. Flutter 3 is the last stable release to support these iOS versions and devices.
To learn more about this change, see RFC: Ending Support for 32-bit iOS Devices.
Web updates
Our updates to the web app include the following.
Image decoding
Flutter web can now automatically detect and use the ImageDecoder API in browsers that support it. As of today, most Chromium-based browsers (Chrome, Edge, Opera, Samsung Browser, etc.) have added this API.
The new API uses the browser’s built-in image codec to decode images asynchronously off the main thread. This makes image decoding 2x faster, and it never blocks the main thread, removing all the distractions previously caused by images.
Web app lifecycles
The new lifecycle API for Flutter web apps gives you the flexibility to control the startup process of your Flutter app from a hosted HTML page and helps Lighthouse analyze your app’s performance. This works for many use cases, including the frequently requested scenarios below.
- A splash screen
- A loading indicator
- Normal HTML interactive page displayed before the Flutter app
For more information, check out Custom Web App Initialization on docs.flutter.dev: https://docs.flutter.dev/development/platform-integration/web/initialization.
Tooling updates
Our updates to Flutter and Dart tools include.
Updated lint package
Version 2.0 of the lint package has been released.
- Flutter: https://pub.dev/packages/flutter_lints/versions/2.0.0
- Dart: https://pub.dev/packages/lints/versions/2.0.0
Apps generated with flutter create in Flutter 3 will automatically enable the v2.0 lints package. We encourage existing apps, packages and plugins to migrate to v2.0 by running flutter pub upgrade –major-versions flutter_lints to follow the latest and greatest best practices in the Flutter world.
In v2, most of the newly added lint warnings have automatic fixes. So after upgrading to the latest package version in your app’s pubspec.yaml file, you can run dart fix –apply in your codebase to automatically fix most lint warnings (some still require some manual work) ). Applications, packages or plugins that do not yet use package:flutter_lints can be migrated by following the migration guide.
Performance improvements
Thanks to open source contributor knopp, partial repaint has been enabled on Android devices that support it. In our local tests, this change reduced the average, 90th percentile, and 99th percentile frame rasterization time by a factor of 5 on the background_filter_perf benchmark on Pixel 4 XL devices. On iOS and newer Android devices, partial repaint is now enabled when there is a single rectangular dirty area.
We further improved the performance of Opacity animations for simple cases. In particular, when an Opacity widget contains only one render primitive, the saveLayer method normally called by Opacity is omitted. In benchmarks built to measure the benefit of this optimization, the rasterization time in this case improved by an order of magnitude. In future releases, we plan to apply this optimization to more scenarios.
Thanks to the work of open source contributor JsouLiang, the engine’s raster and UI threads now run at higher priority than other threads on Android and iOS; for example, the Dart VM background garbage collection thread. In our benchmarks, this resulted in about 20% faster average frame build times.
Prior to the release of version 3, the raster cache admission policy looked only at the number of draw operations in the image, assuming that any image with more than a few operands was a good candidate for caching. Unfortunately, this caused the engine to spend memory caching images that were actually rendered very fast. This release introduces a mechanism to estimate the rendering complexity of an image based on the cost of the drawing operations it contains. In our benchmarks, using this approach as an admission strategy for the raster cache reduces memory usage without degrading performance.
Thanks to open source contributor ColdPaleLight, who fixed a bug in frame scheduling that caused a small number of animation frames to be dropped on iOS. Thanks to everyone who reported this issue and provided video with dropped frames.
Impeller
The team has been working hard to resolve early jank issues on iOS and other platforms. In Flutter 3 release, you can preview an experimental rendering backend called Impeller on iOS. Impeller precompiles a smaller, simpler set of shaders at engine build time so they don’t get compiled at application runtime; this has been a major source of jank in Flutter. Impeller isn’t ready for production, and it’s far from complete. Not all Flutter features have been implemented, but we are satisfied enough with its fidelity and performance in flutter/gallery apps that we are sharing our progress. In particular, the worst frame rate in the gallery app’s transition animation is about 20x.
Impeller is available under a logo on iOS. You can try Impeller by passing –enable-impeller to the flutter run, or by setting the FLTEnableImpeller flag to true in your Info.plist file. Impeller development continues on the main Flutter channel, and we hope to provide further updates in future releases.
Inline ads on android
When you use the google_mobile_ads package, you should see better performance on key user interactions like scrolling and transitions between pages. This is especially evident on devices that are popular in emerging markets. Best of all, no code changes are required!
Under the hood, Flutter now composes Android views asynchronously, often called platform views. This means that the Flutter raster thread does not need to wait for the rendering of the Android view. Instead, the Flutter engine uses the OpenGL textures it manages to place the view on the screen.
More exciting updates
Other updates to the Flutter ecosystem include the following.
Material 3
Flutter 3 supports Material Design 3, the new generation of Material Design. Flutter 3 provides select support for Material 3; this includes Material You features such as dynamic colors, an updated color system and typography, updates to many components, and new visual effects introduced in Android 12, such as the new touch ripple Design and stretch over roll effect. Try out Material 3 features in the new Take your Flutter app from Boring to Beautiful codelab. See the API documentation for details on how to choose to use these new features and which components support Material 3. Follow the ongoing work on the Material 3 Umbrella issue.
Theme extensions
Flutter can now add anything to the ThemeData of the material library, there is a concept called Theme extensions. Instead of extending (Dart sense) ThemeData and reimplementing its copyWith, lerp and other methods, you can specify ThemeData.extensions. Additionally, as a package developer, you can provide ThemeExtensions. See flutter.dev/go/theme-extensions for more details, and check out this example on GitHub.
Ads
We know it’s important for publishers to seek consent for personalized ads and deal with Apple’s App Tracking Transparency (ATT) requirements.
To support these requirements, Google provides the User Information Platform (UMP) SDK, which replaces the previous Open Source Consent SDK. In an upcoming release of the GMA SDK for Flutter, we are adding support for the UMP SDK to enable publishers to obtain user consent. For more details, check out the google_mobile_ads page on pub.dev.
Breaking changes
As we continue to evolve and improve Flutter, our goal is to minimize the number of disruptive changes. With the release of Flutter 3, we have the following breaking changes.
- Deprecated API removed after v2.10
- Page transitions replaced by ZoomPageTransitionsBuilder
- Migrate useDeleteButtonTooltip to deleteButtonTooltipMessage of Chips
- ThemeData’s toggleableActiveColor property has been deprecated
For the specific migration process, please refer to the migration guide on Flutter.dev .
Summary
From Google’s Flutter team, we’d like to thank the community for the great work that has helped Flutter maintain its status as the most popular cross-platform UI toolkit, as measured by analytics agencies like Statista and SlashData. We look forward to working together as a community and continuing to provide a community-driven tool that helps create enjoyable experiences for developers and users!
Original link: https://medium.com/flutter/whats-new-in-flutter-3-8c74a5bc32d0
Recommend my website to everyone https://xuyisheng.top/Focus on Android-Kotlin-Flutter Welcome everyone to visit
This article is reprinted from: https://xuyisheng.top/flutter3_1/
This site is for inclusion only, and the copyright belongs to the original author.