1. 15 Dec, 2023 1 commit
    • Srujan Gaddam's avatar
      Move package:web dependency to dev dependency (#139696) · 2407f699
      Srujan Gaddam authored
      Pinning the package:web dependency constrains downstream packages from
      using newer versions and making sure they support the version pinned in
      Flutter. Since the usage of package:web in Flutter is light, we should
      instead have a small shim like the engine and keep package:web as a dev
      dependency only.
      2407f699
  2. 22 Oct, 2023 1 commit
    • Todd Volkert's avatar
      Add timeline events for post frame callbacks (#136435) · cb9a3f69
      Todd Volkert authored
      Before this change, long-running post-frame callbacks wouldn't show up in the timeline at all.  This adds a timeline event for post-frame callbacks, with a debug flag that will add timeline events for each individual callback.
      
      #testexempt -- we have no way to test calls to the timeline.
      cb9a3f69
  3. 20 Sep, 2023 1 commit
    • Greg Spencer's avatar
      Remove 'must be non-null' and 'must not be null' comments in widgets library (#134992) · 6e5134b0
      Greg Spencer authored
      ## Description
      
      This removes all of the comments that are of the form "so-and-so (must not be null|can ?not be null|must be non-null)" from the cases where those values are defines as non-nullable values.
      
      This PR removes them from the widgets library.
      
      This was done by hand, since it really didn't lend itself to scripting, so it needs to be more than just spot-checked, I think. I was careful to leave any comment that referred to parameters that were nullable, but I may have missed some.
      
      In addition to being no longer relevant after null safety has been made the default, these comments were largely fragile, in that it was easy for them to get out of date, and not be accurate anymore anyhow.
      
      This did create a number of constructor comments which basically say "Creates a [Foo].", but I don't really know how to avoid that in a large scale change, since there's not much you can really say in a lot of cases.  I think we might consider some leniency for constructors to the "Comment must be meaningful" style guidance (which we de facto have already, since there are a bunch of these).
      
      ## Related PRs
      - https://github.com/flutter/flutter/pull/134984
      - https://github.com/flutter/flutter/pull/134991
      - https://github.com/flutter/flutter/pull/134993
      - https://github.com/flutter/flutter/pull/134994
      
      ## Tests
       - Documentation only change.
      6e5134b0
  4. 18 Sep, 2023 1 commit
  5. 08 Sep, 2023 1 commit
  6. 31 Aug, 2023 1 commit
  7. 07 Aug, 2023 1 commit
  8. 18 Jul, 2023 1 commit
  9. 16 Jun, 2023 1 commit
    • Mouad Debbar's avatar
      [web] Don't crash on `const HtmlElementView()` (#128965) · fc8856eb
      Mouad Debbar authored
      Previously, when the code contained `const HtmlElementView()` it would break even if it's guarded by `if (kIsWeb)`.
      
      This PR makes it such that `const HtmlElementView()` is allowed but it still throws if it gets inserted into the widget tree by mistake on non-web platforms.
      
      One improvement we can make in the future is to have a conditional import:
      - `_html_element_view_web.dart` that contains the real `HtmlElementView` that can only be instantiated on web.
      - `_html_element_view_io.dart` that contains a stub with an unimplemented `build()` method.
      
      Fixes https://github.com/flutter/flutter/issues/43532
      fc8856eb
  10. 15 Jun, 2023 1 commit
    • Mouad Debbar's avatar
      [web] Pass creation params to the platform view factory (#128146) · b0188cd1
      Mouad Debbar authored
      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
      b0188cd1
  11. 05 Apr, 2023 1 commit
  12. 23 Feb, 2023 1 commit
  13. 08 Feb, 2023 1 commit
    • Gabriel Terwesten's avatar
      Don't call `PlatformViewCreatedCallback`s after `AndroidViewController` is disposed (#116854) · ec289f1e
      Gabriel Terwesten authored
      * 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
      ec289f1e
  14. 24 Jan, 2023 1 commit
  15. 18 Jan, 2023 1 commit
  16. 15 Nov, 2022 1 commit
  17. 05 Oct, 2022 1 commit
  18. 21 Sep, 2022 1 commit
  19. 12 Sep, 2022 1 commit
  20. 12 Aug, 2022 1 commit
  21. 11 Aug, 2022 2 commits
  22. 10 Aug, 2022 1 commit
  23. 23 Jun, 2022 1 commit
  24. 06 Jun, 2022 1 commit
  25. 24 May, 2022 1 commit
  26. 14 Apr, 2022 1 commit
  27. 07 Apr, 2022 1 commit
  28. 30 Mar, 2022 1 commit
  29. 29 Mar, 2022 2 commits
  30. 24 Mar, 2022 1 commit
  31. 17 Mar, 2022 1 commit
  32. 16 Mar, 2022 2 commits
  33. 14 Mar, 2022 1 commit
  34. 20 Jul, 2021 1 commit
  35. 01 Jul, 2021 1 commit
  36. 10 Jun, 2021 1 commit
  37. 31 Mar, 2021 1 commit