[System] You are a Flutter and Dart coding assistant.

[User] In Flutter application, how to write automated UI tests for a accessibility -oriented sliding component (SLIDER) to verify that critical features such as default value, interaction and semantic labels are applied correctly and work as expected?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter Widget tests, how do you render a particular `UseCase` class wrapped in a `MaterialApp` and a `Builder` widget to create a suitable structure for the test environment?


[System] You are a Flutter and Dart coding assistant.

[User] How to automate the deactivated/enabled situations, text scaling behavior, semantic labels and headings covering, in order to automate accessibility tests and especially to verify the accessibility properties of Textfield components, are applied?


[System] You are a Flutter and Dart coding assistant.

[User] In the Flutter test environment, if different types of exceptions (String, FlutterError, and uncaught Future error) are thrown, how do we write test scenarios to show how the tests behave?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, what kind of integration test is designed to measure and compare the ListView's scrolling performance (the number of Janky frames, the average absolute shake, the number of frames) at different screen renewal rates (59Hz and 90Hz) and the frame re-sampling?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter application, how can I configure the integration test results (especially shift fluency data) in a legible and analyzable format (eg JSON) to write the Integration Test Driver to write to a file called`scroll_smoothness_test`?


[System] You are a Flutter and Dart coding assistant.

[User] How to create a full-screen textfield (textfield), which contains too many text and emojis (both family emojis and various facial expressions and hand movements) in Flutter, is created and a unique key to this text field?


[System] You are a Flutter and Dart coding assistant.

[User] How do you implement a performance benchmark in Flutter using `SceneBuilder` to perform dynamic clipping on a static picture containing pre-rendered text paragraphs?


[System] You are a Flutter and Dart coding assistant.

[User] How is this benchmark test designed and applied to measure and optimize text drawing performance by drawing a large number of single -line and multi -line paragraphs to overflow outside the screen, using`Scenebuilder`and`Canvas`in Flutter?


[System] You are a Flutter and Dart coding assistant.

[User] In a Flutter application, how do you automate the performance testing of complex animated opacity changes (e.g., square speed, shake) for the `animated_complex_opacity_perf` route, using a 1-second page load delay and a 10-second test duration?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how to measure the performance of a full screen text field (5 seconds after touched) called`FullScreen_Textfield_Perf`with E2E Macro Performance Test) and how to report the results of this test with the`Macroperfteste2e`auxiliary function?


[System] You are a Flutter and Dart coding assistant.

[User] In a Flutter application, how do you write a multi-page macro performance test called 'gradient_dynamic_perf' that measures gradient performance, navigating between the routes 'kGradientPerfRouteName' and 'kGradientPerfRecreateDynamicRouteName' (using scrollables 'kScrollableName' and 'kGradientPerfScrollableName'), where each page is operated for 1 second, for a total duration of 10 seconds?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how do you write a macro performance test for the opacity peephole column of alpha save layer rows using the macrobenchmarks package?


[System] You are a Flutter and Dart coding assistant.

[User] In a Flutter macrobenchmark test, how do you implement a multi-page end-to-end performance test (`macroPerfTestMultiPageE2E`) for 'opacity_peephole_col_of_rows_perf' using the scrollable routes `kScrollableName` to `kOpacityPeepholeRouteName` and `kOpacityScrollableName` to `kOpacityPeepholeOpacityOfColOfRowsRouteName`?


[System] You are a Flutter and Dart coding assistant.

[User] In a Flutter application, how do you write a multi-page macro performance test named 'opacity_peephole_fade_transition_text_perf' that uses the scroll areas `kScrollableName` and `kOpacityScrollableName` with the routes 'Opacity Peephole' and 'Opacity Peephole Fade Transition Text', and runs for a total duration of 10 seconds?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how do we perform the end-to-end performance test automation using `macroPerfTestMultiPageE2E` for the `opacity_peephole_grid_of_opacity_perf` page, with a 1-second page delay and a 10-second test duration, and which scrollable button routes (`ScrollableButtonRoute`) are used during this test?


[System] You are a Flutter and Dart coding assistant.

[User] In a Flutter application, how do I define the E2E test configuration for the `opacity_peephole_one_rect_perf` macro performance test? The test should switch between the `kOpacityPeepholeRouteName` and `kOpacityPeepholeOneRectRouteName` routes, spending 1 second on each route, for a total duration of 10 seconds.


[System] You are a Flutter and Dart coding assistant.

[User] How to create an end-to-end performance test that measures the performance of a Flutter application for two different routes containing opacity and scrollable widgets, and records these measurements using the `macroPerfTestMultiPageE2E` function?


[System] You are a Flutter and Dart coding assistant.

[User] In a Flutter macrobenchmark, how do you configure and execute an end-to-end performance test for raster cache memory usage (`raster_cache_use_memory_perf`) using `kRasterCacheUseMemory` with a 1-second page delay and a 10-second duration?


[System] You are a Flutter and Dart coding assistant.

[User] Using the Flutter Macrobenchmark test, how to write a test to measure the performance of a touch with a Textfield Widget carrying the`Basic-Textfield`switch and observe that the application remains unresponsively for 5 seconds after this touch?


[System] You are a Flutter and Dart coding assistant.

[User] In a Flutter application, how do you write a macro benchmark test that waits for an `AnimatedImage` widget to reach its 250th frame?


[System] You are a Flutter and Dart coding assistant.

[User] How do I write a Flutter macro performance test named 'animated_placeholder_perf' using the route 'kAnimatedPlaceholderRouteName', with a 1-second page delay and a 5-second test duration, using the minimum code?


[System] You are a Flutter and Dart coding assistant.

[User] In the Flutter application, how to create an macro performance test with a one -second page delay and ten -second test time using the route`kbackdropfilterroutename`named`backdrop_filter_perf`?


[System] You are a Flutter and Dart coding assistant.

[User] "In Flutter application, how to create a test that measures the animation performance with a macro benchmark test by navigation on the'cubic_bezier_perf'route called'Cubic_bezier_perf'route?"


[System] You are a Flutter and Dart coding assistant.

[User] In a Flutter application, how do you create a macro performance test with a 10-second page delay and a 10-second test time using the 'kSimpleAnimationRouteName' route called 'simple_animation_perf'?


[System] You are a Flutter and Dart coding assistant.

[User] In a Flutter application, how do you create a Slider Performance Macro Benchmark Test that uses the route 'sliders_perf' and the route name `kSlidersRouteName`, with a 1-second page delay and a 10-second test duration?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, a macro comparison test to measure text field performance (touch response, keyboard opening, etc.) by waiting for 5 seconds after touching a text field with a "Basic-Textfield" switch?


[System] You are a Flutter and Dart coding assistant.

[User] In the Flutter application, how to create a page that can dynamically display detailed stock information (symbol, last sales price, percentage change, market value) for a particular stock market symbol (for example, "AAPL"), show the loading status and represent the share of stock with an animated arrow and how do you design this page in different contexts (for example, full screen and sub-page)?


[System] You are a Flutter and Dart coding assistant.

[User] How to create a command line tool to archive the Flutter SDK to a specified output directory and optionally upload it to the Google Cloud Storage by using a temporary directory with a certain git revision and branch?


[System] You are a Flutter and Dart coding assistant.

[User] How can we develop a tool that you can create a specific flutter version (specified with Commit hash) and its branch, based on the operating system (Linux, MacOS, Windows) and Dart Architecture (X64, ARM), including pre-compiled and cache SDK archives?


[System] You are a Flutter and Dart coding assistant.

[User] In the Dart test environment, assuming the `FLUTTER_SDK_PATH_WITH_SPACE` environment variable is set to a Flutter SDK path containing a space, write a test to verify how this affects path splitting when the current working directory also contains a space.


[System] You are a Flutter and Dart coding assistant.

[User] How to create an application skeleton that manages different Flutter Check-Outs, launches, cleanses, lists the versions and transition to the next version to create a command line interface (CLI)-based tool to manage and coordinate Flutter SDK versions, and how to transition to the next version?


[System] You are a Flutter and Dart coding assistant.

[User] Create a Dart class `PackageAutoroller` that automatically updates package dependencies for the Flutter framework, regenerates Gradle lockfiles, and creates a pull request on GitHub.


[System] You are a Flutter and Dart coding assistant.

[User] In Dart/Flutter tests, how can we expose the `isA` matcher from the `test` package under the alias `isInstanceOf`, while re-exporting all other functions of the `test` package?


[System] You are a Flutter and Dart coding assistant.

[User] What is the code required to create an end-to-end test that evaluates the performance of the color filter with an unstable child element on Android devices in Flutter Devicelab?


[System] You are a Flutter and Dart coding assistant.

[User] On the iOS platform of the Flutter application, the IMPELLER GRAPHIC MOTOR is activated, while we can apply this scenario as an automated test to measure and analyze its performance in a complex scrolling scenario containing non-intersecting UIKITViews, and how to record the performance metrics (for example, the average framework time, the frame reduction rate), so we can record and report this scenario. Can we determine potential performance bottles and improvement areas in complex interfaces?


[System] You are a Flutter and Dart coding assistant.

[User] Write a Dart script using the `flutter_devicelab` framework to run a combined task of APK plugin tests. The task should test the following Android configurations: a Java plugin, a Kotlin plugin, a Dart-only plugin, and an FFI plugin template.


[System] You are a Flutter and Dart coding assistant.

[User] Write a Flutter devicelab task to test the `flutter drive --route` command on an iOS device. The task should run the integration test located at `dev/integration_tests/ui/lib/route.dart` on the target device, directing it to the route `/smuggle-it`, and verify that the process completes successfully.


[System] You are a Flutter and Dart coding assistant.

[User]
Write a Dart script to upload Flutter performance test results to Skia Perf using the `metrics_center` package. Implement the following functions:
1. `connectFlutterDestination()`: Connects to the Flutter destination using environment variables (`IS_TESTING`, `TOKEN_PATH`, `GCP_PROJECT`, `BENCHMARK_GCP_CREDENTIALS`).
2. `parse()`: Parses the results JSON and benchmark tags into a list of `MetricPoint` objects.
3. `upload()`: Uploads the metric points with the given commit timestamp and task name.
4. `uploadToSkiaPerf()`: Orchestrates the reading of the results file, parsing, and uploading.
5. `metricFileName()`: Generates a formatted metric file name based on task name and benchmark tags.


[System] You are a Flutter and Dart coding assistant.

[User] In Dart, how do you design a reusable, asynchronous function (e.g., `readJsonResults`) that processes the stdout and stderr streams of a running `Process`? The function should extract JSON data delimited by specific start, end, and prefix markers, handle process lifecycle events (such as intentionally terminating the process upon detecting a completion marker), and implement robust error handling for JSON parsing and non-zero process exit codes.


[System] You are a Flutter and Dart coding assistant.

[User] How can we implement a custom `isInstanceOf<T>()` matcher using `isA<T>()` from the Dart `test` package, while exporting the package and hiding the deprecated built-in `isInstanceOf`?


[System] You are a Flutter and Dart coding assistant.

[User] In the Flutter Devicelab test environment, how can we design and implement a test scenario to verify that the `HostAgent` class correctly resolves the dump directory from the `FLUTTER_LOGS_DIR` environment variable, handling both cases where the variable is set and where it is absent?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter Devicelab, how can we write a test suite to evaluate the reliability of `run.dart`? Specifically, we need to test rerun mechanisms (e.g., a test passing on the first attempt, and a test failing all reruns) and ensure that task results are successfully received before the task process shuts down, even under parallel execution, to prevent issues like race conditions, RPC errors, and timeouts.


[System] You are a Flutter and Dart coding assistant.

[User] How do you write unit tests to verify that the `TaskResult` class in Flutter Devicelab correctly serializes and deserializes JSON, preserving the structure for success (with and without data) and failure scenarios?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how can I dynamically place a platform view on a Stack and control its visibility using two different TextButtons with different visual features, managing their dimensions and positions to show/hide the platform view?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, when hosting a native Android view (such as a color-changing button) and creating a full-screen (immersive mode) application suitable for automated testing with Flutter Driver, we can use the `android_driver_extensions` package to enable interaction with native driver commands. What configurations are needed at the start of the application, including hiding the debug banner, and how do you write a complete `main()` function that performs these configurations?


[System] You are a Flutter and Dart coding assistant.

[User] Considering that a Flutter application uses local plugins specific to the Android platform, running it on other platforms may lead to incompatibility issues. How do you design the `ensureAndroidDevice()` function to verify during application initialization whether the code is running on Android, and if not, throw an error explaining this limitation (such as native dependencies) to prevent accidental execution on non-Android platforms?


[System] You are a Flutter and Dart coding assistant.

[User] How can I extend Flutter's `matchesGoldenFile` matcher to support automatic retries (e.g., `matchesGoldenFileWithRetries`) to handle transient issues like minor rendering differences or network delays? The design should allow configuring the number of retries, printing error messages on failure, and handling the asynchronous nature of golden file matching.


[System] You are a Flutter and Dart coding assistant.

[User] Using the Integration Test Framework and a Special Method Channel to test Android accessibility features in flute applications, different UI components (Textfield, Checkbox, Radio, Switch, Popupmenubutton, dropdownbutton, Alertdialog, Appar) Ischecked, Ischeckable, Isenabled, Isfocusable, Isfocuseed, Ispassword, Action, Ignoreredctions, Text, ContentDescriptions, Isheading) and how to confirm the expected user interactions (touch, text input, selection, etc.), the test results to improve the test results. How can we configure the scenarios and provide the automation of these tests?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how can we design a reusable and expandable test application architecture to test and display different UI components (such as selection controls, popups, text fields, and headings)? The architecture should define the route of each component page in a `Map<String, WidgetBuilder>` and use these routes on the home page to dynamically build a list of `MaterialButton` widgets for navigation.


[System] You are a Flutter and Dart coding assistant.

[User] When developing accessibility tests or automation frameworks specific to the Android platform in Flutter, how would you design the platform-specific messaging or command mechanism? Specifically, how would you define `AndroidClassName` and `AndroidSemanticsAction` to facilitate interactions with local Android UI elements (e.g., Checkbox, Button) and Semantics Actions (e.g., click, scroll forward), standardize messaging, and prevent misuse?


[System] You are a Flutter and Dart coding assistant.

[User] How can we systematically test and evaluate basic message exchange scenarios across both known and unknown Flutter platform channels using a custom `ExtendedStandardMessageCodec` (supporting `DateTime` and `Pair` types) as well as standard codecs (`BinaryCodec`, `StringCodec`, `JSONMessageCodec`) in both foreground and background isolates?


[System] You are a Flutter and Dart coding assistant.

[User] How do you design a `Pair` class in Dart that holds two dynamic values (left and right), ensures immutability, and provides a readable `toString()` representation?


[System] You are a Flutter and Dart coding assistant.

[User] In order to delay the initiation of the Flutter application and the display of GalleryApp and to test the performance potentially, design a pre-loading process that allocates large amounts of memory at regular intervals and releases this memory after a while; This process must have adjustable parameters to measure the degree of memory pressure affecting the launch of GalleryApp, and these parameters should include: The amount of memory allocated, frequency of allocation and release timing.


[System] You are a Flutter and Dart coding assistant.

[User] In a Flutter application, how do you create a single central export file (barrel file) to make multiple UI/UX demo files (such as animation, calculator, colors, contacts, cupertino, fortnightly, images, material, pesto, shrine, transformations, typography, and video) easily accessible and reusable across the app?


[System] You are a Flutter and Dart coding assistant.

[User] Create a customizable and scrollable contact details screen in Flutter using a SliverAppBar. The screen should group communication categories (like phone, email, address, and events) using reusable widgets (`_ContactCategory` and `_ContactItem`). It should support different AppBar behaviors (pinned, floating, snapping) and use a custom theme (e.g., Indigo color scheme). Each action (like sending a message or opening a map) should trigger a snackbar notification.


[System] You are a Flutter and Dart coding assistant.

[User] How can I design an iOS-style interface in Flutter using the `CupertinoTextField` widget to create a comprehensive sample application? The application should demonstrate various configurations (such as prefixes, keyboard types, text capitalization, autocorrect, obscured text, default values, and clear buttons) across different scenarios like name, email, location, PIN entry, tags, and chat messages.


[System] You are a Flutter and Dart coding assistant.

[User] In a Flutter application containing multiple demo files (such as `backdrop_demo.dart`, `banner_demo.dart`, etc.), how can we create a single entry point (barrel file) to export all these components and make them easily accessible to the main application to ensure scalability?


[System] You are a Flutter and Dart coding assistant.

[User] Implement the main `ShrineApp` widget and theme configuration for the Flutter Shrine material design study. The app should configure a `MaterialApp` with a custom `ThemeData` (including `kShrineColorScheme` and a custom text theme), an initial route for login, and a home page that uses a `Backdrop` widget controlled by an `AnimationController`.


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter application, how to create and construct a dart file that defines and describes these color values as`Color`objects in order to create a predetermined and consistent color palette, to re-use this color palette in different parts of the application, and to control how to affect the general appearance of the application?


[System] You are a Flutter and Dart coding assistant.

[User] Implement an animated, expandable bottom sheet shopping basket in Flutter using Scoped Model for state management. The implementation should optimize performance and support different screen sizes. Separate the code into reusable components: ExpandingBottomSheet, ProductThumbnailRow, ExtraProductsNumber, ProductThumbnail, and a helper _ListModel.


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how can we design a home screen architecture for a product catalog application where the `HomePage` widget displays a background, foreground, and an expanding bottom sheet, while the `ProductPage` widget dynamically fetches the product list using `ScopedModelDescendant` with `AppStateModel`?


[System] You are a Flutter and Dart coding assistant.

[User] Using Flutter, design a customized login page for a 'Shrine' themed application with username and password input fields. The page should include the 'Shrine' logo and title, a special color palette using `kShrineBrown900`, and beveled-edged text fields and buttons (using basic Flutter widgets instead of custom design system components). Implement a custom AppBar with a back button, and define the functionality for the 'Cancel' and 'Next' buttons to return to the previous page.


[System] You are a Flutter and Dart coding assistant.

[User] How can we implement an AppStateModel using the scoped_model package in Flutter to manage an e-commerce application's state? The model should support listing products, filtering by category, adding/removing products to/from a basket, clearing the basket, and calculating the total cost (including subtotal, shipping fee, and tax). It should load products from a `products_repository.dart` file and handle cases where the available products list is null or empty.


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how do you design a custom themed shopping cart UI that displays products, shows summary information (subtotal, shipping, tax, total), and supports clearing the cart and removing items? Implement this using `scoped_model` for state management with `ShoppingCartPage`, `ShoppingCartSummary`, and `ShoppingCartRow` widgets, integrated with an `ExpandingBottomSheet`, using specific color palettes (such as `kShrinePink50`, `kShrinePink100`, `kShrineBrown900`) and text styles for visual consistency.


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how do you implement a custom `CutCornersBorder` class that extends `OutlineInputBorder`? The class should support custom cut corner sizes, implement `copyWith`, `lerpFrom`, and `lerpTo` for smooth transitions, and override the `paint` method to draw the cut corners while properly handling the input decoration's label gap.


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how do we create a widget to edit a `BoardPoint` on a hexagonal board (represented by Q, R coordinates and color)? The widget should display the point's coordinates in a text label and provide a color selector. It should accept a `BoardPoint` object and an optional color selection callback as parameters. It should integrate the `BoardPoint` data structure from `transformations_demo_board.dart` and the `ColorPicker` widget from `transformations_demo_color_picker.dart`, using the standard color palette `boardPointColors` to allow changing the colors.


[System] You are a Flutter and Dart coding assistant.

[User] How can I write a Flutter widget test to automatically confirm whether the semantic properties (such as button, focused, clicked, and labels) of interactive icons like `Icons.vignette` ('Update border shape') and `Icons.refresh` ('Reset chips') in the `ChipDemo` widget are correctly configured for accessibility?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how do you write a widget test to verify that the UserAccountsDrawerHeader remains at a fixed position while other elements in the Drawer shift their positions when the drawer content is dragged?


[System] You are a Flutter and Dart coding assistant.

[User] Write a Flutter widget test that performs a smoke test on the Flutter Gallery application. The test should navigate through all demos, toggle options (like theme, system default, and sending feedback), and verify the `toStringDeep()` outputs of the widget, render, layer, and focus trees to ensure they do not contain 'Instance of' (missing `toString` overrides), trailing whitespaces, or unexpected empty lines.


[System] You are a Flutter and Dart coding assistant.

[User]
Create a Flutter Driver test skeleton for the Flutter Gallery application to automate performance and stability testing. The setup should use `enableFlutterDriverExtension` with a custom message handler to:
1. Return all gallery demos (`kAllGalleryDemos`) in JSON format.
2. Profile a specific set of pre-defined demos (`kProfiledDemos`) and remove them from the remaining test set.
3. Run and test the remaining untested demos.
The main entry point should run the `GalleryApp` in test mode.


[System] You are a Flutter and Dart coding assistant.

[User] How can you get the performance data collected during Flutter integration tests (for example, frame rendering times, widget build periods) and write it to a JSON file? Specifically, how do you use the `responseDataCallback` in the integration test driver to save the performance data to a file named `e2e_perf_summary`?


[System] You are a Flutter and Dart coding assistant.

[User] In a Flutter application, how do you design and implement test scenarios to verify platform view integration (specifically focusing on thread merging, focus management, and Z-order) on iOS using `UiKitView`? Provide a complete Flutter application that includes a main page with navigation buttons (`platform_view_button`, `unmerge_button`, `platform_view_focus_test`, `platform_view_z_order_test`) and the corresponding test pages (`MergeThreadTestPage`, `FocusTestPage`, `ZOrderTestPage`), enabling the Flutter driver extension if configured.


[System] You are a Flutter and Dart coding assistant.

[User] How can we design and apply an InheritedWidget in Flutter to manage syntax highlighting styles (such as base, number, comment, keyword, string, punctuation, class, and constant styles)? What properties should it include, and how should the update notification mechanism be optimized to rebuild descendant widgets only when styles change?


[System] You are a Flutter and Dart coding assistant.

[User] In a Flutter application, how can we create a custom `IconData` class (e.g., `GalleryIcons`) to use custom symbol fonts for various components (like tooltips, tabs, switches, etc.) instead of relying on a third-party font library?


[System] You are a Flutter and Dart coding assistant.

[User] In a Flutter application, to install and display dynamic feature modules (deferred components), we need a mechanism that manages the loading process, ensures the module is loaded only once, shows a placeholder during installation, builds the specified widget when installation completes, and handles rebuilds correctly. How can we design a reusable and testable widget (`DeferredWidget`) and a placeholder widget to support modularity and dynamic content management, and what are the basic components of this approach?


[System] You are a Flutter and Dart coding assistant.

[User] In the Flutter Gallery application, how can we export all the Material Design component demo files (such as AppBar, Banner, BottomAppBar, etc.) located in 'package:gallery/demos/material/' from a single module or access point (barrel file) so they can be easily accessed by other parts of the application?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how to create a colorful color selective component, which allows the user to choose a color from a predefined color set, visually emphasizes the selected color and reports the color selected through a recall function, to create a customizable color selective component, thus cenuring this color palette horizontally, each color sample will be a clicked button. Should it be designed to convey the color selected through the`ValueChanged <Color>`?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how can we create a reusable widget called `BackLayer` that provides different interactive back layer content for each tab, integrated with a `TabBar` and `TabView` structure? The active tab's back layer should be interactive, while the back layers of other tabs should be inaccessible and unfocused. The implementation should use an abstract widget named `BackLayerItem` (which has an index), listen to changes from a `TabController`, and display the correct `BackLayerItem` while disabling focus on the others.


[System] You are a Flutter and Dart coding assistant.

[User] In a Flutter e-commerce application using the Scoped Model architecture, how do you implement a shopping cart state management class (`AppStateModel`)? The class should handle product listing, filtering by category, adding/removing items, clearing the cart, and calculating the total quantity, subtotal, shipping fee, tax, and total cost, while ensuring the UI updates correctly.


[System] You are a Flutter and Dart coding assistant.

[User] How do you define an immutable `InheritedWidget` class named `LayoutCache` in Flutter to store layout information (such as widget dimensions and positioning) in a `Map<String, List<List<int>>>` structure, allowing easy access throughout the application and updating the widget tree when layouts change?


[System] You are a Flutter and Dart coding assistant.

[User] Write a Flutter integration test for spell checking using `DefaultSpellCheckService` and `EditableText`. The tests should cover: 1. `fetchSpellCheckSuggestions` returning no misspelled words. 2. `fetchSpellCheckSuggestions` returning correct ranges with misspelled words. 3. Gboard composing region behaviors (ignoring or not ignoring). 4. `EditableText` applying `TextField.materialMisspelledTextStyle` to misspelled words when text is entered.


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how to create an application that perceives the opening and closing of the keyboard, as the location of a Textfield in ListView changes, which follows the scroll position and provides a text that shows a text while the keyboard is open, and also provides an interface that can be tested with Flutter driver?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how do you enable the Flutter Driver extension with a handler that returns the default route name using `ui.PlatformDispatcher.instance.defaultRouteName` to identify the current screen in driver tests?


[System] You are a Flutter and Dart coding assistant.

[User] Write a Flutter Driver integration test to verify that a text field (with the key 'minFrameNumber') displays a numeric value. The test should connect the Flutter driver, locate the widget, retrieve its text, verify it is numeric, and handle timeouts.


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, when a TextField is covered by the keyboard inside a ListView, how do we write an integration test to verify that the TextField automatically scrolls into the visible area when the keyboard is shown? Provide a comprehensive test scenario using `flutter_driver` and keys from `integration_ui/keys.dart` that handles scrolling, tapping the TextField, waiting for the keyboard, and asserting the scroll offset changes.


[System] You are a Flutter and Dart coding assistant.

[User] How should the configuration of a `MaterialApp` widget (including a global navigator key, theme, title, and routes) be designed to allow easy manipulation during integration tests, while providing a minimum working interface at startup and the flexibility to change page routes and themes?


[System] You are a Flutter and Dart coding assistant.

[User] Using Flutter Integration Tests, write a test scenario for `web_e2e_tests/profile_diagnostics_main.dart`'s `main()` function. When the function is run, a `TypeError` exception is triggered in the application. How can we write an integration test to verify that this exception is captured as expected and the test passes?


[System] You are a Flutter and Dart coding assistant.

[User] How can we design and implement Flutter Web integration tests to verify the behavior of text fields (such as TextFormField and SelectableText) and their interaction with the web platform? The tests should cover scenarios like focus, data input, keyboard events (e.g., Enter key, Tab transitions, and Tab transitions with CapsLock active), and read-only text selection, ensuring that native input/textarea elements behave correctly in the Flutter layer.


[System] You are a Flutter and Dart coding assistant.

[User] In this Flutter application, it is aimed to create and display visuals using Display P3 color space with different methods (for example,`Image.MeMory`,`Custompaint`,`Drawimage`,`Container`and various gradians). In this context, whether the application provides the expected color accuracy and viability on devices and screens that support the Display P3 color space, in particular, different visual creation methods (Raster image, Drawn image, Containers, Linear Gradients, Radial Gradients, Radial Gradients, Conial Gradients, Sweep Gradients) What we should use in the devices that do not support the Display P3 color profile (SRGB), the performance of the application (especially when the`Drawimage`and`Imagefilterred`used) and how these visuals behave in different screen brightness and contrast settings?


[System] You are a Flutter and Dart coding assistant.

[User] How can we implement an undo and redo system for focus management in Flutter using a custom `ActionDispatcher` (e.g., `UndoableActionDispatcher`), custom `Action`s, and `Intent`s? Show how to integrate this into an application with keyboard shortcuts, and how to synchronize the 'UNDO' and 'REDO' buttons in the UI with the active/disabled states of the undo/redo stack.


[System] You are a Flutter and Dart coding assistant.

[User] How can you create a Flutter application that dynamically controls and visualizes UI features like VisualDensity, TextScaler, Animation Speed (timeDilation), and RTL language support? Implement this using an `OptionModel` class (extending `ChangeNotifier`) and an `Options` widget to adjust these settings, and display their effects on common widgets like ListTile, TextField, Chips, Buttons, Checkbox, Radio Button, and IconButton.


[System] You are a Flutter and Dart coding assistant.

[User] In a Flutter application, create a sample application demonstrating advanced focus management. The app should handle keyboard navigation (Tab, Shift+Tab, and arrow keys), control focus order using a `FocusTraversalGroup` with a `ReadingOrderTraversalPolicy`, prevent certain widgets from requesting focus, log focus changes, and visualize the focus tree using `debugDumpFocusTree()`. Implement custom `DemoButton` widgets with `FocusNode` and `autofocus` properties, and show how `KeyEvent`s affect focus behavior within a `FocusScope`.


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how can I ensure that ElevatedButton, TextButton, and IconButton widgets are emphasized with a different color (such as orange) when they receive focus? Additionally, how can I configure different focus styles for both filled and framed (outlined) TextField widgets?


[System] You are a Flutter and Dart coding assistant.

[User] How can we write a Flutter smoke test for the `color_testing_demo` application that mocks HTTP image requests using `createMockImageHttpClient`, pumps two initial frames, performs two scroll/drag gestures, and verifies basic functionality?


[System] You are a Flutter and Dart coding assistant.

[User] Write a Dart class that wraps the Android Debug Bridge (ADB) to automate UI testing on a specific Android device (by serial number, emulator, or physical device). The class should support common operations like taking screenshots, tapping coordinates, sending home key events, and disabling animations. It must use dependency injection (e.g., via a ProcessManager) to facilitate testing, handle both string and binary command outputs, and manage device connection errors.


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, during the postsubmit stage of Skia Gold-based visual regression tests, how do we handle a SkiaException to ensure it is transformed into a TestFailure? Specifically, how is a fake SkiaGoldClient used to design and apply this test scenario so developers can quickly identify failures?


[System] You are a Flutter and Dart coding assistant.

[User] How can we design and implement a command-line tool in Dart to automatically manage, update, and verify the relationship between Material Design 3 design tokens and Flutter Material library components (such as AppBar, Buttons, Chips), reporting both token usage statistics and version compatibility?


[System] You are a Flutter and Dart coding assistant.

[User] How can we create a customizable `BottomAppBarTheme` template for a Flutter application adhering to the Material Design 3 specification, using `md.comp.bottom-app-bar` design tokens? Specifically, show how to implement a `TokenTemplate` class that generates the default values, integrates with `ColorScheme`, and uses `AutomaticNotchedShape` for the underlying shape.


[System] You are a Flutter and Dart coding assistant.

[User] How can we implement a code generator template class `BottomSheetTemplate` in Dart that extends `TokenTemplate` to generate Material Design 3 (M3) default configurations (`BottomSheetThemeData`) for a Bottom Sheet using design tokens?


[System] You are a Flutter and Dart coding assistant.

[User] How can I design a code generator in Flutter for Material Design 3 (M3) to dynamically generate a customizable checkbox theme (`_${blockName}DefaultsM3` extending `CheckboxThemeData`) using a token-based template system? The generator should handle different states (disabled, selected, error, pressed, hovered, focused) and properties (border, fill color, check color, overlay color, splash radius, tap target size, visual density, shape) using helper functions like `getToken()` and `componentColor()`.


[System] You are a Flutter and Dart coding assistant.

[User] Create a Dart code generator class `ChipTemplate` that extends `TokenTemplate` (defined in `template.dart`). This generator should output a Material Design 3 `ChipThemeData` subclass (`_${blockName}DefaultsM3`) for a "Flat" filter chip variant. The generated code must resolve design tokens for elevation, shape, colors, typography, icon theme, and borders, handling both enabled and disabled states, and adjusting label padding based on the text scaling factor.


[System] You are a Flutter and Dart coding assistant.

[User] In the Flutter Material 3 theme system, we can use templates to generate customizable and reusable dialog themes derived from design tokens. Show how to implement `DialogTemplate` and `DialogFullscreenTemplate` classes extending `TokenTemplate` to handle design tokens (colors, typography, shadows, shapes, etc.) for standard and full-screen dialog variations, transforming these tokens into default values in accordance with Material 3 specifications for `DialogThemeData`.


[System] You are a Flutter and Dart coding assistant.

[User] Create a Dart class named `DrawerTemplate` that extends `TokenTemplate` to generate a Material Design 3 (M3) compliant `DrawerThemeData` subclass. The generated class should resolve design tokens for `backgroundColor`, `surfaceTintColor`, `shadowColor`, `elevation`, `shape`, and `endShape`, handling text direction (LTR/RTL) correctly for the shapes.


[System] You are a Flutter and Dart coding assistant.

[User] How can I implement a `TokenTemplate` subclass in Dart to automatically generate Material Design 3 default theme classes (`_Circular${blockName}DefaultsM3` and `_Linear${blockName}DefaultsM3`) for Flutter's progress indicators, using design tokens for colors, track thickness, and gaps?


[System] You are a Flutter and Dart coding assistant.

[User] Create a Dart class `RadioTemplate` that extends `TokenTemplate` to generate the Material 3 defaults for a Flutter `Radio` widget. The template should output a `_RadioDefaultsM3` class implementing `RadioThemeData`, mapping Material Design 3 tokens (like `md.comp.radio-button.selected.icon` and state layers) to colors using the `componentColor` helper for various states (selected, unselected, disabled, pressed, hovered, focused).


[System] You are a Flutter and Dart coding assistant.

[User] How can we design a Dart template engine class `SegmentedButtonTemplate` that generates `SegmentedButtonThemeData` defaults based on design tokens, handling various states (disabled, selected, pressed, hovered, focused) using `MaterialStateProperty` and resolving state colors?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter's Material Design 3 token-based generation system, how do you design a class named `SnackbarTemplate` that inherits from `TokenTemplate`? This class should manage token groups, access `BuildContext` to retrieve theme and color scheme information, and generate a `SnackBarThemeData` object using helper methods like `componentColor`, `textStyle`, `elevation`, and `shape`.


[System] You are a Flutter and Dart coding assistant.

[User] Create a new class called `SurfaceTintTemplate` that extends `TokenTemplate` (defined in `template.dart`). Override its `generate` method to return a string containing a constant list `_surfaceTintElevationOpacities` of `_ElevationOpacity` objects. These objects should represent Material Design surface tint elevations from level0 to level5, dynamically retrieving elevation values using the `getToken` function with corresponding opacity values (0.0, 0.05, 0.08, 0.11, 0.12, 0.14).


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how can you create a template to dynamically generate a Material Design 3 (M3) Switch component configuration, including state-based color variations (disabled, selected, pressed, hovered, focused) for the thumb, track, outline, overlay, and icon, based on design tokens?


[System] You are a Flutter and Dart coding assistant.

[User] In Dart, design a system to track tokens (e.g., design tokens, API switches) used across different application versions, identifying unused or missing tokens, and reporting this usage to both the console and a file. Explain how to design this system using `_versionMap`, `_usedTokens`, and `_unavailableTokens` with appropriate data structures (Map, Set, SplayTreeSet) and how to initialize, update, query, and report this information in both verbose and summary formats. How do you emphasize the version information?


[System] You are a Flutter and Dart coding assistant.

[User] How do you design a Dart code generator that creates a C++ header file defining the mappings for physical and logical keys (using USB HID codes and logical values in hexadecimal format) based on a template file named `key_codes_h.tmpl`?


[System] You are a Flutter and Dart coding assistant.

[User] In a Flutter project, we need to develop a high-performance, error-resistant, and flexible command-line tool to process localization resources. The tool should: 1) Load ARB files from a directory and map their key-value pairs and attributes into `Map` data structures keyed by `LocaleInfo` objects. 2) Automatically derive appropriate script codes based on language and country code combinations (e.g., zh_CN to Hans). 3) Parse command-line arguments to configure options such as overwriting files, removing undefined localizations, and generating code specifically for Material, Cupertino, or Widgets. Write the Dart implementation for this tool, including the `LocaleInfo` class, ARB loading logic, and argument parsing.


[System] You are a Flutter and Dart coding assistant.

[User] Write a Dart test suite to verify the behavior of the Flutter SDK's `update_engine_version` script. The tests should cover how `bin/cache/engine.stamp` and `bin/cache/engine.realm` are updated under various conditions, including environment variables like `FLUTTER_PREBUILT_ENGINE_VERSION` and `FLUTTER_REALM`, local Git configurations (upstream/origin), and platform differences.


[System] You are a Flutter and Dart coding assistant.

[User] Write a Flutter framework integration test to verify that children of a `MultiChildRenderObjectElement` (such as a `Row`) show up in the timeline tracing when `debugProfileBuildsEnabled` is enabled. Use `ZoneIgnoringTestBinding` to manage the test environment, and ensure the test is skipped in browser environments.


[System] You are a Flutter and Dart coding assistant.

[User] In the context of Flutter GPU, explain and demonstrate how the `CommandBuffer` class manages GPU commands, interacts with `GpuContext`, supports the creation of `RenderPass`, handles error management, and supports asynchronous completion. Provide a Dart implementation of the `CommandBuffer` class demonstrating these mechanisms.


[System] You are a Flutter and Dart coding assistant.

[User] In the Flutter GPU library, how should the `ColorAttachment`, `DepthStencilAttachment`, `RenderTarget`, and `RenderPass` classes be structured and verified to support multisample anti-aliasing (MSAA) and depth/stencil attachments? Provide an implementation that includes validation logic for texture formats, dimensions, sample counts, storage modes, and combinations of `LoadAction` and `StoreAction`, and show how these classes integrate with the native layer via functions like `_setColorAttachment` and `_setDepthStencilAttachment`.


[System] You are a Flutter and Dart coding assistant.

[User] Provide the Dart implementation of the `RenderPipeline` class in the Flutter GPU package, demonstrating how it is initialized in the native layer through the `_initialize` method, how errors during initialization are handled, and how vertex and fragment shaders are referenced.


[System] You are a Flutter and Dart coding assistant.

[User] In the `dart.ui` library, design and implement the `KeyData` class along with `KeyEventType` and `KeyEventDeviceType` enums to represent keyboard events. Implement helper methods like `_nonValueBits` to extract platform-specific logical key code planes, `_logicalToString` to format logical keys, `_escapeCharacter` and `_quotedCharCode` for character representation, and `toString` / `toStringFull` for debugging output.


[System] You are a Flutter and Dart coding assistant.

[User] Automating the Flutter Web Engine's compilation and testing processes, various sub-commands (Build, Clean, RollfallbackFonts, Generatebuilderjson, Licenses, Test) through compilation, cleaning, updating font backups, Builder. In order to develop a modular and tested tool designed to close the command line arguments by listening to SIGINT and Sigterm signals and to process command line arguments, how should a command line interface (CLI) structure be designed for this tool, how to integrate error management and signal processing and sub-commands?


[System] You are a Flutter and Dart coding assistant.

[User] Considering the various start scenarios (e.g., direct `autoStart`, initiation via `FlutterAppRunner`, and multi-view support) for initiating and managing a Flutter Web application, how would you design and organize the `AppBootstrap` class? Specifically, implement the `_initializeEngine`, `_runApp`, `prepareEngineInitializer`, `_prepareAppRunner`, and `_prepareFlutterApp` functions to handle initialization order and different start configurations efficiently.


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, design a `CkVertices` class optimized for drawing and processing complex geometric shapes using CanvasKit. The class should support vertex positions in different data formats (such as `ui.Offset` lists or direct `Float32List`), texture coordinates, colors, and indices, converting them into the expected formats. It must verify data integrity (e.g., matching list lengths, index validity), manage the creation and garbage collection of CanvasKit `SkVertices`, and control the lifecycle of these objects to optimize memory release. Detail the API design (factory constructors, properties, methods) and internal structure (data storage, transformation, error handling, resource management).


[System] You are a Flutter and Dart coding assistant.

[User] Flutter'da `ui.ColorFilter` arayüzünü uygulayan `EngineColorFilter` sınıfını, farklı renk filtreleme türlerini (mode, matrix, linearToSrgbGamma, srgbToLinearGamma) destekleyecek ve bu filtrelerin dahili gösterimini, yapılandırılmasını ve metinsel açıklamasını sağlayacak şekilde nasıl tasarlarsınız?


[System] You are a Flutter and Dart coding assistant.

[User] While interacting with JavaScript in Dart, especially when working with typed arrays such as `Uint8Array`, how can we create a safe and efficient abstraction layer that represents and manages the `Uint8Array` structure directly in Dart code? Specifically, we want to expand the existing `JSTypedArray` interface, create `Uint8Array` objects, create a sub-array on these objects, copy the source array, and access the length using the `dart:js_interop` library.


[System] You are a Flutter and Dart coding assistant.

[User] Implement the Flutter Web Engine's layer tree and platform view styling system. Your implementation should include `PictureEngineLayer`, `LayerOperation` (with `pre`, `post`, and `mapRect` methods), `PlatformViewStyling` for positioning and clipping platform views, and `LayerBuilder` to efficiently manage and slice layers with complex visual effects (such as clipping, opacity, filters, and transforms).


[System] You are a Flutter and Dart coding assistant.

[User] In a scenario with multiple Flutter views (e.g., different `HtmlElementView`s) in a Flutter Web application, how does the Flutter framework handle focus management between the DOM elements, especially when users use keyboard navigation? Explain how it determines the focus state and updates each view's `tabindex`, including the role of the `ViewFocusBinding` class and its interaction with `FlutterViewManager`. Which DOM event listeners (`focusin`, `focusout`, `keydown`, `keyup`) are used, and how do they manage the Shift key to change direction and handle focus exchange events?


[System] You are a Flutter and Dart coding assistant.

[User] Implement a flexible, platform-agnostic rounded rectangle (`RRect`) rendering system in Dart. Define an abstract `RRectRenderer` class that handles the geometry calculations for drawing rounded rectangles (including scaling radii and handling clockwise/anticlockwise drawing), and provide concrete implementations for rendering to a Canvas (`RRectToCanvasRenderer`), a Flutter Path (`RRectToPathRenderer`), and a metric-gathering callback system (`RRectMetricsRenderer`).


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter Web's engine semantics, how can we dynamically assign, update, and remove ARIA roles and attributes (such as `aria-checked` and `aria-disabled`) for checkable components (checkboxes, radio buttons, and switches) based on `SemanticsObject` flags and enabled states, and how is focus managed for these components?


[System] You are a Flutter and Dart coding assistant.

[User] How can we implement `SemanticTab`, `SemanticTabPanel`, and `SemanticTabList` classes extending a base `SemanticRole` class in Dart to support screen readers with proper ARIA roles ('tab', 'tabpanel', 'tablist') and focus management via `focusAsRouteDefault`?


[System] You are a Flutter and Dart coding assistant.

[User] How do you design and implement a custom `Uint8Buffer` class in Dart that provides a dynamically sized list structure backed by `Uint8List`? The design should maximize memory efficiency and processing speed, support basic list operations (adding, inserting, resizing, range operations), handle automatic capacity growth, fill with default values, and include proper bounds and error checking.


[System] You are a Flutter and Dart coding assistant.

[User] How do you design and implement the abstract MessageCodec and MethodCodec interfaces, the MethodCall data structure, and platform exception classes for Flutter's binary messaging protocol in Dart?


[System] You are a Flutter and Dart coding assistant.

[User] Implement the `SkwasmImage` class in Dart for the SKWASM engine. The implementation should demonstrate: 1) memory management using `SkwasmFinalizationRegistry`, 2) copying pixel data from a `Uint8List` in a factory constructor, and 3) converting to PNG in `toByteData` using `DomImageBitmap`, `DomOffscreenCanvas`, and `DomBlob`.


[System] You are a Flutter and Dart coding assistant.

[User] Explain and demonstrate how to design Dart FFI bindings for the SKIA WebAssembly (SKWASM) engine to manage Paint objects and their effects (shaders, image filters, color filters, mask filters). Specifically, show how to bind `paint_create`, `paint_dispose`, `paint_setShader`, `paint_setImageFilter`, `paint_setColorFilter`, and `paint_setMaskFilter` using `@Native` syntax and appropriate handle types like `PaintHandle`, `ShaderHandle`, etc.


[System] You are a Flutter and Dart coding assistant.

[User] Create Dart FFI bindings for Skwasm (Skia WebAssembly) to manage PictureRecorders and Pictures. Implement bindings for creating, disposing, beginning/ending recording, and getting cull rects/approximate bytes used, using `@Native` annotations.


[System] You are a Flutter and Dart coding assistant.

[User] Create Dart FFI bindings using `@Native` annotations to interface with a C++ WebAssembly library (`skwasm`) for managing `LineMetrics`. The bindings should include functions to create, dispose, and retrieve properties of `LineMetrics` (such as hardBreak, ascent, descent, unscaledAscent, height, width, left, baseline, lineNumber, startIndex, and endIndex) using `isLeaf: true` for performance.


[System] You are a Flutter and Dart coding assistant.

[User]
In a Flutter graphics engine using WebAssembly (WASM), how can we implement the abstract Flutter UI layer classes (`ui.Shader`, `ui.Gradient`, `ui.FragmentProgram`, and `ui.ImageShader`) using Skwasm equivalents (`SkwasmImageShader`, `SkwasmFragmentProgram`, `SkwasmFragmentShader`)? Specifically, how do we handle:
1. Memory management (especially using `SkwasmFinalizationRegistry` and WASM disposal functions like `runtimeEffectDispose`).
2. Interfacing with WASM functions (e.g., `runtimeEffectCreate`).
3. Converting Dart native data types to WASM-expected types (e.g., `convertPointArrayToNative`, `convertColorArrayToNative`, `convertMatrix4toSkMatrix`).
4. Managing state changes (e.g., `setFloat`, `setImageSampler`) and disposal processes in `SkwasmFragmentShader`?


[System] You are a Flutter and Dart coding assistant.

[User] Design a singleton class `BrowserAutofillHints` in Dart to map Flutter autofill hints (e.g., 'birthday', 'creditCardNumber') to standard HTML autofill values (e.g., 'bday', 'cc-number') for web platforms. The class must include a method `flutterToEngine` that takes a Flutter-specific autofill hint string, returns the corresponding HTML autofill value if a match exists, and returns the original hint if no match is found.


[System] You are a Flutter and Dart coding assistant.

[User] How can we validate geometric and transformational data structures in Dart (such as `ui.Rect`, `ui.RRect`, `ui.RSuperellipse`, `ui.Offset`, `Float32List` for Matrix4, and `ui.Radius`) to prevent invalid values (especially NaN), and verify the compatibility of `Color` and `colorStops` lists for gradients?


[System] You are a Flutter and Dart coding assistant.

[User] In a Flutter web application, how do you design an `EmbeddingStrategy` abstract class with a factory constructor `EmbeddingStrategy.create` that dynamically selects between a `CustomElementEmbeddingStrategy` (when a `DomElement` host is provided) and a `FullPageEmbeddingStrategy` (when it is null)? The class should also define members for `hostElement`, `globalEventTarget`, and `attachViewRoot`.


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter web applications, how do you create a reliable and expandable `BrowserDetection` class as a singleton? The class should identify different browser engines (Blink, Webkit, Firefox) and operating systems (iOS, Android, Linux, Windows, MacOS) using the user agent, vendor, and platform information. It should also support testability via overrides (e.g., `@visibleForTesting` annotations, `debugUserAgentOverride`, `debugBrowserEngineOverride`, `debugOperatingSystemOverride`) and handle WASM environments using `const bool.fromEnvironment('dart.library.html')`.


[System] You are a Flutter and Dart coding assistant.

[User] Using Canvaskit in Flutter, we can test the visual accuracy and performance in a comprehensive way in case of interacting with the combination and invisible platform views of the`backdropfilter`widget widget in different scenarios, especially in the edges, and the visual accuracy and performance of the platform during these tests. By comparing the results of these tests with gold pictures, how can we be sure that these features work consistently on various devices and browsers?


[System] You are a Flutter and Dart coding assistant.

[User] In the test scenarios that uses the Canvaskit rendering engine in the Flutter web application, the Canvaskit variant (such as Chromium, Full, Auto) is correctly adjusted and how it can be temporarily changed through the`debugoverridejsconfiguration`function, and these changes are not permanent in the test environment and to restore the original Canvaskit variant Write a test scenario that explains in detail how the Canvaskite variant configuration is manipulated and verified in test processes.


[System] You are a Flutter and Dart coding assistant.

[User] Write a comprehensive suite of unit tests for the `HtmlViewEmbedder` in Flutter's CanvasKit web renderer. The tests should cover embedding interactive platform views, clipping with RRects, transforms, offsets, device pixel ratio conversions, overlay rendering and reuse, DOM node cleanup, invisible views, overlay optimization, and resource disposal.


[System] You are a Flutter and Dart coding assistant.

[User]
Analyze the provided Dart code, which tests CanvasKit image processing in Flutter Web. Explain:
1. The overall purpose of the code.
2. The testing strategy for different image formats (JPEG, PNG, GIF, WebP, BMP) and loading methods (URL, byte arrays, ImageBitmap).
3. How it handles specific scenarios like CORS errors, AVIF format detection, and animated GIFs.
4. How the test assertions (dimensions, color space, byte data) confirm correctness.
5. How these tests help maximize image processing performance and accuracy in a CanvasKit-based Flutter web application.


[System] You are a Flutter and Dart coding assistant.

[User] In order to ensure that the Flutter Web application initializes basic services (such as engine initialization and user interface startup) at the expected times, we separately call the `initializeEngineServices` and `initializeEngineUi` functions. To verify that this separation works correctly and to control the results of `RawKeyboard.instance`, `KeyboardBinding.instance`, `EnginePlatformDispatcher.instance.implicitView`, and `domDocument.querySelector('flt-glass-pane')` (checking for potential issues like out-of-order services or incomplete dependencies), write a test that demonstrates this distinction and verifies the state of these components before and after each initialization step.


[System] You are a Flutter and Dart coding assistant.

[User] How do you design and implement a Flutter CanvasKit integration test to verify that the 'flutter/skia' platform channel correctly handles the 'Skia.setResourceCacheMaxBytes' method call, including encoding/decoding with JSONMethodCodec and asserting a successful response?


[System] You are a Flutter and Dart coding assistant.

[User] Write a Flutter web engine test using CanvasKit to verify how changes in the device pixel ratio and physical size adjustments affect the RenderCanvas and rasterizer frame sizes. The test should demonstrate updating the canvas logical size when the device-pixel ratio changes, rounding physical size to the nearest integer, and utilize test helper functions such as `setUpCanvasKitTest`, `newBitmap`, and `renderScene`.


[System] You are a Flutter and Dart coding assistant.

[User] Explain and demonstrate via tests how the Flutter Web CanvasKit engine selects its rasterization strategy (OffscreenCanvasRasterizer vs. MultiSurfaceRasterizer) across different browsers (Chrome, Firefox, Safari) and configuration options like `canvasKitForceMultiSurfaceRasterizer`. Additionally, show how the engine optimizes rendering across multiple EngineFlutterView instances, specifically verifying that intermediate frames are skipped and only the first and last LayerTrees are rendered.


[System] You are a Flutter and Dart coding assistant.

[User] Write a comprehensive Dart test suite for the Flutter Web Engine's CanvasKit `Surface` class. The tests should cover scenarios such as surface size changes, device pixel ratio changes, WebGL context loss and restoration, `transferToImageBitmap` usage, and `MakeGrContext` failures. Demonstrate how to handle error processing, performance optimization, and lifecycle management of objects like `BitmapSize`, `CkSurface`, `DomOffscreenCanvas`, and `DomCanvasElement`. Utilize helper functions and configurations such as `setUpCanvasKitTest()`, `debugOverrideDevicePixelRatio()`, `debugOverrideJsConfiguration()`, and the `isDisplayCanvas` flag.


[System] You are a Flutter and Dart coding assistant.

[User] Provide Dart constants representing common test images (such as a transparent image, a 4x4 PNG, an animated GIF, and a translucent PNG) as Uint8List byte arrays for Flutter testing.


[System] You are a Flutter and Dart coding assistant.

[User] Write unit tests for the Flutter Web Engine's `ViewFocusBinding` class. The tests should verify its impact on `EnginePlatformDispatcher` and `EngineFlutterView` when multiple views are present. Ensure it accurately manages keyboard accessibility, focus transitions, and the expected focus/focal loss behaviors of the `requestViewFocusChange` method.


[System] You are a Flutter and Dart coding assistant.

[User] In order to ensure the correct creation and interaction of platform views in Flutter Web applications, the `createPlatformViewSlot` function in the `PlatformViewManager` class is used to set up the platform view slot and apply necessary style features (such as `pointer-events`). What test strategies and DOM examination techniques should be used to verify that the slot is rendered correctly, the inner slot's `name` attribute matches the `viewId`, and the auxiliary functions `getPlatformViewSlotName` and `getPlatformViewDomId` return the expected values?


[System] You are a Flutter and Dart coding assistant.

[User] In a Flutter web application, when a virtual click event is created using `EngineFlutterView` and DOM manipulations, considering the hierarchical structure of the event source (Target) and potential text editing interactions, what are the expected behaviors of `computeEventOffsetToTarget` when `offsetX` and `offsetY` values are invalid or the event source is not the root element (e.g., initiated by a text editing area or TalkBack)? How do we verify and test these behaviors across different scenarios?


[System] You are a Flutter and Dart coding assistant.

[User] In order to ensure that the Rawkeyboard API on the Flutter Web, in different operating systems (especially MacOS and Linux) and different keyboard event scenarios (IME composition, commodity keys, shortcuts, repetitive events), which test scenarios and verification strategies should be used, especially the platform messages are sent to the Flutter engine. To determine whether the default browser behavior (for example, for TAB button) is prevented or prevented as expected?


[System] You are a Flutter and Dart coding assistant.

[User] In a Flutter web application, when embedding Flutter in an existing HTML element using the `CustomElementEmbeddingStrategy` class, how does this strategy manipulate the target element and the Flutter glass pane? Provide a Dart test suite that verifies the behavior of `CustomElementEmbeddingStrategy` regarding the `flt-embedding` attribute, `isConnected` status, CSS styles (`position`, `display`, `width`, `height`, `overflow`, `touch-action`), and parent-child relationships.


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter Web, how can we design and test the `HotRestartCacheHandler` class and the `registerElementForCleanup` function to maintain DOM consistency during Hot Restarts, minimizing memory leaks and performance issues across different browsers? Provide a Dart test implementation.


[System] You are a Flutter and Dart coding assistant.

[User] Write comprehensive unit tests in Dart using the `test` package to verify the behavior of `dart:ui` classes such as `Offset`, `Size`, `Rect`, `RRect`, and `Radius`. The tests should cover comparison operators, corner rounding, geometric procedures (like intersection and expansion), and edge cases such as NaN values, negative radii, zero dimensions, and extreme dimensions.


[System] You are a Flutter and Dart coding assistant.

[User] In Dart's `dart:ui` library, how can we configure and verify unit tests to ensure that the static `Image.onCreate` and `Image.onDispose` callbacks are invoked exactly once per image creation and disposal?


[System] You are a Flutter and Dart coding assistant.

[User] In Dart/Flutter, write a comprehensive test suite using `package:test` to verify the behavior of `instantiateImageCodec` and `decodeImageFromPixels` when performing image sizing and scaling. The tests should cover the effects of `targetWidth`, `targetHeight`, and `allowUpscaling` parameters, how invalid parameters (such as negative dimensions) are handled, and the assertion errors that occur when scaling is not allowed.


[System] You are a Flutter and Dart coding assistant.

[User] In Dart, I would like to write code that first clips a rectangle and then converts this clipped space into a picture, using `PictureRecorder`, `Canvas`, and `toImage` to create a picture of a certain size (e.g., 10x10). I want this code to include a unit test that confirms that the picture created is of the `Image` type and calls the `dispose` method to release the resources of the picture. How should I define `_createImage` and `_createPicture` functions correctly and write a complete unit test to confirm they run correctly?


[System] You are a Flutter and Dart coding assistant.

[User] How can I write a comprehensive test suite in Dart to verify the behavior of the `dart:ui` library's `ParagraphBuilder` and `Paragraph` classes? The tests should cover building and laying out a paragraph, verifying that calling `pushStyle()` after `build()` throws an error, retrieving text boxes using `getBoxesForRange()`, and computing line metrics using `computeLineMetrics()`.


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, different fonts (height, width, baseline, line boundaries, glyif knowledge, etc.) of the`Paragraph`object ('AHEM','Fluttertest'), text directions (LTR, RTL), Line, Number, Line end, text end) and various text. How is a comprehensive and automated test package designed and applied to verify that it calculates and reported in the figure, how the expected values of these tests are precisely determined in the scenario of each text layout, and these tests, the potential edge situations that may affect the performance and determination of the`paragraph`object (empty paragraphs, deported paragraphs, unlawful indexes, etc.


[System] You are a Flutter and Dart coding assistant.

[User] For the Shader tests of a Flutter application, starting from the build directory specified by the `FLUTTER_BUILD_DIRECTORY` environment variable, a fixed path `gen/flutter/lib/ui/fixtures/shaders` and a dynamic subfolder name (`leafFolderName`) are used to construct a directory path. How can we implement a platform-independent and robust function to construct this directory path in Dart, and what prerequisites are required for its correct operation?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, text processing and style features (such as FontWeight, ParagraphStyle, TextStyle, TextHeightBehavior, TextRange, GlyphInfo, FontFeature, and FontVariation) must be thoroughly tested to ensure correct implementation. Create a comprehensive test suite covering various scenarios, edge cases, and potential error conditions. The tests should configure and verify file reading, font loading, paragraph creation, style application, and output verification to ensure Flutter's text rendering infrastructure is highly reliable and accurate.


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, when using low-level `dart:ui` APIs, how can we design an `AnimatedColorSquareScenario` class and a `_NumberSwinger` helper class to animate a moving, color-changing square? Specifically, how do we use `SceneBuilder` and handle screen size changes in the `onMetricsChanged` method to ensure the square remains within the screen boundaries?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, to create a monochrome blue background and constantly redraw it in each frame by extending a custom `Scenario` class, how are `SceneBuilder`, `PictureRecorder`, `Canvas`, and `Picture` objects used? In the `onBeginFrame` method, how is the blue background drawn using the `Color` class, how is the created scene rendered, and how are memory leaks prevented?


[System] You are a Flutter and Dart coding assistant.

[User] "In the Flutter Engine store, in order to verify the SKIA Gold integration and detect errors, in the given directory (e2e_fixtures), the square visuals of various colors (solid_blue_square.png, solid_red_red_square.png, solid_green_square.png) Design the process and apply it, this process should check whether the SKIA Gold client is available, to upload the necessary identity to the SKIA Gold, to report and summarize the comparisons of the loading and comparison, and the failure of this test process (for example, should be stated in detail how to handle it with appropriate error codes and messages, and outlines how this process can be expanded for different visuals and test scenarios in the future.


[System] You are a Flutter and Dart coding assistant.

[User] Write a Dart script that verifies the exported symbols of Flutter engine shared libraries (`Flutter.framework`, `libflutter.so`, and `libflutter_engine.so`) across iOS, Android, and Linux platforms using the `llvm-nm` tool.


[System] You are a Flutter and Dart coding assistant.

[User] Flutter framework's descriptions of different platforms (Dart UI, Web UI, C ++, Java) enum definitions (AccessibilityFeatural, Semanticsaction, ApplifecyClestate, Semanticsflag) and Native APIs (especially`natifunctionbody``natifunctionbody`s) To verify the use, which test strategies and code analysis techniques do you use, and these strategies can detect API mismatch or misuse between Flutter's different layers (for example, nullable simple data types to native functions), and how comprehensively you can automatically correct these problems to the developers?


[System] You are a Flutter and Dart coding assistant.

[User] For the Flutter engine repository, how do you write an automated test to ensure that the `HeaderFilterRegex` in the `.clang-tidy` file covers all non-excluded root directories?


[System] You are a Flutter and Dart coding assistant.

[User] In Dart, demonstrate how to define and use compile-time constant instances (const instances) of a custom `Target` class. Create a comprehensive test scenario that showcases these constants within nested objects, collections (List, Set, Map), and other classes like `IgnoreMe` and `StaticConstInitializer` to illustrate compile-time constancy.


[System] You are a Flutter and Dart coding assistant.

[User] Create a Dart class `BuildPlan` for a Flutter engine build tool (`et`) that parses command-line arguments and environment variables. It should configure build aspects like LTO, RBE, concurrency, and build strategy, while handling validation and invalid argument combinations.


[System] You are a Flutter and Dart coding assistant.

[User] Design a Dart class `TargetPlatform` to represent and validate platform-specific identifiers (e.g., 'android-arm64', 'windows-x64') for Flutter compilation tools. The class should be immutable, use a private constructor to restrict instantiation, and provide robust parsing methods (`parse` and `tryParse`) with clear exception handling.


[System] You are a Flutter and Dart coding assistant.

[User] Write a Dart test using the Flutter Engine tool test infrastructure to verify that the `fetch` and `sync` commands (triggered by `engine_tool`) correctly invoke `gclient sync -D` using a fake process manager and environment.


[System] You are a Flutter and Dart coding assistant.

[User] How do I write a platform-independent Dart test to verify that the `et` executable under the `bin/` directory of the Flutter engine repository runs successfully (e.g., with the 'help' command), using packages like `process_runner`, `platform`, and `path`, and printing detailed stdout/stderr on failure?


[System] You are a Flutter and Dart coding assistant.

[User] Write a Dart application using the `args` and `command_runner` packages to implement git hooks (`post-checkout`, `post-merge`, `pre-push`, `pre-rebase`) for the `flutter/engine` repository. The application should support global options: `--flutter` (absolute path to the engine root, required), `--enable-clang-tidy` (flag to run clang-tidy on changed files), and `--verbose` (flag for verbose logging). It should validate these options and run the sub-commands.


[System] You are a Flutter and Dart coding assistant.

[User] When developing a Flutter command-line interface (CLI) tool, we need a command called 'post-checkout' that runs automatically after updating a Git working tree, reminding the user to run 'gclient sync'. Implement this command using `package:args/command_runner` with the appropriate name, description, and asynchronous execution logic.


[System] You are a Flutter and Dart coding assistant.

[User] Write a Dart command class `PrePushCommand` using `package:args/command_runner.dart` to run checks before a 'git push'. It should integrate formatting tools and Clang-Tidy, support verbose mode, check Clang-Tidy's activation status, configure the Flutter root directory, and output detailed error reports. The command should return a boolean indicating success or failure.


[System] You are a Flutter and Dart coding assistant.

[User] Write a complete Dart command-line application using the 'header_guard_check' package. The application must run asynchronously, accept command-line arguments, and exit with a non-zero code if the check fails.


[System] You are a Flutter and Dart coding assistant.

[User] Write a Dart command-line tool using the `engine_build_configs` and `engine_repo_tools` packages to validate Flutter engine build configurations and the `.ci.yaml` file. It should check for duplicate configurations, invalid build names, and compliance with release build standards. It must support arguments for verbose mode, help, and the engine source path (`--engine-src-path`), and report success/failure status with error messages.


[System] You are a Flutter and Dart coding assistant.

[User] In the Flutter engine repository, write unit tests to verify the structure and content of the `.ci.yaml` file. The tests should parse the YAML data into `CiConfig` objects, validate these configurations, and cover various scenarios (valid, invalid, and missing fields) to ensure correct behavior. How should the tests for `CiConfig` and its related classes be structured?


[System] You are a Flutter and Dart coding assistant.

[User] In Dart, how can we design an `Engine` class to represent and manage a specific file system structure (containing a `src` directory, a `flutter` subdirectory, and an `out` subdirectory)? The design should support testability, different scenarios, a class hierarchy, factory methods, custom exception classes, and methods such as `tryFindWithin`, `outputs`, and `latestOutput` to ensure the structure is verified, located, and managed properly.


[System] You are a Flutter and Dart coding assistant.

[User] In order to facilitate the interaction of the `engine_repo_tools` package with the Flutter engine repository, how should we test the expected behaviors and possible exceptional states of the `Engine` class and its related functions (especially `Engine.fromSrcPath`, `Engine.findWithin`, and `Engine.outputs`)? Specifically, how should these functions behave in invalid or missing engine storage structures and different output directories, and how can we write tests to ensure reliable tools for engine development workflows?


[System] You are a Flutter and Dart coding assistant.

[User] In the Flutter web engine codebase, the 'dart:js_util' and 'package:js' libraries should only be accessed by certain controlled files. Design a Dart test scenario that scans all `.dart` files in the codebase, confirms expected violations (e.g., in a mock file like 'alarm_clock.dart'), allows access only for audited libraries, and can be used in an integration environment to prevent future violations.


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, by using a series of predefined offset points, a Catmull-Rom Spline curve, where we can also determine the start and end points, moves a particular widget (eg a circle) in a animated manner, enabling us to control the speed and fluency of this movement, which can be used to create a repetitive and privatizable animation and the animation techniques should be used. How should we implement that you can work with different curved types (eg`Curves.easeinout`) and different animation times?


[System] You are a Flutter and Dart coding assistant.

[User] Create a Flutter application demonstrating `CupertinoContextMenu.builder` on a yellow container with rounded corners. The menu should contain 'Copy', 'Share', 'Favorite', and 'Delete' actions. Animate the container's decoration using a `DecorationTween` (with `BoxShadow`) up to `CupertinoContextMenu.animationOpensAt` using `CurvedAnimation`.


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how do you create a sample application containing a `ListView` inside a `CupertinoPageScaffold` that demonstrates a basic iOS-style list interface using the `CupertinoListTile` widget with different variations (title, leading widget, trailing widget, both, two-line head and sub-head, background color) and features (leading widget size, key use)?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how do we configure a list of `CupertinoRadio` widgets inside `CupertinoListTile` elements to create a selectable list of radio buttons? Specifically, how do we configure the `groupValue`, `value`, `onChanged`, and `toggleable` properties of `CupertinoRadio`, and update the interface using `setState` so that clicking an already selected option deselects it (updating the `_character` variable to null)?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how do we create a Cupertino application containing a Cupertinosearchtextfield with a Cupertinosearchtextfield that has a "Initial Text" in accordance with the Cupertino style, with a "search" space -standing text, and how to control the value of this search area through the program, and how to remove this text area (Dispose)?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how can I create a CupertinoTextField with a light-themed text controller containing a predetermined starter text, manage the lifecycle of this controller, and place it inside a CupertinoPageScaffold with a CupertinoNavigationBar?


[System] You are a Flutter and Dart coding assistant.

[User] How do I create a complete user interface in Flutter using a CupertinoPageScaffold with a CupertinoNavigationBar titled 'CupertinoFormSection Sample', containing an inset-grouped CupertinoFormSection with multiple CupertinoTextFormFieldRows? The form should validate in real-time (AutovalidateMode.always) and trigger a save on any change using Form.maybeOf(primaryFocus!.context!).


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, Material Design 3 in accordance with the design principles, a special shape Appar (for example, with a sloping edge at the bottom), to show a search text below this Appar (including Indian text, Prefix and Suffix icons), textfield's appearance (border color, filling color, etc.) to be special to the theme colors of the APP and the appari can be specially shifted to the theme colors. What kind of structure should I use to show the list (for example, with ListView.builder) and what roles do`Customappbarshape`class and`preferedsize`widget play in this structure?


[System] You are a Flutter and Dart coding assistant.

[User] Write a Flutter application using Material 3 that features a Large App Bar (with a menu icon on the left, a 'more' icon on the right, and the title 'Large App Bar') inside a CustomScrollView. The scrollable content should be displayed inside a Card, and show how to style this content.


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, using a`autocomplete`widget in the user interface by pulling data from an asynchronous API, using suggestions according to the text of the user entering the text, but the user will take the results of the latest search, and the results of the latest search will always show the results of the latest search query. How do you configure the`Autocomplete`widget, how do you simulate the data using the`_Fakeapi`class, and how do you optimize the performance and scalability of this configuration?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how can we apply an `Autocomplete` widget with an asynchronous data source using a debouncing technique to prevent excessive API calls? Provide a complete implementation where the `optionsBuilder` of the `Autocomplete` widget uses a debounced search function, and a custom timer class manages the delays and cancels pending requests when a new search term is entered rapidly.


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how do we implement an `Autocomplete` widget with an asynchronous data source, a debouncing mechanism, and network error handling? Specifically, we want to ensure that requests are debounced (e.g., by 500ms) to avoid sending a request for each character, and prevent the results of canceled requests from updating the user interface. How should we implement the `_AsyncAutocompleteState` class and relevant helper classes (such as a custom `_DebounceTimer`)?


[System] You are a Flutter and Dart coding assistant.

[User] While developing the Flutter application, at the top of the application, the user is able to report an important message or action (for example, cookie policy approval, update notification or connection problems) and provide user interaction (for example, "accept", "update", "Re -try"), with a customizable background color, content, title symbol and multiple action button and multiplying, but to the user. How do I create a occupying materialbanner component and configure the basic features of this component (content message, symbol, background color, action buttons and the functionality of these buttons)?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, create a customizable `BottomAppBar` and `FloatingActionButton` which are automatically hidden and shown depending on the direction of scroll, allowing the user to control the visibility of the `FloatingActionButton` and the height of the `BottomAppBar`. What are the steps to create a completely functional user interface that uses the Material 3 design language, and how do we apply these steps in accordance with Flutter's best practices?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how do you create a basic BottomNavigationBar structure representing three different tabs (Home, Business, School)? Each tab should display its corresponding text content (e.g., 'Index 0: Home', 'Index 1: Business', 'Index 2: School') and change the color of the selected tab. Please provide a detailed implementation covering the basic application structure (MaterialApp, StatelessWidget, StatefulWidget), BottomNavigationBar creation (items, currentIndex, selectedItemColor, onTap), state management (_selectedIndex, _onItemTapped), and the content list (_widgetOptions).


[System] You are a Flutter and Dart coding assistant.

[User] How do you create a stateful Flutter application with a BottomNavigationBar containing four sections (Home, Business, School, and Settings), each displaying a large text label and having a customized background color when selected?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how can I configure the animation style of a sub-panel (bottom sheet) that is opened using the`showbottomsheet`function with different options (assumed, specially defined times, without animation) and how to change the animation time of the lower panel and the reverse animation time and the reverse animation time. How can I integrate with Widget so that I can update the`sheetanimationStyle`parameter according to the user selection?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, develop a sample application that demonstrates how to customize the opening and closing animations of a Modal Bottom Sheet (including custom duration, reverse duration, and completely disabling the animation) using the `showModalBottomSheet` function's `sheetAnimationStyle` parameter. The user should be able to select the animation style (Default, Custom, or None) using a `SegmentedButton` widget, managing its selection via the `onSelectionChanged` event.


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, using the Material 3 theme, how do you write the minimum, reusable, and understandable code to create a list of three interactive `CheckboxListTile` widgets with 'Headline' titles and varying lengths of 'Supporting Text' subtitles, demonstrating how to align the checkbox to the top of the text using `isThreeLine`?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how do you size and customize the avatar area using the `avatarBoxConstraints` property of the `RawChip` widget? Specifically, when using `BoxConstraints.tightForFinite()` in combination with label texts of different lengths, what is the effect on the appearance and behavior of the `RawChip` widget, and how can we ensure consistent layout behavior?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how do you customize the appearance and behavior of the text selection toolbar buttons (like cut, copy, paste) in a TextField while maintaining platform-adaptive behavior using AdaptiveTextSelectionToolbar and ContextMenuButtonItem? Also, how do you handle web-specific context menu conflicts?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how can we create a fully customized context menu for a TextField that detects if the selected text is a valid email address using Regex, and if so, adds a custom 'Send Email' menu item that opens a dialog? The solution should handle disabling the browser's default right-click menu on the web platform, manage the application lifecycle for this behavior, and use the platform-specific `AdaptiveTextSelectionToolbar`.


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how can I use the `contextMenuBuilder` feature on a `TextField` to create a completely custom context menu (e.g., arranged in a `GridView` with five custom buttons) while disabling the default browser context menu on the web platform? Please provide a complete example showing how to configure the menu's appearance, layout, and button actions.


[System] You are a Flutter and Dart coding assistant.

[User] In a Flutter application, how can I customize the context menu triggered by right-click or long-press in a `SelectionArea` widget to keep default items, add a custom 'Print' action that shows a dialog, and ensure the browser's default context menu is disabled on web when the widget is active and re-enabled when it is disposed?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, explain and write a complete example of how to use `RestorationMixin` and restorable properties to maintain the state of a `DateRangePickerDialog`. Create a `StatefulWidget` named `DatePickerExample` that uses `RestorationMixin` to store the selected date range, open the dialog via a `RestorableRouteFuture`, and restore the selected dates. Explain how this restoration works, including which data is saved and how it is restored.


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how do you create a user interface with a vertical divider (VerticalDivider) and equal-width cards on the left and right sides using the Material 3 design language? The interface should use the main color palette `0xFF6750A4` for the theme, have an AppBar titled 'Divider Sample', and use `EdgeInsets.all(16.0)` padding to control the gaps around the layout.


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, using the values received from a simple string list (`['One','Two','Three','Four']`), the first value of the list is the first element of the list, to create a Dropdownbutton in a customized appearance (arrow icon, deep purple colored text and sub-line) and update the value on the screen. What exactly should we design a code structure that holds the selected value of Dropdownbutton and updates it with Setstate?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how do you create a `DropdownButton` widget using a `Map<String, String>` of city names and their abbreviations? The dropdown's `items` should display the full city names, while the `selectedItemBuilder` should display the selected city's abbreviation inside a `Container` with blue, bold text. The UI should update when a new city is selected via `onChanged`.


[System] You are a Flutter and Dart coding assistant.

[User] Create a Flutter application using `DropdownMenu` widgets to implement separate dropdowns for colors and icons. The app should dynamically display the selected color and icon as a text and icon combination. Deactivate one of the color options (e.g., Grey), enable search filtering on the icon dropdown, and use `ColorLabel` and `IconLabel` enums to manage the data.


[System] You are a Flutter and Dart coding assistant.

[User] Using Flutter, how can I create a basic MaterialApp and Scaffold structure containing a TextField with a send icon on the left, hint text, helper text, a character counter, and an OutlineInputBorder?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how do you create a simple text entry field inside a Scaffold using a TextField widget with a customized InputDecoration that shows a hint text, an error message, and an OutlineInputBorder, compatible with Material 3?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how can I create a `TextFormField` widget with an `initialValue`, a `prefix` widget, and a `suffix` widget? The code should use the Material 3 theme and be contained within a Scaffold with an AppBar titled 'InputDecoration Sample'.


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how do you style the floating label of a `TextFormField` using `WidgetStateTextStyle.resolveWith`? Provide a complete, working example using `useMaterial3: true` and `AutovalidateMode.always`. The floating label should have a letter spacing of 1.3, and its color should dynamically change: orange in the normal state, and the theme's error color (`Theme.of(context).colorScheme.error`) when a validation error occurs (e.g., when the field is left empty).


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how to create a dynamic "Helper" feature in a Textfield's Inputdecoration, which contains both text and a icon and provides precise control on the color, size of this icon and the manner under Textfield, is optimized in accordance with the principles of accessibility?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, I want to dynamically change the`labelstyle`feature in an`Inputdecoration`of a`Textformfield`of a`Textformfield`. This dynamic style change should ensure that the color of`labeltext`has a verification error to the error color of the theme, or a predetermined color (eg orange). In order to realize this behavior, how should I configure`labeltyle'correctly, which widgets or classes should I use, and what is the most appropriate approach to determine the error situation and apply the relevant style? In particular, the expression`widgetstatextStyle.resolvewith,`widgetstate`enum and`Theme.of (cont). Colorscheme.error`is correct and how can I guarantee whether this approach produces the expected result? If this approach is incorrect or improved, what is your proposal for an alternative solution?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, in order to control the size and alignment of the `prefixIcon` used in the `InputDecoration` of the `TextField` widget, we use `prefixIconConstraints`. Create a completely functional and well-documented example application that explains how it affects the minimum size and width of `prefixIcon` and how it can improve the user experience.


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, explain how `InputDecoration`'s `suffixIcon`, `suffixIconConstraints`, and `isDense` properties interact to affect a `TextField`'s vertical dimensions and alignment. Provide a Flutter application demonstrating different `BoxConstraints` values for `suffixIconConstraints` to show how to achieve a consistent UI.


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how can I change the color of Textformfield's Prefixicon according to the situations that Texinput received (eg error, focus, assumed), so that it should be red, blue and other in other cases when it is focused on error and using this color, material 3 theme and`widgetstatecolor`How can I apply it; In addition, how can I add a simple confirmatory to ensure the accuracy of this application, trigger the error status with this confirmator`.com`and how can I ensure that the verification is continuously working by using`Autovalidatemode.Always`?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how can we use the `ListTile` widget with different animations (specifically `Hero`, `FadeTransition`, and `SizeTransition`) to create a visually appealing and interactive user interface? Provide a complete, well-structured sample application demonstrating how to configure these animations.


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how can we create a basic application skeleton that displays a `MenuBar` simulating platform-specific menu bars with sub-menus like 'File' and 'View' using `MenuAcceleratorLabel`? Additionally, how do we use `ScaffoldMessenger` to show notifications on interaction, and define a Ctrl+T shortcut to print the application's diagnostic information?


[System] You are a Flutter and Dart coding assistant.

[User] In Flutter, how do we create a context menu that can be triggered by both right -click (or secondary click) and keyboard shortcuts, take into account the platform -specific behaviors, depend on whether or not the message is displayed or not showing the display of the message and how we manage the selection and status of this menu (for example, background color, message visibility). To disable the menu and to re-activate it?


[System] You are a Flutter and Dart coding assistant.

[User] How can I create a Flutter application featuring a NavigationRail on the left side of the screen where the user can interactively control its properties? Specifically, I want to be able to toggle the label appearance (none, selected, all), vertical alignment (top, center, bottom), and optional leading/trailing widgets (add button, more options icon). The destinations should include custom icons (some with notification badges using the Badge widget) for both selected and unselected states. The main content area should display the current state and provide SegmentedButton and SwitchListTile widgets to dynamically change these features.


[System] You are a Flutter and Dart coding assistant.

[User] In a Flutter application, how do we configure `pageTransitionsTheme` in `ThemeData` to use a fading effect (such as `FadeForwardsPageTransitionsBuilder`) for page transitions across all platforms? Provide a complete example featuring a list of items (using `Colors.primaries` for avatars) that navigates to a detail page displaying the selected item's avatar, name, and message.