1. 15 Jun, 2023 3 commits
    • Mouad Debbar's avatar
      flutter update-packages --force-upgrade (#128908) · a162d754
      Mouad Debbar authored
      - Bumps `vm_service` from `11.6.0` to `11.7.1`
      - Bumps `web` from `0.1.3-beta` to `0.1.4-beta` and adds it everywhere.
      - Moves `js` from `dependencies` to `dev_dependencies`
      a162d754
    • 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
    • Christopher Fujino's avatar
      [flutter_tools] cache flutter sdk version to disk (#124558) · 3246808c
      Christopher Fujino authored
      Fixes https://github.com/flutter/flutter/issues/112833
      
      Most of the actual changes here are in [packages/flutter_tools/lib/src/version.dart](https://github.com/flutter/flutter/pull/124558/files#diff-092e00109d9e1589fbc7c6de750e29a6ae512b2dd44e85d60028953561201605), while the rest is largely just addressing changes to the constructor of `FlutterVersion` which now has different dependencies.
      
      This change makes `FlutterVersion` an interface with two concrete implementations:
      
      1. `_FlutterVersionGit` which is mostly the previous implementation, and
      2. `_FlutterVersionFromFile` which will read a new `.version.json` file from the root of the repo
      
      The [`FlutterVersion` constructor](https://github.com/flutter/flutter/pull/124558/files#diff-092e00109d9e1589fbc7c6de750e29a6ae512b2dd44e85d60028953561201605R70) is now a factory that first checks if `.version.json` exists, and if so returns an instance of `_FlutterVersionFromGit` else it returns the fallback `_FlutterVersionGit` which will end up writing `.version.json` so that we don't need to re-calculate the version on the next invocation.
      
      `.version.json` will be deleted in the bash/batch entrypoints any time we need to rebuild he tool (this will usually be because the user did `flutter upgrade` or `flutter channel`, or manually changed the commit with git).
      3246808c
  2. 14 Jun, 2023 14 commits
  3. 13 Jun, 2023 18 commits
  4. 12 Jun, 2023 5 commits