453 Commits

Author SHA1 Message Date
林洵锋
047bd6cebd
Fix the character field of RawKeyEvent is always null on iOS (#135100)
Fixes https://github.com/flutter/flutter/issues/133956
2023-10-03 05:26:41 +00:00
Kostia Sokolovskyi
4204f07d76
Add RestorationManager disposals in test/services/restoration_test.dart. (#135218) 2023-09-21 10:24:52 -07:00
Polina Cherkasova
77718845dd
Handle breaking changes in leak_tracker. (#135185) 2023-09-21 10:06:21 -07:00
derdilla
a0406cccb1
Mark ReastaurationManager not disposed (#134832) 2023-09-20 16:46:14 -07:00
derdilla
2868bc1351
Fix leak in hardware_keyboard_test.dart (#134380) 2023-09-20 16:45:15 -07:00
derdilla
9b767e6c1f
cover more tests with leak tracing (#134833) 2023-09-20 12:21:10 -07:00
David Iglesias
c7c9d8eea6
[web] Encode AssetManifest.bin as JSON and use that on the web. (#131382)
This PR modifies the web build slightly to create an `AssetManifest.json`, that is a JSON(base64)-encoded version of the `AssetManifest.bin` file.

_(This should enable all browsers to download the file without any interference, and all servers to serve it with the correct headers.)_

It also modifies Flutter's `AssetManifest` class so it loads and uses said file `if (kIsWeb)`.

### Issues

* Fixes https://github.com/flutter/flutter/issues/124883

### Tests

* Unit tests added.
* Some tests that run on the Web needed to be informed of the new filename, but their behavior didn't have to change (binary contents are the same across all platforms).
* I've deployed a test app, so users affected by the BIN issue may take a look at the PR in action:
  * https://dit-tests.web.app
2023-09-19 22:38:51 +00:00
derdilla
5467363306
Cover some Services tests with leak tracing (#134381) 2023-09-14 11:36:55 -07:00
Polina Cherkasova
834f5dc296
RestorationManager should dispatch creation in constructor. (#133911) 2023-09-08 15:05:43 -07:00
yaakovschectman
e6e44de33c
Add MacOS AppKitView class. (#132583)
Add derived classes from the Darwin platform view base classes for
MacOS. Functionality is largely the same as the `UiKitView`, but the two
are decoupled and and can further diverge in the future as needed. Some
unit tests remain skipped for now as the gesture recognizers for MacOS
are not yet implemented.

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

## 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].
- [ ] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [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

---------

Co-authored-by: Chris Bracken <chris@bracken.jp>
2023-08-31 17:48:12 -04:00
Mouad Debbar
55fe41be59
[web] New HtmlElementView.fromTagName constructor (#130513)
This wraps up the platform view improvements discussed in https://github.com/flutter/flutter/issues/127030.

- Splits `HtmlElementView` into 2 files that are conditionally imported.
- The non-web version can be instantiated but it throws if it ends up being built in a widget tree.
- Out-of-the-box view factories that create visible & invisible DOM elements given a `tagName` parameter.
- New `HtmlElementView.fromTagName()` constructor that uses the default factories to create DOM elements.
- Tests covering the new API.

Depends on https://github.com/flutter/engine/pull/43828

Fixes https://github.com/flutter/flutter/issues/127030
2023-08-07 23:45:19 +00:00
Martin Kustermann
9c10151508
Use utf8.encode() instead of longer const Utf8Encoder.convert() (#130567)
The change in [0] has propagated now everywhere, so we can use
`utf8.encode()` instead of the longer `const Utf8Encoder.convert()`.

Also it cleans up code like

```
  TypedData bytes;
  bytes.buffer.asByteData();
```

as that is not guaranteed to be correct, the correct version would be

```
  TypedData bytes;
  bytes.buffer.asByteData(bytes.offsetInBytes, bytes.lengthInBytes);
```

a shorter hand for that is:

```
  TypedData bytes;
  ByteData.sublistView(bytes);
```

[0] https://github.com/dart-lang/sdk/issues/52801
2023-07-24 11:26:05 +02:00
Ian Hickson
d21109220b
Catch errors in loadStructuredData (#130748)
Fixes https://github.com/flutter/flutter/issues/42390
2023-07-18 23:02:56 +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
Mouad Debbar
b0188cd182
[web] Pass creation params to the platform view factory (#128146)
This concludes step 1 of the `HtmlElementView` improvements. It's now possible to pass creation params to platform view factories directly from `HtmlElementView`.

Here's a sample app using a single factory to render platform views in different colors:

<details>
  <summary>Code sample</summary>
  
  ```dart
import 'dart:js_interop';
import 'dart:ui_web' as ui_web;
import 'package:flutter/material.dart';
import 'package:web/web.dart' as web;

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Platform View Demo',
      home: Scaffold(
        appBar: AppBar(
          title: Text('Platform View Demo'),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
            children: [
              BoxWrapper('red'),
              BoxWrapper(null),
              BoxWrapper('blue'),
            ],
          ),
        ),
      ),
    );
  }
}

bool isRegistered = false;

class BoxWrapper extends StatelessWidget {
  const BoxWrapper(this.cssColor);

  final String? cssColor;

  void register() {
    if (isRegistered) return;
    isRegistered = true;

    ui_web.platformViewRegistry.registerViewFactory('my-platform-view', (
      id, {
      Object? params,
    }) {
      params as String?;

      final element = web.document.createElement('div'.toJS) as web.HTMLElement;
      element.textContent = 'Platform View'.toJS;
      element.style
        ..lineHeight = '100px'.toJS
        ..fontSize = '24px'.toJS
        ..backgroundColor = (params ?? 'pink').toJS
        ..textAlign = 'center'.toJS;
      return element;
    });
  }

  @override
  Widget build(BuildContext context) {
    register();
    return SizedBox(
      width: 200,
      height: 100,
      child: Card(
        child: HtmlElementView(
          viewType: 'my-platform-view',
          creationParams: cssColor,
        ),
      ),
    );
  }
}
  ```
</details>

![image](https://github.com/flutter/flutter/assets/1278212/4b62ed8b-2314-49d6-9b4a-5da849bf2a48)

Depends on https://github.com/flutter/engine/pull/42255

Part of https://github.com/flutter/flutter/issues/127030
2023-06-15 18:00:25 +00:00
Andrew Kolos
cfe4fedca2
rename generated asset manifest file back to AssetManifest.bin (from AssetManifest.smcbin) (#128529)
Closes https://github.com/flutter/flutter/issues/128456, which is now linked to in a code comment in this change.
Reopens https://github.com/flutter/flutter/issues/124883.

This effectively reverts https://github.com/flutter/flutter/pull/126077 and is intended to be cherry-picked into stable.
2023-06-09 21:20:50 +00:00
Greg Spencer
a280346193
Add AppLifecycleListener, with support for application exit handling (#123274)
## Description

This adds `AppLifecycleListener`, a class for listening to changes in the application lifecycle, and responding to requests to exit the application.

It depends on changes in the Engine that add new lifecycle states: https://github.com/flutter/engine/pull/42418

Here's a diagram for the lifecycle states. I'll add a similar diagram to the documentation for these classes.

![Application Lifecycle Diagram](https://github.com/flutter/flutter/assets/8867023/f6937002-cb93-4ab9-a221-25de2c45cf0e)

## Related Issues
 - https://github.com/flutter/flutter/issues/30735

## Tests
- Added tests for new lifecycle value, as well as for the `AppLifecycleListener` itself.
2023-06-08 22:57:19 +00:00
Andrew Kolos
759ebef689
Do not try to load main/default asset image if only higher-res variants exist (#128143)
Fixes https://github.com/flutter/flutter/issues/127090.

https://github.com/flutter/flutter/pull/122505 did a few things to speed up the first asset load that a flutter app performs. One of those things was to not include the main asset in its own list of variants in the asset manifest. The idea was that we know that the main asset always exists, so including it in its list of variants is a waste of storage space and loading time (even if the cost was tiny).

However, the assumption that the main asset always exists is wrong. From [Declaring resolution-aware image assets](https://docs.flutter.dev/ui/assets-and-images#resolution-aware), which predates https://github.com/flutter/flutter/pull/122505:

> Each entry in the asset section of the pubspec.yaml should correspond to a real file, with the exception of the main asset entry. If the main asset entry doesn’t correspond to a real file, then the asset with the lowest resolution is used as the fallback for devices with device pixel ratios below that resolution. The entry should still be included in the pubspec.yaml manifest, however.

For example, it's valid to declare `assets/image.png` as an asset even if only `assets/3x/image.png` exists on disk.

This fix restores older behavior of including a main asset as a variant of itself in the manifest if it exists.

This fix also includes a non-user-visible behavior change:
* `"dpr"` is no longer a required field in the asset manifest's underlying structure. For the main asset entry, we do not include `"dpr"`. It makes less sense for the tool to decide what the default target dpr for an image should be. This should be left to the framework.
2023-06-07 03:19:15 +00:00
Greg Spencer
a257efc284
Fix handling of AppLifecycleState.hidden (#127987)
## Description

This fixes the parsing of `AppLifecycleState` in the services binding so that it knows what it is.

## Related Issues
 - Fixes https://github.com/flutter/flutter/issues/127974

## Tests
 - Added a test that causes parsing of all the different app lifecycle states.
2023-05-31 22:03:06 +00:00
yaakovschectman
130944e785
Alert engine upon registering ServiceBinding (#126075)
Send a platform message to the engine when the `ServiceBinding` is
registered. Framework side of
https://github.com/flutter/engine/pull/41733

Addresses https://github.com/flutter/flutter/issues/126033

## 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].
- [ ] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] 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

---------

Co-authored-by: Greg Spencer <gspencergoog@users.noreply.github.com>
2023-05-16 13:37:12 -04:00
Andrew Kolos
d3e0e03e2e
rename AssetManifest.bin (#126077)
Fixes #124883. Will require a g3fix.

Renames `AssetManifest.bin` to `AssetManifest.smcbin` (madeup extension for "Standard Message Codec binary").
2023-05-15 15:45:09 +00:00
Tomasz Gucio
99c7e9f088
Add spaces after flow control statements (#126320) 2023-05-15 11:07:30 +02:00
Bruno Leroux
e435b1ae26
Add debugPrintKeyboardEvents flag (#125629)
## Description

This PR adds a new debug flag named `debugPrintKeyboardEvents` to help debugging keyboard issues.

Keyboard code has some useful asserts but sometimes an assertion failure is related to the handling of previous key events. This debug flag will help understanding the flow of key events which leads to an assertion failure.

## Related Issue

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

## Tests

Adds 1 test.
2023-05-02 15:15:07 +00:00
Bruno Leroux
af050d95ae
Add a channel to query the engine keyboard state (#122885)
## Description

This PR adds a new channel to query the engine keyboard state.
See https://github.com/flutter/flutter/issues/87391#issuecomment-1228975571 for motivation. 

## Related Issue

Framework side implementation for https://github.com/flutter/flutter/issues/87391.

Once approved the framework will try to query the initial keyboard state from the engine. PRs will be needed on the engine side to answer the framework query.

## Tests

Adds 1 test.
2023-04-28 21:05:20 +00:00
chunhtai
3b4ac4d5cc
Implement url support for RouteInformation and didPushRouteInformation (#119968)
Related https://github.com/flutter/flutter/issues/100624

The goal is to make sure the engine can send a location string in either the existing format or a complete uri string to the framework, and the framework will still work as usual.
2023-04-24 18:33:24 +00:00
Rexios
bf0bdacb29
[flutter_test] Adds method to mock EventChannels (#124415)
[flutter_test] Adds method to mock EventChannels
2023-04-10 17:02:48 +00:00
Michael Goderbauer
73bd978529
Migrate away from deprecated BinaryMessenger API (#124348)
Migrate away from deprecated BinaryMessenger API
2023-04-07 19:38:52 +00:00
Zachary Anderson
2f4a6afd30
Revert "[flutter_test] Adds method to mock EventChannels" (#124401)
Reverts flutter/flutter#123726

Analysis failures on CI
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20analyze/12890/overview
2023-04-07 10:10:00 -07:00
Rexios
f28eb28f0d
[flutter_test] Adds method to mock EventChannels (#123726)
[flutter_test] Adds method to mock EventChannels
2023-04-07 16:12:27 +00:00
Greg Price
a28aae918e
Remove no-shuffle from framework tests, part 1: easy cases (#123751)
Remove no-shuffle from framework tests, part 1: easy cases
2023-03-30 18:28:51 +00:00
Loïc Sharma
70e1dc7387
[Clipboard] Assert at least one clipboard data variant is provided (#122446)
[Clipboard] Assert at least one clipboard data variant is provided
2023-03-24 19:12:10 +00:00
Greg Spencer
bcdab118ba
Add support for application exit requests (#121378)
Add support for application exit requests
2023-03-17 15:35:55 +00:00
Andrew Kolos
313b01658a
Reland "Speed up first asset load by using the binary-formatted asset manifest for image resolution" (#122505)
Reland "Speed up first asset load by using the binary-formatted asset manifest for image resolution"
2023-03-15 18:17:05 +00:00
Jonah Williams
8d4fd89c74
Revert "Reland "Speed up first asset load by using the binary-formatted asset manifest for image resolution (#121322)" (#122449)
Revert "Reland "Speed up first asset load by using the binary-formatted asset manifest for image resolution"
2023-03-11 03:30:06 +00:00
Jami Couch
2a67bf78f0
Add support for iOS UndoManager (#98294)
Add support for iOS UndoManager
2023-03-08 19:45:49 +00:00
Andrew Kolos
57c7aa53c1
Reland "Speed up first asset load by using the binary-formatted asset manifest for image resolution (#121322)
Reland "Speed up first asset load by using the binary-formatted asset manifest for image resolution
2023-03-06 20:37:43 +00:00
Lioness100
26b6c1bedd
Fix typos (#121171)
* Fix typos

* lowercase animated & opacity

* Undo typo fix

---------

Co-authored-by: Michael Goderbauer <goderbauer@google.com>
2023-02-23 19:43:21 +00:00
Ian Hickson
07c548c698
Apply BindingBase.checkInstance to TestDefaultBinaryMessengerBinding (#116937) 2023-02-13 23:55:58 +00:00
Kate Lovett
780c9a8de1
Remove deprecated SystemChrome.setEnabledSystemUIOverlays (#119576) 2023-02-10 14:03:01 -06:00
Gabriel Terwesten
ec289f1eb4
Don't call PlatformViewCreatedCallbacks after AndroidViewController is disposed (#116854)
* Don't call `PlatformViewCreatedCallback`s after `AndroidViewController` is disposed

Before this change it was possible that, if a `AndroidViewController` was disposed before we got the notification that the platform view was created, `PlatformViewCreatedCallback`s where called even after calling `AndroidViewController.dispose`.

Also makes `_PlatformViewLinkState._onPlatformViewCreated` more carful to only call `setState` when mounted.

Closes #84628
Closes #96384

* Allow all widgets to remove listeners from controller

* Remove assert

* Add expectations to test
2023-02-08 18:51:50 +00:00
Andrew Kolos
fd76ef0f26
Reland "Add API for discovering assets" (#119277)
* add asset manifest bin loading and asset manifest api

* use new api for image resolution

* remove upfront smc data casting

* fix typecasting issue

* remove unused import

* fix tests

* lints

* lints

* fix import

* revert image resolution changes

* Update image_resolution_test.dart

* Update decode_and_parse_asset_manifest.dart

* make targetDevicePixelRatio optional

* Update packages/flutter/lib/src/services/asset_manifest.dart

Co-authored-by: Jonah Williams <jonahwilliams@google.com>

* Update packages/flutter/lib/src/services/asset_manifest.dart

Co-authored-by: Jonah Williams <jonahwilliams@google.com>

* fix immutable not being imported

* return List in AssetManifest methods, fix annotation import

* simplify onError callback

* make AssetManifest methods abstract instead of throwing UnimplementedError

* simplify AssetVariant.key docstring

* tweak _AssetManifestBin docstring

* make AssetManifest and AssetVariant doc strings more specific

* use List.of instead of List.from for type-safety

* adjust import

* change _AssetManifestBin comment from doc comment to normal comment

* revert to callback function for onError in loadStructuredBinaryData

* add more to the docstring of AssetManifest.listAssets and AssetVariant.key

* add tests for CachingAssetBundle caching behavior

* add simple test to ensure loadStructuredBinaryData correctly calls load

* Update asset_manifest.dart

* update docstring for AssetManifest.getAssetVariants

* rename getAssetVariants, have it include main asset

* rename isMainAsset field of AssetMetadata to main

* (slightly) shorten name of describeAssetAndVariants

* rename describeAssetVariants back to getAssetVariants

* add tests for TestAssetBundle

* nits

* fix typo in docstring

* remove no longer necessary non-null asserts

* update gallery and google_fonts versions

---------

Co-authored-by: Jonah Williams <jonahwilliams@google.com>
2023-02-02 15:17:15 +00:00
Michael Goderbauer
8fd5d4ebb1
Remove deprecated SystemNavigator.routeUpdated method (#119187)
* Remove deprected SystemNavigator.routeUpdated

* test fix
2023-02-01 22:36:11 +00:00
Tanay Neotia
0e22aca785
Add support for image insertion on Android (#110052)
* Add support for image insertion on Android

* Fix checks

* Use proper Dart syntax on snippet

* Specify type annotation on list

* Fix nits, add some asserts, and improve example code

* Add missing import

* Fix nullsafety error

* Fix nullsafety error

* Remove reference to contentCommitMimeTypes in docs

* Fix nits

* Fix warnings and import

* Add test for content commit in editable_text_test.dart

* Check that URIs are equal in test

* Fix nits and rename functions / classes to be more self-explanatory

* Fix failing debugFillProperties tests

* Add empty implementation to `insertContent` in TextInputClient

* Tweak documentation slightly

* Improve docs for contentInsertionMimeTypes and fix assert

* Rework contentInsertionMimeType asserts

* Add test for onContentInserted example

* Switch implementation to a configuration class for more granularity in setting mime types

* Fix nits

* Improve docs and fix doc tests

* Fix more nits (LongCatIsLooong)

* Fix failing tests

* Make parameters (guaranteed by platform to be non-nullable) non-nullable

* Fix analysis issues
2023-01-31 19:46:18 +00:00
Renzo Olivares
6c12e39947
Introduce ParagraphBoundary subclass for text editing (#116549)
* attempt to extend to paragraph

* second attempt

* clean up implementation

* clean up

* updates

* updates

* Fix implementation

* remove old

* update docs

* update docs

* fix analyzer

* Fix bug where new line character was selected and backwards selection failed

* remove print

* Add test for paragraph boundary

* Add text editing test for extending selection to paragraph for mac and ios

* rename to ExtendSelectionToParagraphBoundaryIntent

* fix analyzer

* Should default to downstream when collapsing selection

* get rid of _getParagraphAtOffset and move into getTextBoundaryAt

* Search for all line terminators

* iterate through code units instead of characters

* Address some reviewer comments"

* Add separate implementations for leading and trailing paragraph boundary methods

* Do not break after a carriage return if it is followed by a line feed

* test carriage return followed by a line feed

* more tests

* Do not continue if the line terminator is at the target text offset

* add hack to extend highlight to line terminator

* Revert "add hack to extend highlight to line terminator"

This reverts commit b4d3c434539b66c3c81c215e87c645b425902825.

* Revert "Do not continue if the line terminator is at the target text offset"

This reverts commit 789e1b838e54e7c25600bfa8852e59431ccaf5dc.

* Update ParagraphBoundary with latest TextBoundary changes

* Update implementation to iterate through indexes

* update getTrailingTextBoundaryAt to include the line terminator

* Updates

* more updates

* more updates

* updates

* updates

* Lets try this again

* clean up

* updates

* more updates

* updates

* fix

* Re-implement using custom paragraph boundary applying method

* Revert "Re-implement using custom paragraph boundary applying method"

This reverts commit cd2f7f4b6eb6726b28f82a43708812e06a49df95.

* Revert "fix"

This reverts commit 8ec1f8f58935cfb3eb86dc6afd2894537af4cf7b.

* updates

* Revert "updates"

This reverts commit 9dcca4a0031fe18ada9d6ffbbe77ba09918e82ae.

* Revert "Revert "fix""

This reverts commit 9cc1332cd3041badc472d0d223a106203e46afb8.

* Revert "Revert "Re-implement using custom paragraph boundary applying method""

This reverts commit 1acb606fb743fd840da20cca26d9a7c26accb71d.

* Fix paragraph boundaries

* Add failing test

* Address some comments

* group tests and fix analyzer

* fix typo

* fix remaining test

* updates

* more fixes and logs

* clean up and add another test

* Fix last test

* Add new test

* Clean up

* more clean up

* clean up comments

* address comments

* updates

* return null when position is out of bounds and 0 or end of text if appropriate

* Clean up cases

* Do not return null when OOB in the direction of iteration

* clean up

* simplify implementation thanks to LongCatIsLooong feedback

* Address comments

* Add line and paragraph separator

* Use _moveBeyondTextBoundary instead of custom _moveToParagraphBoundary

* Change some intent names and revert fromPosition change

* clean up docs

---------

Co-authored-by: Renzo Olivares <roliv@google.com>
2023-01-30 22:44:26 +00:00
Justin McCandless
17eb2e8aeb
Ability to disable the browser's context menu on web (#118194)
Enables custom context menus on web
2023-01-30 09:03:03 -08:00
Christopher Fujino
a04ab7129b
Revert "Add API for discovering assets (#118410)" (#119273)
This reverts commit 2b8f2d05045590cd4aeb9f02c67baaa69db35e5e.
2023-01-26 20:01:12 +00:00
Andrew Kolos
2b8f2d0504
Add API for discovering assets (#118410)
* add asset manifest bin loading and asset manifest api

* use new api for image resolution

* remove upfront smc data casting

* fix typecasting issue

* remove unused import

* fix tests

* lints

* lints

* fix import

* revert image resolution changes

* Update image_resolution_test.dart

* Update decode_and_parse_asset_manifest.dart

* make targetDevicePixelRatio optional

* Update packages/flutter/lib/src/services/asset_manifest.dart

Co-authored-by: Jonah Williams <jonahwilliams@google.com>

* Update packages/flutter/lib/src/services/asset_manifest.dart

Co-authored-by: Jonah Williams <jonahwilliams@google.com>

* fix immutable not being imported

* return List in AssetManifest methods, fix annotation import

* simplify onError callback

* make AssetManifest methods abstract instead of throwing UnimplementedError

* simplify AssetVariant.key docstring

* tweak _AssetManifestBin docstring

* make AssetManifest and AssetVariant doc strings more specific

* use List.of instead of List.from for type-safety

* adjust import

* change _AssetManifestBin comment from doc comment to normal comment

* revert to callback function for onError in loadStructuredBinaryData

* add more to the docstring of AssetManifest.listAssets and AssetVariant.key

* add tests for CachingAssetBundle caching behavior

* add simple test to ensure loadStructuredBinaryData correctly calls load

* Update asset_manifest.dart

* update docstring for AssetManifest.getAssetVariants

* rename getAssetVariants, have it include main asset

* rename isMainAsset field of AssetMetadata to main

* (slightly) shorten name of describeAssetAndVariants

* rename describeAssetVariants back to getAssetVariants

* add tests for TestAssetBundle

* nits

* fix typo in docstring

* remove no longer necessary non-null asserts

Co-authored-by: Jonah Williams <jonahwilliams@google.com>
2023-01-26 19:05:00 +00:00
Michael Goderbauer
bb73121cb4
Remove unnecessary null checks in flutter/test (#118905) 2023-01-20 22:09:06 +00:00
Shogo Hida
780563ce05
Add const constructor to TextInputFormatter (#116654)
* Add const constructor to TextInputFormatter

* Fix test

* Add abstract

* Add noSuchMethod

Signed-off-by: Shogo Hida <shogo.hida@gmail.com>

* Add @override and void

Signed-off-by: Shogo Hida <shogo.hida@gmail.com>

* Fix text and position of test

Signed-off-by: Shogo Hida <shogo.hida@gmail.com>

Signed-off-by: Shogo Hida <shogo.hida@gmail.com>
2023-01-18 00:55:33 +00:00
LongCatIsLooong
0a2e0a4730
Avoid using TextAffinity in TextBoundary (#117446)
* Avoid affinity like the plague

* ignore lint

* clean up

* fix test

* review

* Move wordboundary to text painter

* docs

* fix tests
2023-01-05 17:04:15 +00:00