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

[User] In Flutter, when displaying a large and dynamic dataset (such as a series' episodes) using a `PaginatedDataTable`, how do you implement custom sorting logic for specific columns (e.g., sorting dates correctly and formatting the 'Episode' column as 'S[Season]E[Episode]')? Specifically, how do you extend the `DataTableSource` class, use a `setData` method, and define a `_displayIndexToRawIndex` constant to optimize sorting performance and keep the UI fluent?


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

[User] In Flutter, how do you use the platform-specific menu bar (`PlatformMenuBar`) to create an application menu, manage actions of menu elements (`PlatformMenuItem`), assign shortcuts to these actions, group different menu elements (`PlatformMenuItemGroup`), and open an about dialog box (`showAboutDialog`)? Show how to create a menu structure containing multiple submenus, add standard platform-provided menu items (like Quit), and update a `Text` widget based on the selected menu options using best practices.


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

[User] In Flutter, how can we customize the opening animation of the `PopupMenuButton` widget by integrating it with a `SegmentedButton` widget? The application should enable transitioning between different animation styles (default, custom, and non-animated) using the `AnimationStyle` class. Develop a sample application that demonstrates this behavior.


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

[User] In Flutter, how do I create a widget that displays a list of radio buttons for the names 'Hercules Mulligan', 'Eliza Hamilton', 'Philip Schuyler', 'Maria Reynolds', and 'Samuel Seabury'? The radio buttons should use their index as the value, be toggleable (allowing them to be deselected when tapped again), and be displayed on the home screen of the application.


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

[User] In Flutter, how can I create a customized widget called `LabeledRadio` to expand the touch area of the standard `Radio` widget, customize its label, and control its selection behavior? The `LabeledRadio` widget should accept parameters for the label text, padding, group value, value, and an `onChanged` callback. Additionally, show how to use this widget in a `LabeledRadioExample` stateful widget that displays two options and updates a state variable `_isRadioSelected` when a radio button is selected.


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

[User] In Flutter, how can I use the `RadioListTile` widget with Material 3 to allow users to select one option, and control the vertical alignment of the radio button when there is a long subtitle using the `isThreeLine` property? Please provide a complete example.


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

[User] In Flutter, how do you implement a customized `RefreshIndicator` (with a blue background, white foreground, and 4.0 stroke width) that can be triggered programmatically via a `FloatingActionButton` using a `GlobalKey`? The indicator should wrap a `ListView` with 25 items, and the refresh process should simulate a 3-second delay.


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

[User] How do you configure the `notificationPredicate` of a `RefreshIndicator` to target a nested `ListView.builder` inside a `CustomScrollView` (at depth 1) rather than the outer scroll view, and how do you enable drag gestures for all pointer devices using `MaterialScrollBehavior` in Flutter? Provide a complete code example.


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

[User] In Flutter, how can we create a reorderable list of 50 items using `ReorderableListView`, where each item is a `ListTile` colored differently based on whether its value is even or odd? Additionally, how do we customize the dragging appearance with a custom elevation animation using `proxyDecorator`, and properly update the underlying `_items` list in the `onReorder` callback?


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

[User] In Flutter, how can we display a list of items in a `ReorderableListView` using Material 3, where the dragged card has a soft scale and elevation animation (using a custom `proxyDecorator`), alternating background colors for odd and even rows, and ensuring the reordering updates the state correctly?


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

[User] In Flutter, I would like to create a Reorderablelistview with 50 lists and to make it possible to change the elements in this list. How can I configure the background color of each listtile to have a more pronounced color tone for double elements and a lighter color tone for a single number of elements, and how should I implement the`Onreorder`function in order to ensure that this re-ranking process is realized (especially in the update of`Oldex`and`NewINDEX`)?


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

[User] In Flutter, how do we open an `endDrawer` programmatically using a `Scaffold` widget's `GlobalKey` and its `openEndDrawer()` method, while also controlling the swipe gesture using the `endDrawerEnableOpenDragGesture` property?


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

[User] In Flutter, how can I create a dynamically adjustable interface using a `SegmentedButton` to control a `SnackBar`'s animation style (such as default, custom duration/reverse duration, or no animation)? Write a complete and working sample code demonstrating how to apply these settings to `showSnackBar`.


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

[User] In Flutter, how do you create a 3-column GridView containing a vertical Scrollbar and show dynamically increasing text in each cell? Provide the basic structure of the application (MaterialApp, Scaffold, AppBar) and the necessary widgets (Scrollbar, GridView.builder, SliverGridDelegateWithFixedCrossAxisCount, Text) arranged in such a way that the scrollbar interacts with the grid content and the grid contains 120 items.


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

[User] In Flutter, using the Material 3 design language, how do we implement both single-selection (e.g., calendar view: day, week, month, year) and multi-selection (e.g., sizes: XS, S, M, L, XL) using the `SegmentedButton` widget? Provide a complete example integrating enums, `setState` for state management, and properties like `segments`, `selected`, `onSelectionChanged`, and `multiSelectionEnabled`.


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

[User] In Flutter, how do we make a custom widget selectable by the user with a customized selection area (for example, a rectangle with a certain fill around an icon), place the selection handles in the correct positions, and return the selected content (e.g., a 'Custom Text' string) and range (start and end offsets)? Specifically, how do we create the `_RenderSelectableAdapter` class, which is a custom `RenderObject` based on `RenderProxyBox`, and ensure that it correctly handles different types of `SelectionEvent` (such as selection starting, ending, and directional or granular selection expansion), updates the selection color, manages the starting and ending handles, and handles the selection geometry properly?


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

[User] In Flutter, create a complete sample application demonstrating how to enable text selection across the entire app. The app should use a `MaterialApp` structure, wrap the main layout in a `SelectionArea` widget, and contain a `Column` with three `Text` widgets displaying 'Row 1', 'Row 2', and 'Row 3'.


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

[User] In Flutter, how do you implement two Sliders where the first slider's secondary track value (`secondaryTrackValue`) is controlled by the value of the second slider? Please provide a complete Flutter example using a `StatefulWidget` and `setState` to manage and update the state of both sliders independently.


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

[User] In Flutter, how can I create an interactive switchlisttil widget to change the status of a switch, and how can I configure this widget to emphasize text scrolling behavior and the vertical alignment of the key (both in the middle and the top) by using titles and sub-heads containing different amounts of text,


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

[User] How do you create a reusable, independent stateless widget (`ObscuredTextFieldSample`) in Flutter for entering sensitive information like passwords? The widget should have a width of 250 pixels and contain a framed `TextField` with `obscureText` set to true and a 'Password' label. Also, show how to use this widget inside a basic `MaterialApp` structure (`TextFieldExampleApp`) with a `Scaffold`.


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

[User] Create a Flutter application demonstrating Material 3 TextField designs. It should include an AppBar titled 'TextField Examples' and two TextFields: one filled and one outlined. Both TextFields should have a search icon as a prefix icon, a clear icon as a suffix icon, a label, hint text, and helper text, utilizing properties like useMaterial3, prefixIcon, suffixIcon, labelText, helperText, filled, and border.


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

[User] In Flutter, to create a form containing five textfieldfields, to save the value of each Textfield in this form, to ensure that the form is automatically verified in each change, to switch to the next Textfield from the keyboard to the next Textfield and to print the recorded values to the console, how to maintain the general material design. And how do we position this arrangement in the center?


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

[User] In Flutter, how can I configure the default behavior of Tooltips centrally in the entire application using `TooltipThemeData` (specifically ensuring they appear above, not below, their contents), and demonstrate this with a rich text tooltip?


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

[User] In Flutter, how can I implement a customizable `WidgetStateInputBorder` (specifically an `UnderlineInputBorder`) that changes its appearance based on the text field's state (focused, hovered, disabled)? Additionally, how can I animate the width of the `TextField` dynamically based on focus, simplify state checks using an extension on `Set<WidgetState>`, and control the enabled/disabled state of the text field using a `FilterChip`?


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

[User] In Flutter, when using a CustomScrollView with a SliverList.builder containing alphabetical elements, how can I dynamically change the scroll direction using radio buttons via an `_axisDirection` variable? Specifically, how should I use the `setState` method to ensure that the content of the `_getLeading` widget (including the arrow icons and text representations) updates correctly when the axis direction changes?


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

[User] In Flutter, how do you create a MaterialApp covering the entire screen with a linear gradient background starting from the upper left corner and ending at the point (0.8, 1), using a multi-color gradient (including #5b0060 and #ffb56b) with TileMode.mirror, and a centered white 24-point text 'From Night to Day'?


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

[User] In the Flutter application, to ensure that a particular Widget captures and processes the keyboard entry, listening to keyboard events using Focusnode and updating the user interface according to certain key strokes (for example, "Q" key), as well as show different messages in Debug and Release modes and can be used to re-use and re-use Focus. Which Life Cycle Methods (Dispose) should be used to prevent memory leaks when managing this widget's keyboard interaction?


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

[User] How can I dynamically change the system status bar and navigation bar colors in Flutter using SystemUiOverlayStyle, and ensure the UI elements adapt to the background color?


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

[User] Flutter in Flutter, a special virtual keyboard independent of the keyboard (myvirtualkeyboard) to create and direct the text inputs of this keyboard to a Textfield (Textinputcontrolexample), the visibility of the virtual keyboard (mytextinkputControl.visible) Texinputconttrol api's (Textinput.setinputcontrol, texinput.restoreplatformputcontrol, textinkput.updateeditingValue) to manage, Textfield's existing text content (texteditingValue) to update according to virtual keyboard inputs (adding and cursor positioning) (Focusnode) To control the virtual keyboard independently, how can we apply and manage the interaction between these components, including the correct use of the Textinputcontrol API (Register, Unregister, Show, Hide) and the correct use of text. It becomes visible when it focuses, and the virtual keyboard entries correctly update the existing text in Textfield, as well as cleaning icon in Textfield (Iconbutton) both Textfield is clean


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

[User] How do I create a minimal Flutter application using `WidgetsApp` that displays the text 'C8H10N4O2' using the 'Piazzolla' font and scientific subscript formatting (scientific inferiors)?


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

[User] In Flutter, how can we use `FocusableActionDetector` to manage keyboard shortcuts (e.g., the 'X' key) and mouse interactions (hover, focus, click) for a custom reusable button component (`FadButton`)? The component should update its state, change color based on focus/hover, and handle actions/shortcuts. Provide a complete example showing this custom button alongside standard Flutter buttons.


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

[User] In Flutter, how do you create and manage an `AnimatedGrid` with a maximum item width that supports animated addition and removal? Demonstrate how to animate the selection of grid elements (using scaling and color changes) and how to use strategies like `GlobalKey`, `RemovedItemBuilder`, and a custom `ListModel` class to optimize performance and state management.


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

[User] In Flutter, how can we create a dynamically modifiable list with insert and delete animations using `AnimatedList.separated`? Explain the architecture and code structure, including the roles of a custom `ListModel` class, item builders (`_buildItem`), separator builders (`_buildSeparator`), and removed item builders, using custom `CardItem` and `ItemSeparator` widgets.


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

[User] In Flutter, how do you create a custom layout using `CustomMultiChildLayout` and `MultiChildLayoutDelegate` that arranges colored containers (Red, Green, Blue, Cyan) in a cascading pattern (overlapping by 30.0 pixels both horizontally and vertically) based on the text direction (LTR/RTL)? Provide a complete implementation demonstrating the layout principles, optimization strategies, and text direction handling.


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

[User] In Flutter, how do you create a menu that organizes a series of icons horizontally and opens/closes in an animated manner using the `Flow` widget, `AnimationController`, and a custom `FlowDelegate`? The menu elements should be automatically dimensioned according to the screen size, emphasize the touched element, and animate smoothly.


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

[User] In Flutter, in a Scaffold covering the entire home screen, how do you write the Flutter code that is necessary to create a blue-framed DecoratedBox that covers 50% of both the width and height of the screen using the FractionallySizedBox widget?


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

[User] In Flutter, how to create a stateful interface that dynamically changes the text of a particular button by using the `IgnorePointer` widget to disable and re-activate user interaction? In the interface, there should be a text label that shows the current `IgnorePointer` status (true/false), an `ElevatedButton`, and a `FilledButton` that changes the status of the `IgnorePointer`; at the same time, the text of the `FilledButton` should change dynamically according to the current situation ("set ignoring to false" or "set ignoring to true"). Explain how this interface will be configured in a basic Flutter application using `MaterialApp` and `Scaffold` widgets and how to manage the state using `setState`.


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

[User] How can we implement a Flutter application using StatefulWidgets, GestureDetectors, and an IndexedStack to manage a list of people (initially containing 'Dash', 'John', and 'Mary')? The app should allow adding new people via a TextField, incrementing an individual score for each person, and navigating through the people in the IndexedStack using gesture-based navigation buttons.


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

[User] In Flutter, when using the `Offstage` widget, the child widget is still laid out even when `offstage` is true. How can we reliably retrieve the size of an invisible `FlutterLogo` widget using a `GlobalKey` without causing rendering errors, and under what conditions is this size information guaranteed to be valid? Provide a complete Flutter example demonstrating this.


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

[User] In Flutter, how do we create an interface in the middle of the screen using a StatefulWidget that asks the user for the next number in the Fibonacci series (1, 1, 2, 3, 5, 8...)? The interface should use a TextEditingController to manage the TextField's content (and dispose of it to prevent memory leaks). If the user enters '13', show an AlertDialog saying 'That is correct!'.


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

[User] In Flutter, how do you create a TextField that supports inserting images directly from the keyboard (e.g., via IME/gif keyboard), displays the inserted image on screen, and manages resources efficiently using a StatefulWidget and ContentInsertionConfiguration?


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

[User] In Flutter, how do we use TexteditingController to set the initial value of a Textfield Widget to "Flutter" and position the cursor at the beginning of this value (0. Index), how do we use TexteditingController and how to properly cleanse and automatically focus Textfield?


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

[User] In Flutter, how do you programmatically unfocus a TextField using different `UnfocusDisposition` behaviors? Provide a complete example of a white-background application containing multiple TextFields, radio buttons to select the `UnfocusDisposition` value, and an 'UNFOCUS' button that triggers the unfocus action based on the selected disposition.


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

[User] In Flutter, how do I create an interface consisting of two `Pane` widgets that use `FocusScope` to manage focus? The background pane should have a 'close' button, and the foreground pane should have a 'menu' button. When the 'menu' button is clicked, the foreground pane should animate down to reveal the background pane, and focus should shift to the background pane. How can I control the focusability (`canRequestFocus`) of the background pane based on the animation state?


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

[User] In Flutter, when a user tries to exit the application without saving changes made in a form, how can we show a customizable warning dialog? Specifically, how do we use the `Form` widget's `canPop` and `onPopInvokedWithResult` properties to manage the form's dirty state, determine when to show the dialog, and handle the application exit based on the user's selection?


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

[User] How do we create a `StatefulWidget` in Flutter that displays a centered box containing a Flutter logo using the `AnimatedContainer` widget? When tapped, its width, height, color, and alignment should animate over 2 seconds with a smooth transition using the `Curves.fastOutSlowIn` curve.


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

[User] In Flutter, how do you create an interactive and animated visual component where the size (widthFactor and heightFactor) of a Flutter logo, located inside a ColoredBox, changes along with its alignment and color based on user interaction (tap) with a predetermined speed and curve? Provide an example using the AnimatedFractionallySizedBox widget, demonstrating state management for the selection state.


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

[User] In Flutter, how can we effectively use the`Animatedpadding`widget, which changes the fill of a container to animated, triggered by user interaction and provides a soft transition using the`Easeinout`curve; This use should be triggered through a button that changes the filling value between 0 and 100, includes a text label that shows the existing filling value, and to fully understand how this animated fill affects the dimensions and position of the container in different sizes of the screen, the basic structure of the application, the status management and the user interface elements (button, text label, animated and container)?


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

[User] In Flutter, how can we create a reusable and customized AnimatedPositioned widget that animates the size and position of a ColoredBox based on user interaction, using a pre-defined duration and curve?


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

[User] How do you create a Flutter user interface that uses a FloatingActionButton to trigger an animated visibility transition (using SliverAnimatedOpacity) on a SliverFixedExtentList?


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

[User] In a Flutter application using nested navigators, how can we handle system back gestures to either pop the nested navigator or return to the main page? Specifically, show how to use `NavigatorPopHandler` with a `GlobalKey<NavigatorState>` to manage a nested navigator that starts at `nested_navigators/one` and can navigate to `nested_navigators/one/another_one`.


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

[User] Create a Flutter application demonstrating nested navigation with state restoration across tabs in a `BottomNavigationBar`. The application should use `RestorationMixin`, `RestorableValue`, `NavigatorPopHandler`, and `GlobalKey<NavigatorState>` to maintain tab and page stacks on restart and handle back button behavior correctly for each tab.


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

[User] In Flutter, how do you create a basic application using `NestedScrollView`, `SliverAppBar`, and `TabBarView` (with lists for 'Months' and 'Days') that uses a `NotificationListener` to detect and print the start and end of scroll events to the console?


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

[User] In a Flutter application, how can we create a dynamic overlay that highlights a selected item in a `NavigationBar`? When a destination is selected, we want to draw a colored frame over it with explanatory text and an arrow icon, ensuring the overlay is within a `SafeArea`. The overlay should update dynamically based on the selected item, and we must properly manage the lifecycle of the `OverlayEntry` (creation, updating, and removal) to prevent memory leaks. Provide a clean, readable, and tested code structure using `OverlayEntry`, `Overlay`, `StatefulWidget`, `AlignmentDirectional`, `SafeArea`, and `NavigationBar`.


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

[User] In Flutter, when switching between BottomNavigationBar tabs, how can we preserve the scroll position and other widget states (such as TextField content) to prevent them from being recreated? Provide a clean, reusable solution using PageStorage, PageStorageBucket, and PageStorageKey.


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

[User] How do you integrate Flutter components such as `TabController`, `TabPageSelector`, and `IconButton` to create an interactive page indicator for a three-page `PageView`? The indicator should be designed for desktop and web platforms (using conditional rendering to return `SizedBox.shrink()` on mobile), synchronize the page index, and provide smooth animated transitions between pages.


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

[User] In Flutter, when using a dynamic data list (which can be reversed or reordered) inside a `PageView.custom` widget, how can we ensure that the state of the pages (created with `SliverChildBuilderDelegate`) is preserved correctly? Specifically, how do we implement `findChildIndexCallback` using `ValueKey` to handle reordering, and integrate `AutomaticKeepAliveClientMixin` to minimize memory impact while keeping pages alive? Provide a complete, working implementation.


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

[User] In Flutter, how do you use the `PopScope` widget to prevent the default system back behavior (by setting `canPop` to `false`) and customize the back navigation using `onPopInvokedWithResult`? Specifically, show how to prompt the user with a confirmation dialog before leaving a form page, and explain how to manage the data flow by creating and comparing copies of a custom data class when returning to the previous page.


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

[User] In Flutter, I would like to create a simple counter application using state restoration to maintain its application status. In this application, a widget must be created that increments an integer value (initially 42) one by one when clicking an `OutlinedButton` and shows this value on the screen. When the application is closed and re-opened, `RestorationMixin` and `RestorableInt` should be used to prevent the value of this counter from disappearing. Meeting these requirements, how do I write a complete Flutter code containing `RestorableValueExampleApp` and `RestorableValueExample`?


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

[User] How do you design and implement a clean architecture in Flutter to listen to navigation events (such as pushing a page or returning to a previous page) and notify relevant widgets using the `RouteObserver`, `RouteAware`, and `NavigatorObserver` classes?


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

[User] In Flutter, using Inheritedmodel, both through the Sliders who dynamically adjusts both Edgeinsets values (upper notch, side gaps, sub-indicator), as well as the Switchlistililes that allow the display/hide of Safearea Widget and Appbar, and thus adjust this to affect the safety field and appearance of the application. Easily accessible and updated in different parts of the application (for example, safeareaexampleapp, safeareaexample), taking into account the performance optimization of Inheritedmodel's aspect feature?


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

[User] In Flutter, when the order of elements in a `ListView.custom` with `SliverChildBuilderDelegate` changes, how do we use `AutomaticKeepAliveClientMixin` to prevent re-creation of elements, and how do we implement the `findChildIndexCallback` function using `ValueKey` to find the new index of the items?


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

[User] In Flutter, explain how to share and mutate data safely across the widget tree without using global variables, external state management libraries, or custom `InheritedWidget` subclasses, by leveraging the built-in `SharedAppData` class. Provide a complete implementation showing how to define a `SharedObject`, access it using `SharedAppData.getValue`, update it using `SharedAppData.setValue` to trigger rebuilds, and initialize it when the application first opens. Show how a `CustomWidget` reads and updates this shared object.


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

[User] In Flutter application, how can I apply the platform -specific system context menu (copy, paste, cut, etc.) in a Textfield, depending on whether this menu system is supported to the system menu or adaptive toolbar, so that the application will maintain both the local experience of the platform?


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

[User] In Flutter, to create a special number of entry fields (for auction and reduction functions) containing a`Textfield`and two`Outlinedbutton`, to control the value of this area with the keyboard arrow keys, to ensure that the value entered is only numerical, and to ensure that this special number of entrance space is included in the`Textfielddtapregion`How to designed and apply`spinnerfield`widget and a specific`Interspinerfield`widget; In this design, when the value in the text field changes or increases/reduction buttons are pressed, how to integrate the behaviors such as updating the value, defining the keyboard shortcuts and automatically focusing the text field, and how to protect the content of the text field in case of reconstruction of Widget?


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

[User] In Flutter, how can I customize the default magnifier behavior of a TextField widget (specifically changing its shape, border color/thickness, size, focal point, and scale, as well as constraining its position to the text line boundaries)? How do I ensure it supports both Left-to-Right (LTR) and Right-to-Left (RTL) text directions?


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

[User] In Flutter, how can we create an application that allows a green square with 'Whee!' text to rotate in 10-second loops using AnimationController, TickerProviderStateMixin, AnimatedBuilder, and Transform.rotate, specifically preventing the re-creation of AnimatedBuilder's child parameter? Provide the complete code.


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

[User] In Flutter, I would like to create a simple application that represents a counter using `ValueNotifier` on the screen through a `ListenableBuilder` widget, and also increases the value of the counter with a `FloatingActionButton`. It should include a `ListenableBuilderExample` stateful widget that forms the main structure of the application, with its state `_ListenableBuilderExampleState`. It must also include a `StatelessWidget` named `CounterBody`, which displays the value of the counter. How do I create Flutter code that meets these requirements, accurately updates the value of `ValueNotifier` with `ListenableBuilder`, and uses basic Material Design elements?


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

[User] In Flutter, how do we optimize performance using the `ListenableBuilder` widget and a `ChangeNotifier` to update a counter value in the interface? Specifically, when the `_count` variable of the `CounterModel` class is increased via the `increment` method, we want to rebuild only the relevant `Text` widget inside the `builder` function to prevent unnecessary rebuilds of the rest of the widget tree. How do we configure the `ListenableBuilder` widget correctly, connect the `CounterModel` instance to it, and instantly update the counter value on the screen when a `FloatingActionButton` is pressed?


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

[User] Using Flutter, I would like to create a clicked interaction that softly changes the size of a Iconbutton to its tweananimationbuilder widget softly; In this interaction, every time Iconbutton is clicked, the size will be between 24.0 and 48.0, the animation time will be 1 second, Iconbutton's color will be blue and will show the "aspect_ratio" icon, but it will prevent the unnecessary re-scratching of the tweanimationbuilder's Builder function for performance optimization (for example How can I do it in a way by using it as a parameter?


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

[User] In Flutter, the `side` property of the `FilterChip` widget allows applying customized borders based on different widget states (such as pressed, hovered, or selected). How can we configure a `FilterChip` to show a green border when pressed, a blue border when hovered, and a red border when selected, ensuring the border updates correctly when the selection state changes?


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

[User] In Flutter, how can we dynamically change the mouse cursor of a `ListTile` based on its `enabled` state using a custom `WidgetStateMouseCursor`? Provide a complete example where a `Switch` toggles the `ListTile`'s enabled state, and the cursor changes between `SystemMouseCursors.forbidden` (when disabled) and `SystemMouseCursors.click` (when enabled).


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

[User] In Flutter, using the `flutter_test` library, how do you write a widget test for the `AnimatedDigitApp` widget (from `flutter_api_samples/animation/animation_controller/animated_digit.0.dart`)? The test should verify the initial value, the increment mechanism via a FloatingActionButton, and the animation transitions using `pump()` and `pumpAndSettle()`.


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

[User] How do I write an automated Flutter UI test for the `Curve2DExampleApp` widget? The test should find a `CircleAvatar` containing the letter 'B' moving along a 2D curve. It needs to advance the animation in steps using the `pump` method, and verify the widget's position at each step against a list of expected coordinates using the `moreOrLessEquals` matcher with an epsilon of 1 to tolerate small shifts.


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

[User] In Flutter, how do you write a widget test for `CupertinoPopupSurface` to verify that a `ColoredBox` is displayed when a controlling `CupertinoSwitch` is active, and that the `ColoredBox` does not appear when the switch is toggled to inactive?


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

[User] How do you write a Flutter widget test to verify the properties of a `CupertinoListTile` (such as title, subtitle, leading, trailing, and background color) using `find.text`, `find.byIcon`, `find.byKey`, and `tester.firstWidget`?


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

[User] In the Flutter test environment, `flutter_api_samples/cupertino/picker/cupertino_picker.0.dart` defines the `CupertinoPickerApp` widget. We aim to test the manipulation of selected elements in `CupertinoPicker`. By simulating user interactions (such as drag and touch actions), we verify that the text content of the `CupertinoButton` widget changes as expected and the `CupertinoPicker`'s `scrollController` initial item is updated. How is such a test scenario designed and implemented?


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

[User] How do I write a Flutter widget test to verify that a CupertinoFormSection contains five CupertinoTextFormFieldRow widgets, and that entering text into the first row correctly updates and displays the text?


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

[User] Using Flutter widget testing, write a test to verify whether the `AppBarExampleApp` widget's `AppBar` has a custom shape (`CustomAppBarShape`). Also, write a test scenario to verify whether a `TextField` widget is found in the bottom/subtitle of the `AppBar`. Demonstrate how to use the Flutter testing tools and functions: `find.descendant`, `find.byType`, `tester.pumpWidget`, and `tester.widget`.


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

[User] In Flutter, how do you write a widget test for `AppBarMediumApp` (which uses a `SliverAppBar`) to verify the number of `IconButton` widgets, the initial and post-scrolling position of the title text, and its style after scrolling?


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

[User] In Flutter, how do you write widget tests for an `Autocomplete` widget that uses a fake API delay and debounce duration, including testing search filtering, debounce resetting, and displaying error messages on network errors?


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

[User] When `AnimationStyle` is used to customize the opening and closing animations of a BottomSheet opened with the `showBottomSheet` function in a Flutter application, how can we write a Widget test that confirms different `AnimationStyle` configurations correctly customize the animation by measuring the vertical position (DY) of the BottomSheet at specific millisecond intervals?


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

[User] Write a Flutter widget test using the `flutter_test` package to verify that the `Card` widget in the `CardExampleApp` from `flutter_api_samples/material/card/card.1.dart` has its `clipBehavior` property set to `Clip.hardEdge` by default.


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

[User] In Flutter, when testing a customized context menu (right-click menu) built using `contextMenuBuilder` on a `SelectableRegion`, how can we write a widget test to verify that the `AdaptiveTextSelectionToolbar` containing a 'Print' option appears on a secondary click (right-click) and disappears when the primary mouse button (left-click) is clicked elsewhere?


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

[User] Write a Flutter widget test to verify the layout order of a `VerticalDivider` and two `Card` widgets in `VerticalDividerExampleApp`. Specifically, prove that the first card is to the left of the divider and the second card is to the right of the divider by comparing their coordinates.


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

[User] In Flutter, how do you write an atomic UI test to verify that the mouse cursor (text, click, or basic) correctly displays the expected behavior when hovering over different DropdownMenu/TextField elements? Specifically, how can we use RendererBinding to assert that the active cursor matches the expected SystemMouseCursors value?


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

[User] In Flutter, write a widget test for the `IconButtonApp` widget defined in `icon_button.2.dart`. The test should verify that there are 8 `IconButton` widgets using the `Icons.filter_drama` icon. It should confirm that 4 of these IconButtons are active (i.e., their `onPressed` callback is a valid `VoidCallback`) and the other 4 are disabled (i.e., their `onPressed` callback is null).


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

[User] In Flutter, how do we write an automated widget test to verify the interaction between `TextInputAction.done`, `InputChip` deletion, and the `ChipsInputState` object, specifically covering the `kObjectReplacementChar` mechanism in `ChipsInputEditingController`?


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

[User] In Flutter, how do you write a widget test to verify that a TextField Widget from the 'input_decoration.1.dart' sample is correctly decorated with an InputDecoration, specifically checking that its 'hintText' is present, 'contentPadding' is set to EdgeInsets.zero, and 'border' is an OutlineInputBorder?


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

[User] In Flutter, the `flutter_api_samples` package contains the `InputDecorationExampleApp` widget in `input_decoration.2.dart`. This widget contains a `TextField` with hint text and error text. What is the code required to create a widget test that verifies the `TextField` is present and its `decoration` is not null?


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

[User] In Flutter, how do we test how the `decoration` property of `TextFormField` changes based on different widget states (e.g., focused, unfocused), specifically ensuring that `prefixIconColor` gets different colors (grey and green respectively) in default and focused states using `MaterialStateExampleApp`? Show how to apply the scenario, verify the state-based color changes by using `WidgetStateColor` in this test scenario, and evaluate the state-based behavior of `InputDecoration`.


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

[User] How do we write a Flutter widget test to verify that the `prefixIconColor` of a `TextFormField` dynamically updates based on its `WidgetState` (e.g., default, focused, error), and also validates that entering an invalid URL (e.g., missing '.com' TLD) displays the correct error message?


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

[User] In Flutter, how can we write a widget test to automatically verify that the `leading` (a `CircleAvatar`) and `trailing` (an `Icon`) widgets of a `ListTile` are correctly aligned and positioned at expected offset values (e.g., (16.0, 16.0) and (752.0, 24.0)) relative to the `ListTile`?


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

[User] In Flutter, how do you write a Widget test to verify a context menu opened with the secondary mouse button? The test should ensure that menu elements are displayed correctly, keyboard navigation (arrow keys and Enter) works, and shortcut keys (e.g., Ctrl+S, Ctrl+R, Ctrl+G, Ctrl+B) trigger the correct menu actions, including showing/hiding messages and updating the selected state.


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

[User] Write a Flutter widget test to verify that tapping an IconButton opens a MenuAnchor displaying three MenuItemButton elements labeled 'Item 1', 'Item 2', and 'Item 3'.


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

[User] In Flutter, how do you write a minimal and complete widget test for the `SimpleCascadingMenuApp` widget (from `flutter_api_samples/material/menu_anchor/menu_anchor.3.dart`) to verify that tapping the IconButton opens and closes the menu?


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

[User] How can we write a widget test in Flutter to verify the sorting and paging functionality of a `PaginatedDataTable` (specifically `DataTableExampleApp`), ensuring that 'Strange New Worlds' is visible on the first page, disappears after sorting, and behaves correctly when navigating pages?


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

[User] In Flutter, a custom radio button component `LabeledRadio` is defined. To test its selection behavior, an application `LabeledRadioApp` is created. Write a detailed UI test scenario using the Flutter test framework to verify that the initial state of the radio buttons, user interaction (tapping), and the post-interaction `value` and `groupValue` properties change as expected.


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

[User] In Flutter, how do you write a widget test using the `flutter_test` package to verify that a `RadioListTile` group's state updates correctly? Specifically, write a test for `RadioListTileApp` that verifies the initial `groupValue` is `SingingCharacter.lafayette`, and after tapping the second radio button, the `groupValue` updates to `SingingCharacter.jefferson`.


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

[User] In Flutter, how do we test the interaction of a `RangeSlider` widget using `WidgetTester`? Specifically, write a widget test using the `flutter_test` library and `find.byWidgetPredicate` to simulate dragging movements on a `RangeSlider` with 5 divisions between 0 and 100, verifying that the values update correctly (e.g., to `RangeValues(0, 80)` and `RangeValues(20, 80)`) based on the drag coordinates.


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

[User] In Flutter, write a widget test for a `ReorderableListView` that simulates reordering an item by long-pressing and dragging it. Use `TestGesture` with the correct gesture timeouts to simulate the long press, and verify that the item's vertical position changes after the drag.


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

[User] In Flutter, how do you write a widget test for a `SegmentedButton` customized with `SegmentedButton.styleFrom`? Specifically, how can you verify the `foregroundColor` and `backgroundColor` for both selected and unselected states by finding the ancestor `Material` widget of a text label using `find.ancestor` and `find.byType`?


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

[User] In a Flutter application with two `Slider` widgets, the first slider's `secondaryTrackValue` is synchronized with the value of the second slider. Write a comprehensive widget test using the `flutter_test` library to verify this behavior. The test should simulate a touch/tap movement on the second slider and assert that the first slider's `secondaryTrackValue` updates accordingly, using the `closeTo` matcher to handle tolerance.


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

[User] How can we write Flutter widget tests for a TabBar and TabBarView interface managed by a DefaultTabController to cover these scenarios: 1) Verify the first tab is selected by default. 2) Verify that tab changes are logged via debugPrint. 3) Verify that DefaultTabControllerListener throws an expected FlutterError when used without a DefaultTabController?


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

[User] In Flutter, using the `TextButtonExampleApp` example, how can we design and implement a widget test scenario to verify that the various `TextButton` widgets (with different text, states, icons, styles, and the smiley button visual updates) and `Switch` widgets respond correctly to user interactions and exhibit the expected visual changes?


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

[User] In Flutter, how can I write a widget test for a widget named `TextFieldExampleApp` that contains a `TextField` with a 'Password' label and obscured text, to verify that `obscureText` is true and the label text matches?


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

[User] In Flutter, how do you write a widget test to verify that an `AlertDialog` correctly displays the text entered in a `TextField` along with its correct length (handling emojis and special characters using `characters.length`) after pressing the 'Done' action? Assume the widget under test is `TextFieldExampleApp`.


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

[User] When a Flutter application contains two text fields in 'TextFieldExamplesApp' with 'Filled' and 'Outlined' styles, featuring PrefixIcon, SuffixIcon, LabelText, HintText, and HelperText, how should widget tests be written to verify they are created correctly? How can we comprehensively assert that both TextField types have the expected UI elements and correct property values?


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

[User] In Flutter, how do you write an automated UI test for an application (`example.ExampleApp`) containing radio buttons that change the `AxisDirection`? The test should confirm that when the direction is changed to `AxisDirection.up`, the UI updates correctly (e.g., displaying 'AxisDirection.up', 'Axis.vertical', 'GrowthDirection.forward', and the corresponding 'Icons.arrow_upward_rounded' icons).


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

[User] In Flutter, how do you write a widget test to verify the pixel-level visual appearance of a `MoodyGradient` widget using a golden file comparison and wrapping it in a `RepaintBoundary`?


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

[User] In Flutter, how do you write a widget test to verify the behavior of an application that handles exit requests? The UI contains 'No exit requested yet', 'Do Not Allow Exit', 'Allow Exit', and 'Quit' buttons. The test should verify that tapping 'Quit' changes the status to 'App requesting cancelable exit'.


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

[User] What is the Flutter code required to write a widget test that confirms that a `Text` widget inside `ExampleWidget` uses the 'Raleway' font family and has its font features set to `FontFeature.alternative(1)`?


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

[User] In Flutter, how can we write a widget test to verify that a Text widget correctly applies the 'Piazzolla' font family and the FontFeature.caseSensitiveForms() font feature?


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

[User] In Flutter, when using the `AnimatedList.separated` widget, how do you write an automated widget test to verify that items and separators are correctly displayed, added, and removed with animations? Which `WidgetTester` methods and `Finder` types (such as `find.text` and `find.byIcon`) are used for this?


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

[User] In Flutter, how do we write a widget test to verify a form that uses the `AutofillGroup` widget? The form contains a 'Shipping Address', 'Billing Address', multiple `TextField`s, a `Checkbox`, and a 'Contact Phone Number', utilizing autofill features. The test should verify the behavior when the checkbox is toggled (which changes the form's interface), checking the number of text fields, the checkbox status, and the specific `AutofillHints` on the text fields.


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

[User] Write a Flutter widget test using `flutter_test` to verify that a `FractionallySizedBox` correctly scales a `DecoratedBox` child. The test should assume screen dimensions of 800x600, an AppBar height of 56.0, and width/height factors of 0.5. Use `WidgetTester` to verify the dimensions of the `DecoratedBox`.


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

[User] In Flutter, using the `OnChangedExampleApp` widget from `package:flutter_api_samples/widgets/editable_text/editable_text.on_changed.0.dart`, how do you write a complete widget test suite that confirms the correct labels are displayed, the dialog is shown/hidden based on the answer, and the dialog is closed when the 'OK' button is pressed?


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

[User] Assuming that an application part containing a basic form verification functionality in Flutter is assumed to include an Appbar with a "Form Sample" title, a Textfield and an Elevatedbutton, to test the user interactions (empty shipping, text input and valid shipment) and to verify the functionality of the Flutter Test Libra How to improve a comprehensive Widget test that confirms verification messages and reactions to user inputs, and how to read and verify the value of Textfield's controller, trigger the button and update the interface accordingly?


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

[User] In Flutter, how do you write a widget test using `WidgetTester` to verify a `GestureDetector` behavior? The widget contains a lightbulb icon (initially black with `Icons.lightbulb_outline` and text 'TURN LIGHT ON'). Tapping the `GestureDetector` should toggle the icon's color to `Colors.yellow.shade600` and text to 'TURN LIGHT OFF', and tapping it again should revert them. Provide a detailed test scenario using functions like `pumpWidget`, `find.byIcon`, `find.text`, `find.byType`, `tap`, and `expect`.


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

[User] Write a Flutter widget test for `GestureDetectorExampleApp` to verify that tapping the `GestureDetector` toggles the `Container`'s color between white and yellow.


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

[User] How can we write a Flutter widget test using the `flutter_test` library to verify the transformation matrices (such as the identity matrix and rotations around the Z-axis at specific intervals) of a `Transform` widget wrapping a 'Whee!' text widget, covering the initial state, intermediate steps, and the full rotation cycle?


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

[User] Write a Flutter widget test that verifies that when a `CupertinoTextField` is long-pressed, the `CupertinoTextMagnifier` widget is correctly displayed. Assume the widget is hosted inside `CupertinoTextMagnifierApp` from the Flutter API samples.


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

[User] How do you write a Flutter widget test to verify page transitions using `RouteObserver` and `RouteAware`? Specifically, how can we test that the `didPush` and `didPopNext` lifecycle methods are triggered the expected number of times when navigating forward and back, and which `WidgetTester` methods and assertions should be used?


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

[User] Write a Flutter widget test using the `flutter_test` library that verifies that the `example.ScrollbarApp` widget contains exactly 3 `Scrollbar` widgets when running on the desktop platform, using `TargetPlatformVariant.desktop()`.


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

[User] In Flutter, a special magnifier in Textfield, displaying the widget of the widget and to test the behavior of this enlarger (positioning, appearance, interaction, etc.), especially in text selection and dragging processes, transform the text positions of the Rendereditable object into the world coordinates, and to manipulate the endpoints (endpoints). How to create and confirm comprehensive and reliable test scenarios covering, in these test scenarios from right to left (RTL) language support, platform differences (iOS, Android) and asynchronous procedures (animations, redraws), how to guarantee the expected location, content and interaction of the magnificent?


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

[User] How do you write a comprehensive widget test for `FadeTransitionExampleApp` (from `fade_transition.0.dart`) containing a `FlutterLogo` inside a `FadeTransition`? The test should verify that the animation values at the start, middle, and end points match the expected values calculated using the specified duration (`FadeTransitionExampleApp.duration`) and curve (`FadeTransitionExampleApp.curve`), and that the animation cycle completes correctly.


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

[User] In the `WidgetStateMouseCursorExampleApp` widget, a `ListTile`'s `enabled` state is controlled by a `Switch` widget. Write a Flutter widget test scenario to verify that the mouse cursor changes to `SystemMouseCursors.click` when the `ListTile` is enabled, and to `SystemMouseCursors.forbidden` when it is disabled. The test should simulate mouse movement gestures and verify the active cursor.


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

[User] Create a Dart entry point for a Flutter Driver integration test that enables the Flutter Driver extension and runs the main application.


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

[User] Write a low-level Flutter application using `dart:ui` that renders a custom scene. The scene should draw a square with a yellow-blue gradient in the center, rotated 45 degrees, a green translucent circle scaled by 0.5, and a red translucent circle at (150, 300). Apply a difference clip (`ClipOp.difference`) to exclude a rectangular area, and scale the rendering according to the device's pixel density using `SceneBuilder`.


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

[User] In Flutter, write a minimal, self-contained application using `dart:ui` and `PlatformDispatcher.onBeginFrame` that draws the text 'Hello, world.' centered on the screen. The text should be scaled according to the device's pixel ratio and logical dimensions, ensuring it displays correctly across different screen densities and dimensions.


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

[User] In Flutter, how do you create a low-level dynamic UI element (such as text on a green rectangle in the center of the screen) with multi-language support, using the `dart:ui` APIs like `PlatformDispatcher`, `ParagraphBuilder`, `Canvas`, and `SceneBuilder` while accounting for the device's pixel ratio and physical size?


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

[User] In Flutter, how can we create a custom `RenderSolidColorBox` that extends `RenderDecoratedBox`? The class should take a `desiredSize` (defaulting to `Size.infinite`) and a `backgroundColor` as parameters. If a dimension of `desiredSize` is infinite, it should be treated as 0.0 in the intrinsic width/height calculations. We need to override `computeMinIntrinsicWidth`, `computeMaxIntrinsicWidth`, `computeMinIntrinsicHeight`, `computeMaxIntrinsicHeight`, and `performLayout`. Additionally, how can we handle pointer events using `handleEvent` to change the background color to red on `PointerDownEvent` and restore it on `PointerUpEvent`?


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

[User] How can I build a Flutter application that displays a dialogue from '2001: A Space Odyssey' with custom rich text styling for each speaker (Dave and HAL), allows toggling between styled and plain text on tap, and maintains a clean, sustainable code structure?


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

[User] Cupertino design language, to create customizable list items, both basic (base) and notched (notched) support support, title, subtitle, sub-title, additional information, leading widgets, which can include widgets, sensitive to touch interaction, minimum height, filler, text styles and colors, such as the fine adjustment of various visual parameters. How can we create a reusable Flutter Widget and how can we manage the behavior and appearance of this widget's different configurations (for example, non-sub-title, leading widget)?


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

[User] In Flutter, how do you design and apply a reusable, flexible, and accessible iOS-like modal bottom sheet transition that supports nested navigation, adapts to different themes, and handles drag-to-dismiss gestures? Provide an implementation using `CupertinoSheetTransition`, `_CupertinoDownGestureDetector`, and `_CupertinoDownGestureController` classes.


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

[User] In Flutter, how can we configure the visual style of Cupertino switch and slider thumbs using a custom `CupertinoThumbPainter` class and related constants (such as colors and shadows)? Explain how to use the `color` and `shadows` properties, customize them with shadows like `_kSliderBoxShadows`, and paint them on a canvas.


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

[User] In Dart Web applications, how do you determine both the real device platform and test environments in a correct and reliable way to implement platform-specific behavior? Specifically, how is the value of the `defaultTargetPlatform` variable determined? Explain the priority order and circumstances under which `debugDefaultTargetPlatformOverride`, `debugEmulateFlutterTesterEnvironment`, `browser.operatingSystem`, and `_operatingSystemToTargetPlatform` are used, and how this ensures consistency and accuracy across production and test environments.


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

[User] In Dart, how do you design and implement a customizable `consolidateHttpClientResponseBytes` function and a `BytesReceivedCallback` to reliably process data from an `HttpClientResponse`? The solution should automatically handle compression (gzip), track download progress (providing cumulative bytes and total expected size), handle errors gracefully (including memory cleanup), and optimize performance and memory consumption for large downloads.


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

[User] In a Flutter application, how can we design a utility function that returns the runtime type of an object as a string during development (using `assert` to perform the expensive operation), but returns a pre-defined optimized string in production mode to maximize performance?


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

[User] In Dart and Flutter, implement the `debugPrint` utility, including both synchronous (`debugPrintSynchronously`) and throttled (`debugPrintThrottled`) variations. Show how the throttled version manages console output limits using a queue, `Timer`, and `Completer` (with a capacity like `_kDebugPrintCapacity`). Additionally, implement the `debugWordWrap` helper function, which wraps text at a specified width, handles indentation patterns (`_indentPattern`), and uses a state machine with word-wrap parse modes (`_WordWrapParseMode`).


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

[User] How would you design and implement a `StackFrame` class in Flutter/Dart to parse and represent stack trace lines from different platforms (VM, Web Debug, and Web Non-Debug) in a consistent format? The architecture should handle class names, methods, package information, as well as asynchronous suspensions and stack overflow elisions.


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

[User] Implement a high-performance timeline tracking system in Dart (`FlutterTimeline`) for measuring synchronous execution times during development. It should support start/finish sync blocks, aggregate timings, and minimize garbage collection overhead using custom chunked data structures like `_Float64ListChain`, `_StringListChain`, and `_BlockBuffer`.


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

[User] Implement a polynomial least squares solver in Dart. The solver should take `x`, `y`, and `w` (weights) lists, and fit a polynomial of a specified degree. It should include basic vector and matrix operations (such as dot product, norm, and QR decomposition) to solve the system and calculate the confidence interval (R-squared).


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

[User] Implement the `Velocity`, `VelocityEstimate`, `VelocityTracker`, `IOSScrollViewFlingVelocityTracker`, and `MacOSScrollViewFlingVelocityTracker` classes in Flutter/Dart. The implementation should demonstrate how pointer input data is collected via `addPosition` and how velocity is estimated via `getVelocityEstimate` using strategies like least squares fitting (for the default tracker) and weighted moving averages (for iOS and macOS scroll views).


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

[User] Implement a custom `MaterialBanner` widget in Flutter that supports both Material Design 2 and Material Design 3 styling. The widget must handle accessibility (screen readers and keyboard navigation), custom animations (height and slide transitions), and support parameters like `content`, `actions`, `elevation`, `leading`, `backgroundColor`, `surfaceTintColor`, `shadowColor`, `dividerColor`, `padding`, `margin`, `leadingPadding`, `forceActionsBelow`, `overflowAlignment`, `animation`, `onVisible`, and `minActionBarHeight`. It should also integrate with `ScaffoldMessenger` and use a `Hero` widget for transitions.


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

[User] How do you design and implement a comprehensive and flexible button theme management system in Flutter? Specifically, demonstrate the implementation of `FilledButtonThemeData` and `FilledButtonTheme` (as an `InheritedTheme`), including the `lerp` method for animations, the context-based `of` method, performance optimization via `updateShouldNotify`, and debugging support with `debugFillProperties`.


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

[User] How can we customize and control the appearance, positioning, and interaction of the text magnifier in Flutter (using TextMagnifier, Magnifier, MagnifierController, and MagnifierInfo) to provide a consistent experience across iOS and Android?


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

[User] In Flutter, how can we design and apply a mixin on a State class to manage interactive states (such as hovered, pressed, and disabled) and optimize rebuilds when these material states change?


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

[User] In Flutter, how do you design a custom theme structure (`SearchViewThemeData` and `SearchViewTheme`) to control the appearance and behavior of a `SearchView` widget? The theme should cover parameters such as `backgroundColor`, `elevation`, `surfaceTintColor`, `side`, `shape`, `headerHeight`, `headerTextStyle`, `headerHintStyle`, `padding`, `barPadding`, `shrinkWrap`, and `dividerColor`. Explain how this theme affects sub-elements in the widget tree and how to support smooth transitions (interpolation) between themes at runtime.


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

[User] In Flutter, how is the `FractionalOffset` class designed to proportionally specify the position of an object within a rectangle? Provide an implementation extending the `Alignment` class, including factory methods (`fromOffsetAndSize`, `fromOffsetAndRect`), operator overloading (addition, subtraction, multiplication, division), pre-defined constants (like `topLeft`, `center`), and a `lerp` method.


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

[User] How can you convert image data from a `Uint8List` into a `ui.Image` in Flutter while properly managing the lifecycle of the codec and buffer to optimize performance and memory footprint?


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

[User] In Flutter, how can we implement a customizable linear border (LinearBorder) that provides separate size and alignment control for the start, end, top, and bottom edges, supports animated transitions (using lerpFrom and lerpTo), handles EdgeInsetsGeometry dimensions, respects TextDirection, and provides a copyWith method? Show the implementation of LinearBorderEdge and LinearBorder classes, including their drawing algorithms.


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

[User] Within the framework of the Flutter, to create customizable star shapes using the`border`interface, parametric controlable (number of corners, internal radius ratio, corner and valley rounding, rotation, compression) of this class and this class`larpfrom`,`Lerpto`,`Paint`, How can we design and implement their methods such as`Circleborder`,`Stadiumborder`,`Roundedrectangleborder`to provide soft transitions with other`Shapeborder`classes, so that visually rich and dynamic user interfaces can be created through both static definitions and animations?


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

[User] In Flutter applications, how is the text scaling infrastructure (such as `TextScaler`) designed and implemented to support linear and non-linear scaling strategies, limit scaling factors, and meet accessibility requirements?


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

[User] In Flutter, a special`renderbox`sub-class, which displays error messages using different styles (color, font, size, thickness) in error discovery mode and broadcast mode, is desired to be created; How can this`rendererbox`can be drawn effectively effectively with the predetermined internal gaps and a background color that visually emphasizes the error status in an area with maximum width and heights specified, and how possible errors should be discussed in this drawing process?


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

[User] How can we design and implement a custom `RenderTreeSliver` class in Flutter, extending `RenderSliverVariedExtentList`, to efficiently visualize and animate a hierarchical tree structure with dynamic node heights? The implementation should support indentation, handle expansion/contraction animations during node addition/removal, and dynamically calculate heights using an `itemExtentBuilder` function.


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

[User] In Flutter, how do we build a `RenderBox` to display a texture from an external source (e.g., camera flow or a local video file) with support for freezing and setting filter quality? Structure the basic behaviors (sizing, layout, painting, hit testing).


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

[User] In Flutter, design a reusable and expandable abstract class `ViewportOffset` and a concrete implementation `_FixedViewportOffset` to control scroll offsets and strategies. Define the necessary abstract methods, their parameters, and how they handle scroll direction changes.


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

[User] Implement the `BackgroundIsolateBinaryMessenger` class in Flutter to manage asynchronous messaging through platform channels in background isolates. The implementation should include `ensureInitialized` using a `RootIsolateToken`, message sending using `Completer` and `PlatformDispatcher`, and an unsupported `setMessageHandler` method.


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

[User] How should the `BackgroundIsolateBinaryMessenger` class be implemented for the Dart Web platform so that its `instance` getter and `ensureInitialized` method throw an `UnsupportedError` indicating that isolates are not supported on the web?


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

[User] How is Flutter's autofill API structured to manage and configure platform-level autofill (Android, iOS) consistently? Detail the classes, abstract classes, constants, mixins, and configuration objects (such as AutofillHints, AutofillConfiguration, AutofillClient, AutofillScope) and how they integrate with TextInput.


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

[User] In a Flutter application, how can we assign the value of the `FLUTTER_APP_FLAVOR` environment variable to a null-safe constant `appFlavor` during compilation, handling the case where the variable might not be set?


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

[User] In a Flutter application, how do you trigger different types of haptic feedback (e.g., general vibration, light impact, medium impact, heavy impact, selection click) using the platform channel (`SystemChannels.platform`)? Provide a class with separate asynchronous functions (`vibrate`, `lightImpact`, `mediumImpact`, `heavyImpact`, `selectionClick`) that call `HapticFeedback.vibrate` with different arguments (or without arguments) to achieve this.


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

[User] Design a reusable and customizable class in Flutter to manage mouse interactions (enter, exit, hover) and cursor behavior. The class should process mouse events (such as `PointerEnterEvent`, `PointerExitEvent`, and `PointerHoverEvent`) and cursor states (like `MouseCursor.defer`), while supporting debugging and monitoring by mixing in `Diagnosticable`.


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

[User] In Flutter, how can we design a reusable and testable API to trigger platform-specific system sounds using `SystemChannels.platform`, a `SystemSoundType` enum, and a `SystemSound.play()` method?


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

[User] Implement a custom `TextSelection` class in Dart that extends `TextRange`. It should be immutable and include properties for `baseOffset`, `extentOffset`, `affinity`, and `isDirectional`. Provide constructors (including a collapsed constructor and fromPosition), getters for `base` and `extent` as `TextPosition` objects, and methods like `copyWith`, `expandTo`, and `extendTo`. Also, override `operator ==`, `hashCode`, and `toString` to ensure correct equality and representation.


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

[User] How do you structure the HtmlElementView implementation for non-web platforms in Flutter so that attempting to instantiate it (e.g., via createFromTagName) or build it throws an UnimplementedError?


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

[User] In Flutter, how do you design and implement a reusable and customizable `ColorFiltered` widget using `SingleChildRenderObjectWidget` and `RenderProxyBox` to optimize performance and handle compositing? Provide an implementation that follows best practices.


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

[User] In a Flutter application, design the `ContextMenuButtonItem` class and `ContextMenuButtonType` enum to manage text field context menu actions (such as cut, copy, paste). The enum should support standard actions (`cut`, `copy`, `paste`, `selectAll`, `delete`, `lookUp`, `searchWeb`, `share`, `liveTextInput`) and a `custom` option. The `ContextMenuButtonItem` class should include a callback function (`onPressed`), the action type (`type`), and an optional `label`.


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

[User] Implement a `ContextMenuController` class in Flutter to manage context-sensitive menus. It should ensure only a single context menu is shown at a time using static tracking, manage an `OverlayEntry`, capture inherited themes using `InheritedTheme.capture`, and provide methods to show, remove, and rebuild the menu.


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

[User] In a Flutter application, how do you design and manage text selection behavior using an `InheritedTheme` widget called `DefaultSelectionStyle`? Specifically, how do you provide default values (such as `cursorColor`, `selectionColor`, and `mouseCursor`), find the closest theme in the widget tree, trigger reconstruction when values change, and prevent potential errors related to the use of `DefaultSelectionStyle.fallback()`?


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

[User] In Flutter, how do you design a reusable and customizable widget like `DualTransitionBuilder` that applies different transition effects depending on the animation direction (forward or reverse)? Explain how to manage complex transitions using `AnimationStatus`, `ProxyAnimation`, and `ReverseAnimation` while maintaining performance and consistency in the widget tree.


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

[User] How can you implement a customizable `FlutterLogo` widget in Flutter that takes size, text color, style (`FlutterLogoStyle`), animation duration, and curve as parameters, retrieves default size from `IconTheme`, animates changes using `AnimatedContainer`, and defines its visual design using `FlutterLogoDecoration`?


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

[User] How can we implement a performant `ImageFiltered` widget in Flutter that minimizes the creation and redrawing of unnecessary compositing layers by dynamically toggling compositing and repaint boundary behaviors based on an `enabled` flag?


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

[User] In Flutter, how is the mechanism designed to transport InheritedThemes from one widget tree context ('from') to another ('to') while avoiding duplicate applications, respecting the restriction that 'to' must be an ancestor of 'from', and ensuring a reusable, high-performance implementation?


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

[User] In Flutter, how is the `LookupBoundary` mechanism designed and applied to limit access to and control the lookup of ancestor elements (such as InheritedWidgets, Widgets, States, or RenderObjects) in the widget tree? Explain how it affects tree navigation methods and how it can be used to detect hidden ancestors in debug tools, providing a complete implementation.


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

[User] In Flutter, how do we use the `CustomMultiChildLayout` and `MultiChildLayoutDelegate` classes to create a customizable navigation toolbar (with leading, middle, and trailing widgets) that is sensitive to text direction (RTL/LTR), supports centering the middle widget (`centerMiddle`), and handles spacing (`middleSpacing`) consistently across different screen sizes?


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

[User] In Flutter, how do you design a reusable and customizable `NavigatorPopHandler` widget to intervene in a Navigator's pop process, prevent pop operations under certain conditions, or run callback functions when a pop occurs? The design should support both the deprecated `onPop` and the newer `onPopWithResult` callbacks. By listening to `NavigationNotification` and using the `PopScope` widget, how do you dynamically control the `canPop` behavior, handle the `didPop` argument, and ensure null safety and type safety?


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

[User] In order to create a widget that can be dynamically arranged according to SliverConstraints in Flutter, how do you design the `_RenderSliverLayoutBuilder` render object using the `ConstrainedLayoutBuilder` class? Based on `SliverConstraints`, how do you secure the positioning and drawing of the child widget in the scrollable area by correctly applying `childMainAxisPosition` and `applyPaintTransform` methods while implementing rendering stages such as `performLayout`, `hitTestChildren`, and `paint`?


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

[User] In Flutter, how can we design a reusable widget called `Spacer` to create a flexible gap in a Row or Column, customizing its flexibility using a `flex` parameter, and implementing it using `Expanded` and `SizedBox.shrink()`?


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

[User] How can we implement a robust and flexible undo/redo history mechanism in Flutter for text fields or editable content? Provide an implementation of `UndoHistory`, `UndoHistoryState`, `UndoHistoryController`, and an underlying undo stack that handles focus behavior, change tracking conditions, and throttled updates.


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

[User] Write a comprehensive unit test suite using `flutter_test` to verify the behavior of Flutter's `Tween` class and its specialized subclasses (such as `ColorTween`, `RectTween`, `IntTween`, `StepTween`, `Matrix4Tween`, `ConstantTween`, `ReverseTween`, `CurveTween`, `BorderRadiusTween`, and `BorderTween`). The tests should cover error handling for unsupported types, chaining, animating, driving, and interpolation (lerp) behavior.


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

[User] How can you write a Flutter widget test to demonstrate the usage of `debugCheckHasCupertinoLocalizations` and verify that it throws an assertion error when CupertinoLocalizations are not available in the context, but succeeds when they are?


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

[User] In Flutter, when we customize the appearance of icons by using `IconTheme` in a widget tree, we can access these themes with the method `IconTheme.of(context)`. How can we adjust icon theme features (size, color, opacity, etc.) using both the basic `IconThemeData` and the platform-specific `CupertinoIconThemeData`, and how do we resolve these settings correctly through `IconTheme.of(context)` (for example, resolving `CupertinoIconThemeData` based on `platformBrightness`)?


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

[User] How can we control and test the visual behavior of the `CupertinoPopupSurface` widget (including color filters, surface color, blur, and transparency) and their interactions with `brightness` theme, `debugIsVibrancePainted`, `isSurfacePainted`, and `blurSigma` across different platforms to ensure consistency with the iOS design language?


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

[User] How can I design and implement a robust widget test suite in Flutter to verify the behaviors, customization options, and properties of the CupertinoSearchTextField widget (such as decoration, prefix/suffix icons, padding, controller, keyboard type, cursor properties, and scroll animations)?


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

[User]
In Flutter, when applying the iOS-style spelling inspection suggestion toolbar (CupertinoSpellCheckSuggestionsToolbar), we should write certain unit and widget tests to verify the behavior of the toolbar:
1. How can we require the display of maximum three suggestions in the toolbar and how can we test that an error occurs if this restriction is exceeded?
2. How can we verify that the toolbar correctly displays the first three suggestions proposed by spelling inspection in the current text field?
3. When no suggestions are presented by the spelling inspection, how can we test the "No Replacements Found" button on the toolbar?
4. How do we handle skipping these tests on the web platform (using kIsWeb)?


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

[User] Flutter'da`cupertinotabview`widget'in different navigation scenarios (eg,`Home`,`Routes`,`ongerereteroute`,`sknownroute`uses,`navigator`switch with the navigation, status restore and Android button processing and how to test the testing, this is the test. How can I write the unit tests that explain the behavior and possible exceptions of each (for example, the situation of`null''null`s)?


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

[User] In Flutter, how do you design and implement a comprehensive widget test scenario to verify that a `CupertinoTextField` correctly restores its state (including text content and scroll position) after app restoration? The test should cover scenarios with and without an external `RestorableTextEditingController`, and include keyboard input, scrolling, and state restoration using `WidgetTester.restartAndRestore` and `RestorationData`.


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

[User] In Flutter, how can we test the state restoration behavior (including text content, scrolling location, and validation errors) of `CupertinoTextFormFieldRow` under different scenarios, such as with or without an external `TextEditingController` or Form ancestor? Provide widget tests that demonstrate how to verify that the state is correctly restored.


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

[User] Write a comprehensive suite of Flutter widget tests for CupertinoTextFormFieldRow to verify its behavior, user interactions, and form validation scenarios, ensuring it correctly passes properties to the underlying CupertinoTextField.


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

[User] Explain how the `CachingIterable` class works on a `range` generator function with various `Iterable` methods (`where`, `map`, `skip`, `take`, `expand`). Write unit tests that verify the value of the `yieldCount` variable in the `range` function across different scenarios. These tests should verify the correct operation of `CachingIterable`'s lazy evaluation and caching behavior on multiple reads.


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

[User] Write Dart unit tests to verify the behavior of `listEquals`, `setEquals`, `mapEquals`, `binarySearch`, and `mergeSort` from `package:flutter/src/foundation/collections.dart`. The tests should cover null values, identical and different collections, and special cases, using `expect` with matchers like `isTrue`, `isFalse`, `equals`, and `lessThanOrEqualTo`.


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

[User] How can we comprehensively test the logic of processing data from an `HttpClientResponse` using `consolidateHttpClientResponseBytes`? Specifically, how do we verify scenarios involving `contentLength`, `compressionState`, `autoUncompress`, `onBytesReceived` interactions, and error handling (both from `HttpClientResponse` and `onBytesReceived` callbacks) using a `MockHttpClientResponse` and `expect` assertions?


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

[User] How do I write a Flutter test to verify the value of the `kIsWeb` constant in a test environment?


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

[User] Write a comprehensive unit test suite for Flutter's `GestureArenaManager` to verify gesture arena resolution. The tests should cover timing sensitivity (e.g., calling `resolve` before or after `close`), different `GestureDisposition` values, and hold/release/sweep behaviors. Implement a `TestGestureArenaMember` class to track `acceptGesture` and `rejectGesture` calls using boolean flags, and use a `primaryKey` constant for the arena key.


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

[User] Write Flutter unit and widget tests to verify the behavior of the `debugPrintGestureArenaDiagnostics` and `debugPrintRecognizerCallbacksTrace` flags during the gesture arena lifecycle of `TapGestureRecognizer`, including pointer addition, sweeping, and exceeding deadlines.


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

[User] How can we design and implement a test in Flutter to verify pointer event resampling using `GestureBinding`? Provide a custom `TestResampleEventFlutterBinding` that uses a custom `SamplingClock` to control timing, processes a `PointerDataPacket`, and verifies that the generated `PointerEvent`s have the correct timestamps, positions, and types when `resamplingEnabled` and `samplingOffset` are configured.


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

[User] How does Flutter process and convert raw pointer data from different input devices (touch, mouse, stylus) into consistent PointerEvents? Provide a comprehensive suite of unit tests demonstrating how PointerEventConverter.expand handles screen density, faulty scroll data, primary button synthesis, and pan/zoom events.


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

[User] Design a comprehensive set of Flutter unit and widget tests to verify the behavior of `DragGestureRecognizer` and its arena interactions. Specifically, cover: 1) Arena resolution and threshold control (`onlyAcceptDragOnThreshold`), 2) Input filtering using `allowedButtonsFilter` (e.g., primary vs. secondary mouse buttons), and 3) Custom gesture recognizers (like an eager pan recognizer) interacting with a `CustomScrollView`.


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

[User] In a Flutter application, how is the `PointerRouter` class designed to manage both per-pointer and global callbacks, handle re-entrant scenarios (such as adding/removing routes during routing), and apply event transformation matrices (Matrix4)? Provide a comprehensive test suite covering these scenarios.


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

[User] In Flutter, how can we design and implement comprehensive, well-structured unit tests for custom `GestureRecognizer` and `PrimaryPointerGestureRecognizer` subclasses? Specifically, provide a test suite that covers winning the arena, losing the arena, and recycling the recognizer, while also verifying memory leak prevention using leak tracking.


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

[User] Write comprehensive Flutter unit tests for `PointerEventResampler` to test the resampling and interpolation of `PointerEvent`s. The tests should cover different scenarios in detail, including basic movements, rapid touches (quick taps), slow and rapid progress, event jumps (skips), stopping, synthetic movements, and different sampling timings. Ensure the tests verify how event characteristics (location, delta, timestamp, buttons, etc.) are calculated.


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

[User] In Flutter, how do you write unit tests for `SerialTapGestureRecognizer` to verify its interaction with other gesture recognizers (such as `TapGestureRecognizer`, `DoubleTapGestureRecognizer`, and custom recognizers), handling of `kSerialTapDelay`, touchpoint distance, different mouse buttons, and gesture arena priority conflicts? Provide a comprehensive test suite.


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

[User] In Flutter, how does placing a GestureDetector inside a Transform.scale widget affect the evaluation of kDoubleTapSlop? Provide widget test scenarios to verify how double-tap perception accuracy is evaluated under different scaling factors (both enlargement and reduction).


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

[User] In Flutter, how should a comprehensive test scenario be designed to verify the customization of action buttons (BackButton, CloseButton, DrawerButton, EndDrawerButton) using ActionIconTheme and ActionIconThemeData? The tests should verify the `copyWith` method, `debugFillProperties`, default values, and the correct functionality of the theme when applied via ThemeData or ActionIconTheme widget.


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

[User] In Flutter, how do you test and verify the customization of the `Badge` widget's visual features (such as background color, text color, size, text style, padding, alignment, and offset) applied globally via `ThemeData` and locally via `BadgeTheme`? The tests should cover `BadgeThemeData`'s `copyWith`, `lerp`, default values, `debugFillProperties` behavior, and verify the priority and visual effects (size, position, style) when these themes are applied in the widget tree.


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

[User] Flutter'da, `DesktopTextSelectionToolbar` widget'inin `anchor` parametresi ile belirtilen konuma doğru şekilde konumlandığını ve bu konumlandırmanın, toolbar üzerindeki ilk `DesktopTextSelectionToolbarButton` widget'inin sol üst köşesinin, belirtilen `anchor` offset'i ile tam olarak eşleştiğini doğrulayan bir test yazın. Bu senaryoda `DesktopTextSelectionToolbar` widget'ı bir `MaterialApp` ve `Center` widget'ları içinde yer almalı ve en az bir tıklanabilir buton içermelidir.


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

[User] Write a comprehensive suite of Flutter widget tests for `DropdownButtonFormField` to verify its behavior under various scenarios, including: when `disabledHint` is used, when the `items` list is empty or null, when `onChanged` is null, custom styling and icon sizes, different `AutovalidateMode` values, shadow/elevation rendering, `onTap` callbacks, form reset behavior, and the effect of `ButtonTheme.alignedDropdown`.


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

[User] Write a comprehensive Flutter widget test suite for the `ExpandIcon` widget. The tests should cover expected behavior and customization options across different scenarios, including Material 2 vs Material 3, light and dark themes, the `onPressed` callback, the `isExpanded` property, accessibility (semantics), sizing, and color options (default, active, disabled).


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

[User] In Flutter, how do you design and implement a comprehensive test scenario to verify the `FlexibleSpaceBar` widget's `stretch` feature and `StretchMode` enum values (`zoomBackground`, `blurBackground`, `fadeTitle`)? The tests should verify how these features interact with different `ScrollPhysics` (specifically `BouncingScrollPhysics` and `ClampingScrollPhysics`), covering the stretching behavior, Golden File comparisons, opacity changes, and size changes.


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

[User] In Flutter, how do we write a widget test to verify that a GridTile widget with a header and footer is correctly arranged, that the header and footer display the expected text, that the header is positioned above the footer, and that a simple GridTile can be rendered? Use unique keys to confirm their relative positions.


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

[User] How do you design and implement comprehensive automated widget tests in Flutter to verify how `InheritedTheme.captureAll()` preserves thematic features (such as `ThemeData`, `PopupMenuThemeData`, `MaterialBannerThemeData`, `DividerThemeData`, `ListTileThemeData`, `SliderThemeData`, and `ToggleButtonsThemeData`) when navigating to new routes?


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

[User] In Flutter applications, accessibility and internationalization (i18N) requirements, in order to ensure that the materials design components are translated into different languages consistently and complete and provide appropriate localization support, the Flutter Framework's MaterialLoCalizations Class (or any specific language) application of the MaterialLochalizations class (or any specific language) application of the assumed English (or any specific language), label, labels, labels, labels dates, keyboard keys, accessibility texts, etc.) What kind of comprehensive and automated tests should be applied to verify that it has non-Null values, protects the expected text formats and does not throw exceptions in case of incorrect input?


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

[User] Explain how to use `MaterialStateMixin` in Flutter to dynamically update a widget's color based on different `MaterialState`s (such as pressed, focused, hovered). Provide a complete example showing how to use `updateMaterialState` with a `StreamController<bool>` to update the state, and write widget tests to verify that the color changes correctly for each `MaterialState`.


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

[User] How can we write unit tests for `MaterialStatesController` to verify its constructor, state updates with `update()`, listener notifications, and proper memory disposal using `leak_tracker_flutter_testing`?


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

[User] In Flutter, how should a comprehensive test scenario be designed to verify the interaction and priority behaviors of `MenuBar`, `MenuTheme`, and `MenuBarTheme` widgets, specifically regarding style features (such as `backgroundColor`, `elevation`, `shape`, `padding`, and `foregroundColor`) when overridden by constructor parameters?


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

[User] In Flutter, demonstrate the different mechanisms used to customize the style of the `OutlinedButton` component (for example, direct style with `styleFrom`, `OutlinedButtonTheme`, and `ThemeData` overrides) and their relative priorities. For both Material Design 2 and Material Design 3, create a comprehensive set of widget tests that verify the appearance and behavior of `OutlinedButton` (including colors, shadows, shapes, dimensions, text styles, alignment, mouse cursor, touch feedback, animation duration, target size, and icon alignment) and how these styling mechanisms interact.


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

[User] In Flutter, how do you test and verify the behavior of persistent and modal BottomSheets created using `Scaffold.bottomSheet` and `showBottomSheet`? Provide widget tests that verify their interactions with `FloatingActionButton`, `DraggableScrollableSheet`, `ScaffoldFeatureController.setState`, visual properties, re-creation optimizations, and `MediaQuery` padding.


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

[User] In Flutter, in order to provide consistent and customizable popupmenubutton behavior for both Material Design 2 (m2) and Material Design 3 (m3), the different features of Popupmenuthemedata (Color, Shape, Elevation, TextStyle, TextStyle, TextStyle, TextStyle, TextStyle, Mousecursor, Iconcolor, Iconcolor, Iconcolor, Iconcolor, Iconcolor ShadowColor, Surfacetintcolor, etc.) How can we control both the assumed theme values and the values specified directly specified in Popupmenubutton Widget and how these features interact with each other, especially in the materialstate (eg, enabled, disabled), taking into account the changing styles, mouse cursor behaviors and different platforms. How can we confirm with a comprehensive test strategy?


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

[User] Write a comprehensive suite of Flutter widget tests to verify the behavior of the `RefreshIndicator` widget under various scrolling scenarios (such as normal, reverse, nested, and bouncing physics) and customizable properties (such as trigger mode, color, stroke width, edge offset, and adaptive behavior).


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

[User] Write comprehensive Flutter widget tests to verify the behavior of `SwitchThemeData` and `SwitchTheme` in both Material Design 2 and Material Design 3. The tests should cover properties such as `thumbColor`, `trackColor`, `trackOutlineColor`, `trackOutlineWidth`, `materialTapTargetSize`, `overlayColor`, `splashRadius`, `thumbIcon`, and `padding`. Ensure you test how local `SwitchTheme` overrides the global `ThemeData.switchTheme`, how properties resolve under different `MaterialState` configurations (selected, focused, hovered, pressed), and verify the visual differences using canvas painting assertions.


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

[User] Provide a set of Flutter testing utilities, custom widgets, and helper functions to test TabBar and TabController interactions. This should include helpers for retrieving tab text, creating controllers, tracking state lifecycles (initState, didUpdateWidget, dispose), testing AutomaticKeepAliveClientMixin, mocking scroll physics, and custom indicator painting/animations (such as elastic RRect animations).


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

[User] In Flutter, when a `TextField` widget's `helperText` is initially set to a value and then updated to `errorText` with the same value, both texts can temporarily coexist in the widget tree during the transition animation. How do you write a widget test to simulate this transition, handle the animation delay, and verify that both widgets are temporarily present?


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

[User] In Flutter, using the restoration mechanisms of `TextField` and `Scrollable` widgets, with both internal and external `TextEditingController` instances, the `TextField` content and scroll position are preserved after application restart. How can a comprehensive test scenario be created using `testWidgets` and `RestorationMixin` to test how the user's text input and scroll actions affect the restoration process?


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

[User] How do you write a comprehensive Flutter widget test to verify that a custom InteractiveInkFeatureFactory (such as a custom InkSplashFactory) configured in the theme successfully prevents InkSplash creation and cancellation when interacting with TextField widgets (e.g., tapping or dragging), without affecting standard behaviors?


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

[User] In Flutter, we can provide the status of Textformfields (Text content, Scroll position, validation errors) restoration API with both internal and external TexteditingController, and how to provide it with different Autovalidatemode options, without the top element of the form. (a) showing error messages during validation as a result of user interaction, (b)`Validate ()`not to trigger validation until the method is called, (c) protection of the scroll position, and (d) during the restoration of the text content and error messages correctly, and different device configurations of these processes (screen sizes) Closing and opening, hot restart) How can it be tested and verified?


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

[User] Flutter'da, TextSelectionToolbarTextButton widget'ının toolbar içerisindeki konumuna (ilk, orta, son, tek) göre genişliğinin, varsayılan/özel renklerinin (foreground ve background) doğru şekilde ayarlandığını ve ThemeData'daki TextButtonThemeData'nın bu widget'ın varsayılan arka plan rengini geçersiz kılmadığını doğrulayan bir widget testi nasıl yazılır?