Commit Graph

21327 Commits

Author SHA1 Message Date
Henrique Nascimento
eebb1d6ddf Add option for flexible space on material SearchDelegate (#128132)
This pull request introduces the `buildFlexibleSpace` method to the `SearchDelegate` class in the material library. 
It allows users to add a flexible space widget to the `AppBar` in a `_SearchPage`, providing more customization options.

This PR does not fix any specific issue as there are no open issues related to this feature.
2023-07-06 17:52:58 +00:00
luckysmg
e0ad12969f [framework] Add textField OCR support for framework side (#96637)
iOS OCR keyboard input support.
2023-07-06 08:51:06 -07:00
fabiancrx
2f7614a818 [flutter_tools] modify Skeleton template to use ListenableBuilder instead of AnimatedBuilder (#128810)
Replaces AnimatedBuilder for ListenableBuilder in the skeleton template

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

No tests needed
2023-07-06 15:14:51 +00:00
Ian Hickson
bc49cd1bca Allow long-press gestures to continue even if buttons change. (#127877)
Previously, if you changed buttons during a long-press gesture, if it was before the gesture was accepted we would discard it, and if it was after the gesture was accepted we would silently end it without firing any of the relevant events.

This silent cancelation behavior is terrible because it means there's no way for consumers to know what state they're in, so you end up with widgets that thing they're still being long-pressed even though nothing is happening.

We could change the behavior in three ways, as far as I can tell:

- we could send a cancel event when you change buttons. This would introduce a new kind of transition (start->cancel) which I don't think we currently require people to support. This would therefore not fix existing code and would make future code more complicated to handle a really obscure user action that it seems unlikely anyone cares about.

- we could send an end event when you change buttons. This would mean the action commits, even though the user is still holding the mouse button down. This seems slightly better than the previous option but still not ideal as it means nudging the mouse button commits you even though you're still holding the button down.

- we could ignore button changes after the long-press has been accepted.

I implemented the last one in this PR.
2023-07-06 00:42:57 +00:00
Michael Goderbauer
55b6f049a6 Enable unreachable_from_main lint - it is stable now!!1 (#129854)
PLUS: clean-up of all the unreachable stuff.
2023-07-06 00:09:01 +00:00
Snonky
e0a9ad15b9 MergeableMaterial: Fix adding a slice and separating it (#128804) 2023-07-05 16:58:28 -07:00
Hans Muller
14f1e13edb Reland Fix AnimatedList & AnimatedGrid doesn't apply MediaQuery padding #129556 (#129860)
Reland https://github.com/flutter/flutter/pull/129556/ which had failed
an internal test (see Google internal link b/288993600) and was reverted
in https://github.com/flutter/flutter/pull/129645.

This PR must be landed with G3 Fix cl/543755631
2023-07-05 15:41:13 -07:00
pdblasi-google
e1702a96f6 Removes deprecated APIs from v2.6 in binding.dart and widget_tester.dart (#129663)
Removes deprecated APIs from v2.6 in `binding.dart` and `widget_tester.dart`

Resolves #129654
2023-07-05 19:26:24 +00:00
Helin Shiah
0b44577f16 Add new hot reload case string (#130008)
This change is for an internal IDE client to send a custom hot reload
request, as custom requests from the client must start with `$/`.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above. (this PR is linked internally)
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2023-07-05 15:16:33 -04:00
Myles Moylan
ec72610378 Add simple unit tests for annotations.dart file (#128902)
This PR is adding a file of two simple unit tests in order to improve code coverage (covering two simple classes within the annotations.dart file).

The issue this is fixing is the lack of complete test coverage for the annotations.dart file.
2023-07-05 17:21:28 +00:00
ipcjs
aaaea51dd2 fix a bug when android uses CupertinoPageTransitionsBuilder... (#114303)
When android uses iOS style `PageTransitionsBuilder` and iOS uses android style `PageTransitionsBuilder`, on android, swipe from the left edge of the screen doesn't work. This PR solves that problem.

#99919 introduced a breaking change, the pr re-implemented it <del>without introducing a breaking change.**</del>
2023-07-05 16:41:32 +00:00
Piotr FLEURY
168d807734 Add .env file support for option --dart-define-from-file (#128668)
# Proposal

I suggest to make possible to specify .env files to the --dart-define-from-file in addition to the Json format.

# Issue

Close #128667
2023-07-05 16:35:08 +00:00
Pierre-Louis
35085c394d Improve documentation for ColorSheme.fromImageProvider (#129952)
Sample code is added, documentation condensed, and links to guidelines updated.

For b/258360306
2023-07-05 15:47:57 +00:00
Polina Cherkasova
5b12b7467f Cleanup: stop accepting DiagnosticsNode as input from DevTools. (#129302) 2023-07-04 10:12:49 -07:00
Parker Lougheed
63a8298d4b Update links to old linter site to dart.dev (#129866)
Removes the remaining links to the old linter site, to the guaranteed dart.dev/lints redirect.

Contributes to https://github.com/dart-lang/linter/issues/4460 and https://github.com/dart-lang/site-www/issues/4499
2023-07-01 18:36:10 +00:00
Qun Cheng
9249dcc283 Update SwitchTheme tests for M2/M3 (#129811) 2023-06-30 16:29:02 -07:00
Greg Price
1153371a56 Fix NetworkImage causing spurious warning in tests (#129537)
Fixes #129532.

This ensures that when a test properly uses `debugNetworkImageHttpClientProvider` to tell `NetworkImage` to use a fake `HttpClient`, we don't go ahead and try to instantiate `HttpClient` anyway and generate a misleading warning.
2023-06-30 22:25:52 +00:00
Hans Muller
26ad4a4a79 Updated some golden image tests for M2/M3 (#129794)
Updated some of the golden image tests that were temporarily changed in https://github.com/flutter/flutter/pull/128914 to have M2 and M3 versions. 

Updated the linear_gradient_0 example to M3 (which will require updating its golden image as well).

More info in https://github.com/flutter/flutter/issues/127064
2023-06-30 18:09:56 +00:00
Nate Bosch
34c092f2b3 Remove an unnecessary assert (#129796)
The type variable `T`, when used as an expression, will always be a
`Type`. The type test `T is! List` is always true (as is `T is Type`).

This expression will become a warning in the analyzer in some upcoming
release of the Dart SDK.

This `assert` was added in a PR which reapplied an earlier PR, however
the earlier PR did not include this assert. I do not see any discussion
indicating the intent of this assert.

The impact of testing this `T` in any way is low - this is a private
class so we can see all the uses and know that the only type bound to
`T` is `Uri`. Avoid the upcoming diagnostic and remove the assert
entirely. This maintains existing behavior but ignores the potential
intent for the check.
2023-06-30 18:07:54 +00:00
Qun Cheng
1ed54f8ec0 Update Radio tests for M2/M3 (#129814)
Updated unit tests for `Radio` to have M2 and M3 versions.

More info in https://github.com/flutter/flutter/issues/127064
2023-06-30 18:06:25 +00:00
Qun Cheng
0bb9409fd0 Update Switch tests for M2/M3 (#129810)
Updated and reorganized unit tests for `Switch` to have M2 and M3 versions.

More info in https://github.com/flutter/flutter/issues/127064
2023-06-30 18:06:23 +00:00
Qun Cheng
2e4122cc61 Update SwitchListTile tests for M2/M3 (#129809)
Updated and reorganized unit tests for `SwitchListTile` to have M2 and M3 versions.

More info in https://github.com/flutter/flutter/issues/127064
2023-06-30 09:05:48 +00:00
Taha Tesser
7cef966147 Fix NavigationDrawer selected item has wrong icon color (#129625)
fixes [NavigationDrawer selected item has wrong icon color [Material3 spec]](https://github.com/flutter/flutter/issues/129572)

### Description
This PR fixes a mistake in the `NavigationDrawer` defaults, where generated token value returns a `null`. 
This issue can be detected when you want to customize the selected icon color for `NavigationDrawerDestination` using a custom color scheme.

### Code sample

<details> 
<summary>expanded 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,
      themeMode: ThemeMode.light,
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue).copyWith(
          onSecondaryContainer: Colors.red,
        ),
        useMaterial3: true,
      ),
      home: const Example(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('NavigationDrawer Sample'),
      ),
      drawer: const NavigationDrawer(
        children: <Widget>[
          NavigationDrawerDestination(
            icon: Icon(Icons.favorite_outline_rounded),
            label: Text('Favorite'),
            selectedIcon: Icon(Icons.favorite_rounded),
          ),
          NavigationDrawerDestination(
            icon: Icon(Icons.favorite_outline_rounded),
            label: Text('Favorite'),
          ),
        ],
      ),
    );
  }
}
``` 
	
</details>

### Before
 
<img width="1053" alt="Screenshot 2023-06-27 at 13 24 38" src="https://github.com/flutter/flutter/assets/48603081/18c13a73-688f-4586-bb60-bddef45d173f">

### After

<img width="1053" alt="Screenshot 2023-06-27 at 13 24 25" src="https://github.com/flutter/flutter/assets/48603081/8a1427c6-517f-424a-b0bd-24bad7c5fbb0">
2023-06-30 08:58:14 +00:00
Bruno Leroux
3a6d661587 Update basic_test.dart for M3 compliance (#129714)
## Description

This PR fixes two test failures in `basic_test.dart` which surfaced when switching to M3 (see https://github.com/flutter/flutter/pull/127501)

Those failures are related to M3 typography which sets line height to 1.43.

Forcing line height to 1.0 seems reasonable for these particular tests. With this change these two test are successful for both M2 and M3.

## Related Issue

fixes https://github.com/flutter/flutter/issues/129713

## Tests

Updates 2 tests.
2023-06-30 08:56:16 +00:00
Qun Cheng
91cb2618c3 Make DropdownMenu be able to scroll to the highlighted item when searching. (#129740)
Fixes #120349

This PR enables `DropdownMenu` to automatically scroll to the first matching item when `enableSearch` is true.

<details><summary>video example</summary>

https://github.com/flutter/flutter/assets/36861262/1a7a956c-c186-44ca-9a52-d94dc21cac8a

</details>
2023-06-30 01:48:05 +00:00
fzyzcjy
92969ba8ca Remove @NonNull to avoid warning (#129472)
Otherwise android studio complains:

> Do not use @NonNull in Kotlin; the nullability is already implied by the Kotlin type MethodCall not ending with ?

![image](https://github.com/flutter/flutter/assets/5236035/0cc2e838-dbf9-409f-8fd8-d4e006f58be6)
2023-06-29 21:34:31 +00:00
Martin Kustermann
7068a2088e Prepare for utf8.encode() to return more precise Uint8List type (#129769)
To avoid analyzer warnings when utf8.encode() will return the more
precise Uint8List type, we use const Utf8Encoder().convert() which
already returns Uint8List

See https://github.com/dart-lang/sdk/issues/52801
2023-06-29 22:44:57 +02:00
Tae Hyung Kim
ff838bca89 Add locale-specific DateTime formatting syntax (#129573)
Based on the [message format
syntax](https://unicode-org.github.io/icu/userguide/format_parse/messages/#examples)
for
[ICU4J](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/text/MessageFormat.html).
This adds new syntax to the current Flutter messageFormat parser which
should allow developers to add locale-specific date formatting.

## Usage example
```
  "datetimeTest": "Today is {today, date, ::yMd}",
  "@datetimeTest": {
    "placeholders": {
      "today": {
        "description": "The date placeholder",
        "type": "DateTime"
      }
    }
  }
```
compiles to
```
  String datetimeTest(DateTime today) {
    String _temp0 = intl.DateFormat.yMd(localeName).format(today);
    return 'Today is $_temp0';
  }
```

Fixes https://github.com/flutter/flutter/issues/127304.
2023-06-29 09:23:34 -07:00
Taha Tesser
f3a7485b2c Update RadioListTile tests to M3 (#129718)
This updates the `RadioListTile` test which was modified in https://github.com/flutter/flutter/pull/128839

### Description
- Update the layout to the proper order `MaterialApp` -> `Material` -> `RadioListTile`
- Add M3 overlay test. (fixed problem faced in https://github.com/flutter/flutter/pull/128839)
- Separate the M2  overlay test.
2023-06-29 15:55:15 +00:00
Justin McCandless
c7511664e2 RTL InputDecoration fix (#129661)
Fixes InputDecoration (TextField) layout when 1. RTL 2. prefixIcon and 3. left/right contentPadding is asymmetric.
2023-06-28 16:31:51 -07:00
pdblasi-google
af09b57e20 Removes deprecated APIs from AnimationBuilder (#129657)
Removes deprecated APIs from AnimationBuilder.

Resolves #129653
2023-06-28 20:12:19 +00:00
Hans Muller
0d4b5ae122 Dev, examples/api, etc updated for Material 3 by default (#129683)
Updated tests in dev, examples/api, and tests/widgets to ensure that
they continue to pass when the default for `ThemeData.useMaterial3` is
changed to true.

This is the final set of changes required for
https://github.com/flutter/flutter/issues/127064.
2023-06-28 09:41:58 -07:00
Taha Tesser
32fe4d7f0a Add DatePickerTheme.inputDecorationTheme for the DatePicker with input mode. (#128950) 2023-06-28 08:51:53 -07:00
Jonah Williams
9c96357277 [framework] ensure flexible space bar fades when scrolling. (#129527)
This was missing the actual opacity rendering, oops
2023-06-28 15:33:51 +00:00
Bruno Leroux
8d837062a4 Add InputDecorator.error to allow error message customization (#129275)
## Description

This PR is a fork of https://github.com/flutter/flutter/pull/118610 with some changes (mainly applying @justinmc comments).

~~This can be used by KishanBusa8 to update https://github.com/flutter/flutter/pull/118610 or can become a non WIP PR if KishanBusa8 does not respond or can not work on the update.~~

## Related Issue

fixes https://github.com/flutter/flutter/issues/11068

## Tests

Adds 3 tests.
2023-06-28 14:57:15 +00:00
Xilai Zhang
f3b0b1726f [flutter roll] Revert "Fix AnimatedList & AnimatedGrid doesn't apply MediaQuery padding" (#129645)
Reverts flutter/flutter#129556.

Context: b/288993600

quoting, "the failure (in internal tests) appears to be due to a
workaround for the issue fixed by this pr".
2023-06-28 07:23:49 -05:00
Loïc Sharma
5a5b58a993 Automatically migrate ClipboardData.text to non-null (#129567)
https://github.com/flutter/flutter/pull/122446 was a breaking change in Flutter 3.10 that made the `ClipboardData` constructor's `text` argument a required non-nullable argument. This leverages `dart fix`'s new automatic migration to, well, automatically migrate affected users.

Manual migration docs: https://docs.flutter.dev/release/breaking-changes/clipboard-data-required

Follow-up to https://github.com/flutter/flutter/pull/122446
Part of https://github.com/flutter/flutter/issues/121976
2023-06-27 21:07:14 +00:00
Tomasz Gucio
ca6f23e8af Remove Editable.onCaretChanged callback (#109114) 2023-06-27 22:20:15 +02:00
Ben Konyi
5ea2be69ca Reland "Fix issue where DevTools would not be immediately available when using --start-paused (#126698)" (#129368)
**Original Description:**

> Service extensions are unable to handle requests when the isolate they
were registered on is paused. The DevTools launcher logic was waiting
for some service extension invocations to complete before advertising
the already active DevTools instance, but when --start-paused was
provided these requests would never complete, preventing users from
using DevTools to resume the paused isolate.
> 
> Fixes https://github.com/flutter/flutter/issues/126691

**Additional changes in this PR:**

The failures listed in https://github.com/flutter/flutter/pull/128117
appear to be related to a shutdown race. It's possible for the test to
complete while the tool is in the process of starting and advertising
DevTools, so we need to perform a check of `_shutdown` in
`FlutterResidentDevtoolsHandler` before advertising DevTools.

Before the original fix, this check was being performed immediately
after invoking the service extensions, which creates an asynchronous gap
in execution. With #126698, the callsite of the service extensions was
moved and the `_shutdown` check wasn't, allowing for the tool to attempt
to advertise DevTools after the DevTools server had been cleaned up.

---------

Co-authored-by: Zachary Anderson <zanderso@users.noreply.github.com>
2023-06-28 00:16:13 +05:30
pdblasi-google
321abcbe4f Adds dart_fix support to integration_test (#129579)
* Adds fix for `IntegrationTestWidgetsFlutterBinding.runTest(timeout)` to support first round of deprecations for `flutter_test`

Resolves #124346
2023-06-27 18:01:06 +00:00
Luccas Clezar
a90c33fd61 iOS TextSelectionToolbar fidelity (#127757)
CupertinoTextSelectionToolbar is different from the native one, with some UI and UX issues. More details on the linked issue.

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

Currently the only problem that I listed on the linked issue that I couldn't fix was the horizontal scrolling, but to workaround this I added a GestureDetector to change pages when swiping the toolbar. It's not exactly the same as native as there is no scroll animation, but it works.

I'm creating this PR a little early to have some feedback as these changes were more complex than the ones in my last PR. Probably best if @justinmc is involved 😅

|Version|Video|
|-|-|
|Flutter Old|<video src="https://github.com/flutter/flutter/assets/12024080/7cf81075-46ec-4970-b118-cc27b60ddac0"></video>|
|Flutter New|<video src="https://github.com/flutter/flutter/assets/12024080/c9e27a53-f94c-4cb0-9b76-e47b73841dcb"></video>|
|Native|<video src="https://github.com/flutter/flutter/assets/12024080/468c7d5b-ba93-4bd4-8f6e-8ec2644b9866"></video>|
2023-06-27 17:50:07 +00:00
Jason Simmons
3e66c86ae4 Make a paragraph test involving Chinese characters work with inconsistent host system fonts (#129628)
Text tests are run using the Ahem font, and test host environments such
as LUCI may not provide a fallback font for Chinese glyphs.
2023-06-27 09:56:13 -07:00
hangyu
9459f1c517 Fix chinese text is not selected by long press (#129320)
issue:#126652

 in Chinese text, word length is 1 and (position.offset == word.end) happens a lot.

Update if (position.offset >= word.end) to if (position.offset > word.end) to resolve the issue that Chinese characters are not selected.
2023-06-27 01:15:38 +00:00
Hans Muller
b703f75f0f Updated chip_test.dart tests for M3 (#129570)
Updated the chip tests per the changes from https://github.com/flutter/flutter/pull/128584 so that Chip tests that depend on Material2 will continue to pass when Material3 becomes the default. 

Part of: https://github.com/flutter/flutter/issues/127064
2023-06-26 21:02:58 +00:00
Taha Tesser
c8e42b47f5 Fix AnimatedList & AnimatedGrid doesn't apply MediaQuery padding (#129556)
fixes [AnimatedList does not take SafeArea into account when building the list ](https://github.com/flutter/flutter/issues/129539)

### Description
This PR fixes an issue for `AnimatedList` & `AnimatedGrid` where `MediaQuery` padding isn't applied. See the [source](a20db068dd/packages/flutter/lib/src/widgets/scroll_view.dart (L803-L833)).

While the  `ListView` or `GridView` applies `MediaQuery` padding to its inner `SliverPadding`.  This is missing from `AnimatedList` & `AnimatedGrid`.

![Digram of ListView applying MediaQuery padding](https://github.com/flutter/flutter/assets/48603081/01917900-cd26-4ca1-8e51-b7dcd1241471)

The fix applies  `MediaQuery` padding to the inner `SliverPadding` in `AnimatedList` & `AnimatedGrid`.

![Digram of AnimatedList & AnimatedGrid applying MediaQuery padding](https://github.com/flutter/flutter/assets/48603081/75d0a0ad-539c-485e-b3c1-770ee187086b)

### 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,
      theme: ThemeData(useMaterial3: true),
      home: const Example(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Sample'),
      ),
      body: Row(
        children: <Widget>[
          Expanded(
            child: Column(
              children: <Widget>[
                const Text('ListView'),
                Expanded(
                  child: ListView.builder(
                    itemCount: 50,
                    itemBuilder: (_, int index) {
                      return ColoredBox(
                        color: Theme.of(context).colorScheme.primaryContainer,
                        child: Center(
                          child: Text('$index', textAlign: TextAlign.center),
                        ),
                      );
                    },
                  ),
                ),
              ],
            ),
          ),
          const VerticalDivider(width: 4),
          Expanded(
            child: Column(
              children: <Widget>[
                const Text('AnimatedList'),
                Expanded(
                  child: AnimatedList(
                    initialItemCount: 50,
                    itemBuilder: (_, int index, __) {
                      return ColoredBox(
                        color: Theme.of(context).colorScheme.primaryContainer,
                        child: Center(
                          child: Text('$index', textAlign: TextAlign.center),
                        ),
                      );
                    },
                  ),
                ),
              ],
            ),
          ),
          const VerticalDivider(width: 4),
          Expanded(
              child: Column(
            children: <Widget>[
              const Text('AnimatedGrid'),
              Expanded(
                child: AnimatedGrid(
                  initialItemCount: 50,
                  gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
                    crossAxisCount: 2,
                  ),
                  itemBuilder: (_, int index, __) {
                    return ColoredBox(
                      color: Theme.of(context).colorScheme.primaryContainer,
                      child: Center(
                        child: Text('$index', textAlign: TextAlign.center),
                      ),
                    );
                  },
                ),
              ),
            ],
          ))
        ],
      ),
    );
  }
}

``` 
	
</details>

### Before
![Before preview image](https://github.com/flutter/flutter/assets/48603081/73954a8a-9d1d-4b9e-b6a3-cae8071f3462)

### After
![After preview image](https://github.com/flutter/flutter/assets/48603081/9f1dc48a-622f-4402-8d5e-8e6e3e150165)
2023-06-26 16:19:02 +00:00
Loïc Sharma
e1e2ebd176 Add CallbackShortcuts widget of the week video (#129296) 2023-06-23 20:16:28 +00:00
Paurakh Sharma Humagain
a9164a4d76 fix: Inconsistency of SelectionArea when scrolling (#128765)
This PR fixes inconsistency of SelectionArea when scrolling by removing the `_clearSelection` on `longPressUpdate` gesture. This in turn makes the selection UX much better.

*List which issues are fixed by this PR. You must list at least one issue.*
Fixes: https://github.com/flutter/flutter/issues/120892

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
2023-06-23 16:47:47 +00:00
Xilai Zhang
363e2f7e0b Revert "[web] Migrate framework to fully use package:web" (#129400)
Reverts flutter/flutter#128901

context: ([cl/542712088](https://critique.corp.google.com/542712088) , [b/288495136](https://b.corp.google.com/288495136))
2023-06-23 04:11:55 +00:00
Oleh Prypin
71228e02c6 Prepare for making intl toBeginningOfSentenceCase non-nullable (#127488)
I intend to edit `toBeginningOfSentenceCase`'s return value to be non-nullable because it really is never null. That will mean that non-null asserts around it will become flagged as unnecessary, although right now they are necessary. So, apply a workaround - instead use a function that does a non-null assert without triggering any lints even after it becomes unnecessary.
2023-06-23 03:25:45 +00:00
David Iglesias
34b42acf1b [web] Hides that Flutter uses requireJS in debug. (#129032)
Flutter web uses requireJS in `debug` mode to assemble a DDC-compiled app from a bunch of small files ("modules").

This caused that `canvaskit.js` (and all other modules that used a browserify-like loading header) didn't work because they attempted to use the `define` function provided by Flutter's instance of `requireJS` (which kept the defined modules private, rather than as globals on the page, as the users of the JS expected).

A [fix](https://github.com/flutter/engine/pull/27342) was added to `flutter/engine` to trick loaders into *not* using the `requireJS` module loader, but a recent change in the fix's js-interop layer *subtly* changed its JS output on the page (objects went from `undefined` to `null`), causing this:

* https://github.com/flutter/flutter/issues/126131 (and others)

This PR hides a bit of code that is commonly used by module loaders to decide that they may use the `define` function provided by requireJS (so the engine workaround can be removed).

## Next steps

* https://github.com/flutter/engine/pull/42941

## Issues

Partially addresses: https://github.com/flutter/flutter/issues/126131 (and others)

## Tests

* Added a unit test to ensure the `delete` stays
* Manually tested with the Gallery app in `debug` mode with a bunch of user-supplied scripts that currently fail to load.
  * Also tested hot restart as suggested by @nshahan
2023-06-23 02:09:12 +00:00