11019 Commits

Author SHA1 Message Date
Sulav Parajuli
a9f9136633
Fix #141061: Add 'color' property to DrawerButton and EndDrawerButton (#141159)
## Description

This PR addresses issue #141061, which requested the addition of a 'color' property to buttons extending _ActionButton. The 'color' property has been introduced to enhance customization options for these buttons.

## Issues Fixed

- Fixes #141061
2024-01-16 10:08:27 +00:00
auto-submit[bot]
8e94423e6a
Reverts "BoxPainter should dispatch creation and disposal events." (#141545)
Reverts flutter/flutter#141526
Initiated by: CaseyHillers
This change reverts the following previous change:
Original Description:
### Description
- Adds `BoxPainter` creation and disposal events dispatching for memory leak tracking as part of https://github.com/flutter/flutter/issues/141198

### Tests
- Updates `decoration_test.dart` to test `BoxPainter` object creation and disposal events dispatching.
2024-01-15 01:53:26 +00:00
Kostia Sokolovskyi
e5f62cc5a0
Private disposables should dispatch creation and disposal events. (#141535) 2024-01-14 13:24:50 -08:00
Kostia Sokolovskyi
1a2c3151fe
BoxPainter should dispatch creation and disposal events. (#141526) 2024-01-14 10:07:10 -08:00
Anis Alibegić
81d80c587d
Fixed a lot of typos (#141431)
Fair amount of typos spotted and fixed. Some of them are in comments, some of them are in code and some of them are in nondart files.

There is no need for issues since it's a typo fix.

I have doubts about [packages/flutter_tools/lib/src/ios/core_devices.dart](https://github.com/flutter/flutter/compare/master...anisalibegic:flutter:master#diff-fdbc1496b4bbe7e2b445a567fd385677af861c0093774e3d8cc460fdd5b794fa), I have a feeling it might broke some things on the other end, even though it's a typo.
2024-01-12 22:10:25 +00:00
auto-submit[bot]
8f797fc379
Reverts "Remove hack from PageView." (#141479)
Reverts flutter/flutter#141138
Initiated by: itsjustkevin
This change reverts the following previous change:
Original Description:
Fixes https://github.com/flutter/flutter/issues/141119

The change is breaking, because now controller is nullable.

Migration path: https://github.com/flutter/website/pull/10033

Packages to fix:
2024-01-12 21:19:18 +00:00
Polina Cherkasova
2da87e6108
Remove hack from PageView. (#141138) 2024-01-12 09:47:34 -08:00
Mairramer
f40a99ce7e
Adds support for StepStyle visual property bundle to the Step widget (#140825)
Fixes  #140770 and #103124

Adds the possibility of passing a height and width to icons. And also a margin for the distance of the lines between the icons.
2024-01-12 16:35:08 +00:00
Taha Tesser
e20d34c38a
Fix FlexibleSpaceBar centered title position and title color (#140883)
fixes [Invisible SliverAppBar title in Material 3 light theme](https://github.com/flutter/flutter/issues/138296) 
fixes [`FlexibleSpaceBar` title is misaligned without the leading widget](https://github.com/flutter/flutter/issues/138608)

Previous attempt https://github.com/flutter/flutter/pull/138611

--- 

### Description

 - fixes the `FlexibleSpaceBar` centered title position when there is a leading widget.
 - fixes the `FlexibleSpaceBar` title color for Material 3.
 - Added documentation when using a long `FlexibleSpaceBar` title and update its test.
 - Improved documentation of default title padding.

### Code sample

### Code sample

<details>
<summary>expand to view the code sample</summary> 

```dart
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Example(),
    );
  }
}

class Example extends StatelessWidget {
  const Example({super.key});

  @override
  Widget build(BuildContext context) {
    return const Scaffold(
      body: SafeArea(
          child: CustomScrollView(
        slivers: <Widget>[
          SliverAppBar(
            leading: Icon(Icons.favorite_rounded),
            flexibleSpace: FlexibleSpaceBar(
              title: ColoredBox(
                color: Color(0xffff0000),
                child: Text('SliverAppBar'),
              ),
            ),
          ),
        ],
      )),
    );
  }
}
```

</details>

###  Before

![Screenshot 2024-01-03 at 18 02 25](https://github.com/flutter/flutter/assets/48603081/92ae1062-c78f-4005-8e28-85af617acd60)

### After

![Screenshot 2024-01-03 at 18 02 16](https://github.com/flutter/flutter/assets/48603081/2ef97108-9b50-44f7-a303-018ff1b28db6)
2024-01-12 13:29:13 +00:00
Taha Tesser
8dcae5ace4
Fix ListWheelScrollView in an AnimatedContainer with zero height throw an error (#141372)
fixes [`ListWheelScrollView` Throws Unexpected Error Inside `AnimatedContainer`](https://github.com/flutter/flutter/issues/140780)
fixes [`CupertinoDatePicker` throw exception when parent height is 0](https://github.com/flutter/flutter/issues/55630)

### Code sample

<details>
<summary>expand to view the code sample</summary> 

```dart
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: AnimatedContainer(
          height: 0,
          duration: Duration.zero,
          child: ListWheelScrollView(
            itemExtent: 20.0,
            children: <Widget>[
              for (int i = 0; i < 20; i++) Container(),
            ],
          ),
        ),
      ),
    );
  }
}
```

</details>
2024-01-11 18:26:04 +00:00
Gianluca Bettega
e281c39164
Expose 'enable' property to allow the user to disable the SearchBar (#137388)
This exposes the `enabled` property of the `TextField` widget to the `Searchbar` widget.

## Related Issues

https://github.com/flutter/flutter/issues/136943

Still missing tests
2024-01-11 17:58:50 +00:00
Kate Lovett
a94c14e063
Add covariants to reduce subclass casts in 2D APIs (#141318)
While working in https://pub.dev/packages/two_dimensional_scrollables, I found I could eliminate some casts if we added covariants here in the framework.
Much of the 2D aPI in the framework is abstract, so I think it make sense to add these and make it easier/cleaner for subclasses using the APIs.
I made a similar change in https://github.com/flutter/flutter/pull/131358, this would cover all of the cases I could find so its nice and accommodating now.
2024-01-10 23:28:48 +00:00
Justin McCandless
865825c3c1
Call onPopInvoked when pages API is used (#141221)
(Predictive Back) Fixes a bug where when using PopScope and Navigator.pages together, onPopInvoked wasn't being called.
2024-01-10 14:29:30 -08:00
Igor Hnízdo
7efed85b35
NestedScrollView's outer scrollable jumping with BouncingScrollPhysics due to double precision errors (#138319)
This PR fixes scrolling issues with `NestedScrollView` using the `BouncingScrollPhysics`. In one of the steps of the calculation, we can reach a state where the position of the inner scrollable is set to a `double` value that falls within `precisionErrorTolerance` of `0` but we were using `==` with `0` rather than checking for a precision. My posts in the linked issue show the current behavior, and how I reached to conclusion (the code in this PR). This PR only addresses the "jumping" of the outer scrollable.  

Fixes #136199

I have not finished a test for this since I have never done so and therefore have 0 experience writing tests in Flutter, so any help there would be appreciated. I am also not sure how to test double precision errors in general. I did run all the nested_scroll_view_tests.dart locally and there are no failures.
2024-01-10 00:28:09 +00:00
Chris Bobbe
8d2aca385f
TextStyle: In copyWith, stop ignoring debugLabel when receiver has none (#141141)
Fixes #141140.

This ensures that if you call `.copyWith` and pass a `debugLabel`, the `debugLabel` won't be ignored, even if the receiver (the TextStyle you're calling `.copyWith` on) doesn't have a `debugLabel`.

The debugLabel field was added in #12552. I skimmed the discussion there and didn't find anything indicating that the param was being ignored on purpose.

I added a test case that passes with the new code and fails with the old code.
2024-01-09 23:21:24 +00:00
Kevin Moore
0cef3f1629
Correctly handle null case in ProcessText.queryTextActions (#141205)
Replace `as Map<Object?, Object?>` to handle nullable case
Fixes runtime issue in Wasm

*Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.*

*List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.*

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
2024-01-09 22:25:54 +00:00
Michael Goderbauer
4534a24c09
Reapply "Dynamic view sizing" (#140165) (#140918)
This reverts commit
d24c01bd0c.

The original change was reverted because it caused some apps to get
stuck on the splash screen on some phones.

An investigation determined that this was due to a rounding error.
Example: The device reports a physical size of 1008.0 x 2198.0 with a
dpr of 1.912500023841858. Flutter would translate that to a logical size
of 527.0588169589221 x 1149.2810314243163 and use that as the input for
its layout algorithm. Since the constraints here are tight, the layout
algorithm would determine that the resulting logical size of the root
render object must be 527.0588169589221 x 1149.2810314243163.
Translating this back to physical pixels by applying the dpr resulted in
a physical size of 1007.9999999999999 x 2198.0 for the frame. Android
now rejected that frame because it didn't match the expected size of
1008.0 x 2198.0 and since no frame had been rendered would never take
down the splash screen.

Prior to dynamically sized views, this wasn't an issue because we would
hard-code the frame size to whatever the requested size was.

Changes in this PR over the original PR:

* The issue has been fixed now by constraining the calculated physical
size to the input physical constraints which makes sure that we always
end up with a size that is acceptable to the operating system.
* The `ViewConfiguration` was refactored to use the slightly more
convenient `BoxConstraints` over the `ViewConstraints` to represent
constraints. Both essentially represent the same thing, but
`BoxConstraints` are more powerful and we avoid a couple of translations
between the two by translating the` ViewConstraints` from the
`FlutterView` to `BoxConstraints` directly when the `ViewConfiguration`
is created.

All changes over the original PR are contained in the second commit of
this PR.

Fixes b/316813075
Part of https://github.com/flutter/flutter/issues/134501.
2024-01-09 14:10:43 -08:00
SharbelOkzan
0c40f21fc5
Introduce new Form validation method (#135578)
Introduced `validateGranually` which, apart from announcing the errors to the UI, returns a `Map<Key, bool>` providing more granular validation details: The results of calling `validate` on each `FormField` and their corresponding widget keys.

* related issue: #135363
2024-01-09 21:10:04 +00:00
Taha Tesser
536de5ed91
Update RouteObserver example and fix an error thrown (#141166)
fixes [`RouteObserver` example throws an error](https://github.com/flutter/flutter/issues/141078)

### Description
This updates the `RouteObserver` example from snippet to Dartpad example and fixes the error when running the code snippet
2024-01-09 20:48:56 +00:00
Nishant Kumar
83cf44ed12
resolved the issue of indeterminate CircularProgressIndicator.adaptive on Darwin (#140947)
Fixes #140574

Passes the value from `CircularProgressIndicator` to the Cupertino version so that functionality is not lost on Apple devices.
2024-01-09 18:19:07 +00:00
Bruno Leroux
5f17badf41
[Android] Add custom system-wide text selection toolbar buttons for SelectableRegion (#141103)
## Description

This PR adds custom system-wide text selection toolbar buttons on Android for `SelectableRegion` and `SelectionArea`.

https://github.com/flutter/flutter/pull/139738 adds those buttons for `EditableText` (which is used by `TextField` and `SelectableText` but not by `SelectionArea`).

## Related Issue

Step 5 for https://github.com/flutter/flutter/issues/139361

## Tests

Adds 2 tests.
2024-01-09 09:49:13 +00:00
Bruno Leroux
2e6aac6ee6
Fix spell check throws when text contains regex reserved characters (#140384)
## Description

This PR fixes an issue related to the spell check implementation usage of Regex (searched text should be escaped).

## Related Issue

Fixes https://github.com/flutter/flutter/issues/136032.

## Tests

Adds 1 test.
2024-01-09 08:59:20 +00:00
asci
3b7ed0006c
[docs] Add document content related to chip shape (#140015)
(#139572)  I would like to request an update to the document to resolve confusion.
I actually modified the code by applying priority as in the comment in [#139572](https://github.com/flutter/flutter/issues/139572) as shown below, but I thought that if 'OutlinedBorder' was used for 'shape', the default value of side for 'OutlinedBorder' was also the developer's intention.

```
OutlinedBorder _getShape(ThemeData theme, ChipThemeData chipTheme, ChipThemeData chipDefaults) {
  final BorderSide? resolvedSide =
      MaterialStateProperty.resolveAs<BorderSide?>(widget.side, materialStates)
          ?? MaterialStateProperty.resolveAs<BorderSide?>(chipTheme.side, materialStates);
  final BorderSide? resolvedShapeSide =
      MaterialStateProperty.resolveAs<BorderSide?>(widget.shape?.side, materialStates)
          ?? MaterialStateProperty.resolveAs<BorderSide?>(chipTheme.shape?.side, materialStates);
  final OutlinedBorder resolvedShape =
      MaterialStateProperty.resolveAs<OutlinedBorder?>(widget.shape, materialStates)
          ?? MaterialStateProperty.resolveAs<OutlinedBorder?>( chipTheme.shape, materialStates)
          ?? MaterialStateProperty.resolveAs<OutlinedBorder?>(chipDefaults.shape, materialStates)
          // TODO(tahatesser): Remove this fallback when Material 2 is deprecated.
          ?? const StadiumBorder();
  // If the side is provided, shape uses the provided side.

  if (resolvedSide != null) {
    return resolvedShape.copyWith(side: resolvedSide);
  }
  if (resolvedShapeSide != null) {
    return resolvedShape.copyWith(side: resolvedShapeSide);
  }
  // If the side is not provided
  // then the shape's side is used. Otherwise, the default side is used.
  return resolvedShape.copyWith(side: chipDefaults.side);
}
```
(in `chip.dart`)

However, (#133856)  PR seems to be intended to ignore this and use the aspect of `chipDefault.side` even if the developer specifies `shape.side` as [Border.none] without explicitly applying `side` .
This is probably because the default value of OutlinedBorder is [Border.none].
I think this is an area that can cause enough confusion, but there are a lot of things that need to be modified to reduce confusion through code changes, and the impact on existing code is likely to be significant.
I also confirmed that this is not accurately explained in the API Docs.
So rather than modifying the code, I decided to add additional explanation to the `shape` comment.
If the results are different from what you intended or the updated content is strange, please review. 🙏
2024-01-08 23:06:10 +00:00
Luke Hutchison
0d6927cb61
Fix refresh cancelation (#139535)
Changes drag release logic so that an armed refresh is only canceled if the user has scrolled back up beyond the point where the refresh indicator was armed. (Fixes https://github.com/flutter/flutter/issues/138848.)

This is the minimal change I found could be made to restore something like the behavior that I would expect.

This may still need a bit of work, because it only masks the second issue I mentioned, that releasing a drag can cause the scroll position to be animated back up from the release point. There is actually a bug about that: https://github.com/flutter/flutter/issues/6052. I would like to see that bug fixed too. This PR doesn't address that, but makes it harder to hit that issue.

@Piinks this is a recreation of #139015 (since I couldn't figure out some issue with a git detached branch, so I fixed the PR and I'm re-submitting it). This version includes one line that was somehow accidentally dropped from the original PR. This will hopefully fix the test failures.

However, I don't have a clue how to write a test for a Flutter UI widget. I'll try to figure that out, but also I don't have a lot of time to work on this. I would appreciate at least some user testing to verify that the new behavior is much more intuitive than the old behavior.

- [?] All existing and new tests are passing.
2024-01-05 21:28:07 +00:00
Taha Tesser
88016c11b4
Fix scrollable TabBar expands to full width when the divider is removed (#140963)
fixes [TabBar Expands to full width of the screen isScrollable: true after upgrading to flutter 3.16.4](https://github.com/flutter/flutter/issues/140338)

---

## Description

Fixes the scrollable `TabBar` width when the divider is removed. (when the divider height is set to `0` or divider color is set to `Colors.transparent`)

### Code sample

<details>
<summary>expand to view the code sample</summary> 

```dart
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    const int tabsCount = 2;

    return MaterialApp(
      home: DefaultTabController(
        initialIndex: 1,
        length: tabsCount,
        child: Scaffold(
          appBar: AppBar(
            title: const Text('TabBar Sample'),
            bottom: PreferredSize(
              preferredSize: const Size.fromHeight(48.0),
              child: ColoredBox(
                color: Theme.of(context).colorScheme.secondaryContainer,
                child:  TabBar(
                  // dividerColor: Theme.of(context).colorScheme.onSurface,
                  dividerColor: Colors.transparent, // remove divider
                  // dividerHeight: 0, // remove divider
                  isScrollable: true,
                  tabAlignment: TabAlignment.center,
                  tabs: <Widget>[
                    for (int i = 0; i < tabsCount; i++)
                      Tab(
                        text: 'Tab $i',
                      ),
                  ],
                ),
              ),
            ),
          ),
        ),
      ),
    );
  }
}
```

</details>

### Before
![Simulator Screenshot - iPhone 15 Pro - 2024-01-04 at 15 16 15](https://github.com/flutter/flutter/assets/48603081/b776e7e6-e5f0-49df-8a79-55032eaad631)

### After
![Simulator Screenshot - iPhone 15 Pro - 2024-01-04 at 15 16 23](https://github.com/flutter/flutter/assets/48603081/9ad13793-43a9-4ae8-977e-7cf84cb59bb1)
2024-01-05 08:33:26 +00:00
Qun Cheng
be8a1eac73
Add scrollbar for menus (#140941)
Fixes #140162

This PR is to add a scrollbar for MenuAnchor and DropdownMenu for all platforms when height is limited. Previously, a scrollbar only shows on desktop platforms. This PR also disabled scrollbar's overscroll for MenuAnchor and DropdownMenu.

<img src="https://github.com/flutter/flutter/assets/36861262/9ca3d4d0-415f-43bf-9d2b-df96a42db620" width="250"/><img src="https://github.com/flutter/flutter/assets/36861262/18da8d02-586b-4aa4-b647-927691542429" width="350"/>
2024-01-04 21:09:31 +00:00
Sharabiddin Ahmayev
2ae39c0cc0
Fix SegmentedButton states update logic (#140772)
This PR fixes: #140746

Desc: Style state update logic fix on SegmentedButton
2024-01-04 17:57:06 +00:00
Michael Goderbauer
ae4fb0ca7c
fix typo and reflow (#140925)
Fixes "differenet" => "different" and reflows the doc to 80 char line length.
2024-01-03 23:01:57 +00:00
yim
0d4eb5eaa0
Changes the regular cursor to a floating cursor when a long press occurs. (#138479)
This PR changes the regular cursor to a floating cursor when a long press occurs.

This is a new feature. Fixes  #89228
2024-01-03 21:45:07 +00:00
Furkan Acar
83ac76050d
Add SegmentedButton.styleFrom (#137542)
fixes https://github.com/flutter/flutter/issues/138289

---

SegmentedButtom.styleFrom has been added to the segment button, so there is no longer any need to the button style from the beginning. It works like ElevatedButton.styleFrom only I added selectedForegroundColor, selectedBackgroundColor. In this way, the user will be able to change the color first without checking the MaterialState states. I added tests of the same controls.

#129215 I opened this problem myself, but I was rejected because I handled too many items in a PR. For now, I wrote a structure that only handles MaterialStates instead of users.

old (still avaliable)
<img width="626" alt="image" src="https://github.com/flutter/flutter/assets/65075121/9446b13b-c355-4d20-bda2-c47a23d42d4f">

new (just an option for developer)
<img width="483" alt="image" src="https://github.com/flutter/flutter/assets/65075121/0a645257-4c83-4029-9484-bd746c02265f">

### Code sample

<details>
<summary>expand to view the code sample</summary> 

```dart
import 'package:flutter/material.dart';

/// Flutter code sample for [SegmentedButton].

void main() {
  runApp(const SegmentedButtonApp());
}

enum Calendar { day, week, month, year }

class SegmentedButtonApp extends StatefulWidget {
  const SegmentedButtonApp({super.key});

  @override
  State<SegmentedButtonApp> createState() => _SegmentedButtonAppState();
}

class _SegmentedButtonAppState extends State<SegmentedButtonApp> {
  Calendar calendarView = Calendar.day;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(useMaterial3: true),
      home: Scaffold(
        body: Center(
          child: SegmentedButton<Calendar>(
            style: SegmentedButton.styleFrom(
              foregroundColor: Colors.amber,
              visualDensity: VisualDensity.comfortable,
            ),
            // style: const ButtonStyle(
            //   foregroundColor: MaterialStatePropertyAll<Color>(Colors.deepPurple),
            //   visualDensity: VisualDensity.comfortable,
            // ),
            segments: const <ButtonSegment<Calendar>>[
              ButtonSegment<Calendar>(
                  value: Calendar.day,
                  label: Text('Day'),
                  icon: Icon(Icons.calendar_view_day)),
              ButtonSegment<Calendar>(
                  value: Calendar.week,
                  label: Text('Week'),
                  icon: Icon(Icons.calendar_view_week)),
              ButtonSegment<Calendar>(
                  value: Calendar.month,
                  label: Text('Month'),
                  icon: Icon(Icons.calendar_view_month)),
              ButtonSegment<Calendar>(
                  value: Calendar.year,
                  label: Text('Year'),
                  icon: Icon(Icons.calendar_today)),
            ],
            selected: <Calendar>{calendarView},
            onSelectionChanged: (Set<Calendar> newSelection) {
              setState(() {
                calendarView = newSelection.first;
              });
            },
          ),
        ),
      ),
    );
  }
}

```

</details>
2024-01-03 21:26:02 +00:00
Ann Marie Mossman
743cdd68b7
Handle KEYCODE_DPAD_CENTER and KEYCODE_ENTER (#140808)
https://github.com/flutter/flutter/issues/1670

Note: This PR replaces the the original PR (https://github.com/flutter/flutter/pull/138240) that got into a state where a rebase was not possible and made it difficult to determine what was causing unrelated test failures.
2024-01-03 18:37:23 +00:00
Jack Gibbons
f4cb3d215d
Add key to BottomNavigationBarItem (#139617)
Pass key into _BottomNavigationTile

Adding a optional key parameter to BottomNavigationBarItem to be passed through to _BottomNavigationTile.
This will allow easier testing in some scenarios, and fix the splash appearing on the wrong tile.

https://github.com/flutter/flutter/issues/139615
https://github.com/flutter/flutter/issues/34833
2024-01-03 15:58:21 +00:00
Satsrag
c033b08df7
fix: cannot input new line using custom input control (#140356)
For https://github.com/flutter/flutter/issues/125875 and https://github.com/flutter/engine/pull/45522

According to [this discussion](https://github.com/flutter/flutter/pull/139446#discussion_r1424776370), Just added `forceMultiline` to JSON on `_configurationToJson`. @LongCatIsLooong @Renzo-Olivares
2024-01-03 01:58:24 +00:00
David Iglesias
6b4f0d5753
[flutter] Allow ViewCollection to start empty. (#140532)
This enables multi-view apps to start with zero views.
2024-01-03 00:22:52 +00:00
LongCatIsLooong
f3b6505f14
Fix 139196 selection OOB (#140300)
Fixes #139196
2024-01-03 00:11:18 +00:00
LongCatIsLooong
5883a6ca10
Reland "Make TextSpan hit testing precise." (#140468) (#140621)
Fixes https://github.com/flutter/flutter/issues/131435, https://github.com/flutter/flutter/issues/104594, https://github.com/flutter/flutter/issues/43400

Currently the method we use for text span hit testing `TextPainter.getPositionForOffset` always returns the closest `TextPosition`, even when the given offset is far away from the text.

The new TextPaintes method tells you the layout bounds `(width =  letterspacing / 2 + x_advance + letterspacing / 2, height = font ascent + font descent)` of a character, the PR changes the hit testing implementation such that a TextSpan is only considered hit if the point-down event landed in one of its character's layout bounds.

Potential issues:

In theory since the text is baseline aligned, we should use the max ascent and max descent of each character to calculate the height of the text span's hit-test region, in case some characters in the span have to fall back to a different font, but that will be slower and it typically doesn't make a huge difference.
This is a breaking change.
2024-01-02 20:26:12 +00:00
shirne
7249d9ec6d
improve comment doc in tabs.dart (#140568)
*Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.*

*List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.*

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
2024-01-02 19:03:10 +00:00
Polina Cherkasova
f667376cc8
Rename MemoryAllocations to FlutterMemoryAllocations. (#140623)
Contributes to https://github.com/flutter/flutter/issues/140622
2024-01-02 09:56:30 -08:00
Daniel Chevalier
186659dc35
Show width and height in inspector overlay (#140709)
![](https://media.giphy.com/media/SX71qs3TDxVkvbLJ4o/giphy-downsized.gif)

Fixes https://github.com/flutter/devtools/issues/6871

Add the width and height to the inspector overlay. 1 decimal precision is used since that matches the way Devtools displays the values.

## Examples
<img width="442" alt="Screenshot 2023-12-28 at 2 39 49 PM" src="https://github.com/flutter/flutter/assets/1386322/2de40092-de15-4ada-a954-e911e6bef217">

<img width="645" alt="Screenshot 2023-12-28 at 2 39 42 PM" src="https://github.com/flutter/flutter/assets/1386322/8f53dad5-1aba-43d9-9419-ca93cd894624">
<img width="149" alt="Screenshot 2023-12-28 at 2 39 37 PM" src="https://github.com/flutter/flutter/assets/1386322/bbed74b7-c962-4c20-80d8-48e5eaa14de6">
2023-12-29 01:34:40 +00:00
hhh
b0b0e423d6
expose didExceedMaxLines from RenderParagraph (#139962)
I want to build a widget that adds some extra functionality when the inner text overflow. So the problem occurred, I can't find an elegant way to determine if the text is overflowing. 
So i expose `didExceedMaxLines` from `RenderParagraph`, I think it can make sense. Have there some advice?
2023-12-28 01:38:38 +00:00
Bruno Leroux
89f0c69e49
Add custom system-wide text selection toolbar buttons on Android (#139738)
## Description

This PR adds custom system-wide text selection toolbar buttons on Android.
~~This is a WIP until https://github.com/flutter/flutter/pull/139479 is merged (potential conflicts).~~

## Related Issue

Fixes https://github.com/flutter/flutter/issues/139361

## Tests

Adds 5 tests.
2023-12-27 19:03:29 +00:00
Qun Cheng
c0acd8c45f
Fix import pattern (#140425)
This PR is just to fix the import pattern to follow the convention.
2023-12-21 00:18:09 +00:00
Michael Goderbauer
c4fda23393
Remove outdated ignores from framework (#140465)
These were not ignoring anything (anymore).
2023-12-20 22:05:29 +00:00
LongCatIsLooong
e2e8bcb1bc
Reland find.textRange.ofSubstring changes (#140469)
Extracted from https://github.com/flutter/flutter/pull/139717 as-is. Landing this change first so we can avoid doing a g3fix.
2023-12-20 22:00:55 +00:00
auto-submit[bot]
9003f13803
Reverts "Make TextSpan hit testing precise." (#140468)
Reverts flutter/flutter#139717
Initiated by: LongCatIsLooong
This change reverts the following previous change:
Original Description:
Fixes https://github.com/flutter/flutter/issues/131435, #104594, #43400
Needs https://github.com/flutter/engine/pull/48774 (to fix the web test failure).

Currently the method we use for text span hit testing `TextPainter.getPositionForOffset` always returns the closest `TextPosition`, even when the given offset is far away from the text. 

The new TextPaintes method tells you the layout bounds (`width =  letterspacing / 2 + x_advance + letterspacing / 2`, `height = font ascent + font descent`) of a character, the PR changes the hit testing implementation such that a TextSpan is only considered hit if the point-down event landed in one of it's character's layout bounds.

Potential issues:

1. In theory since the text is baseline aligned, we should use the max ascent and max descent of each character to calculate the height of the text span's hit-test region, in case some characters in the span have to fall back to a different font, but that will be slower and it typically doesn't make a huge difference. 

This is a breaking change. It also introduces a new finder and a new method `WidgetTester.tapOnText`: `await tester.tapOnText('string to match')` for ease of migration.
2023-12-20 19:32:10 +00:00
Bruno Leroux
0d90014bae
_TabBarViewState should not recreate page controller (#135500)
## Description

This PR replaces the unconditional instantiation of `PageController` in `_TabBarViewState.didChangeDependencies` as suggested in https://github.com/flutter/flutter/pull/134091#discussion_r1319177744.

## Related Issue

Fixes https://github.com/flutter/flutter/issues/134253.

## Tests

Adds 1 test.
2023-12-20 17:04:29 +00:00
LongCatIsLooong
ea5b97286e
Make TextSpan hit testing precise. (#139717)
Fixes https://github.com/flutter/flutter/issues/131435, #104594, #43400
Needs https://github.com/flutter/engine/pull/48774 (to fix the web test failure).

Currently the method we use for text span hit testing `TextPainter.getPositionForOffset` always returns the closest `TextPosition`, even when the given offset is far away from the text. 

The new TextPaintes method tells you the layout bounds (`width =  letterspacing / 2 + x_advance + letterspacing / 2`, `height = font ascent + font descent`) of a character, the PR changes the hit testing implementation such that a TextSpan is only considered hit if the point-down event landed in one of it's character's layout bounds.

Potential issues:

1. In theory since the text is baseline aligned, we should use the max ascent and max descent of each character to calculate the height of the text span's hit-test region, in case some characters in the span have to fall back to a different font, but that will be slower and it typically doesn't make a huge difference. 

This is a breaking change. It also introduces a new finder and a new method `WidgetTester.tapOnText`: `await tester.tapOnText('string to match')` for ease of migration.
2023-12-20 03:23:29 +00:00
Fedor Blagodyr
2bb19a9501
Added onEnd callback into AnimatedSize (#139859)
close #106439
2023-12-19 22:59:46 +00:00
Bartek Pacia
a4388773bb
SemanticsProperties: default identifier and tooltip to null (#140283)
This PR applies [the suggestion made here](https://github.com/flutter/devtools/pull/6942#issuecomment-1852773200).
2023-12-18 19:38:05 +00:00
Simon Friis Vindum
b893884f50
Document difference between softWrap and maxLine (#139363)
This PR fixes #13631 through documentation as suggested in https://github.com/flutter/flutter/issues/13631#issuecomment-354902727.

Since the documentation additions rely on new screenshots this PR will be accompanied by a PR in the assets repository.
2023-12-18 19:09:07 +00:00