Skip to content

The 'checkerboardRasterCacheImages' of 'MaterialApp' not working on master channel #106946

@ColdPaleLight

Description

@ColdPaleLight

The code below should show the chessboard when running, but it doesn't now.

import 'package:flutter/material.dart';

void main() {
  runApp(const MaterialApp(
    checkerboardRasterCacheImages: true,
    home: Scaffold(
      body: Example(),
    ),
  ));
}

class Example extends StatefulWidget {
  const Example({Key? key}) : super(key: key);

  @override
  State<Example> createState() => _ExampleState();
}

class _ExampleState extends State<Example> with TickerProviderStateMixin {
  late final AnimationController _controller = AnimationController(vsync: this, duration: const Duration(seconds: 1));
  late final Animation<Offset> _position = _controller.drive(
    Tween(begin: const Offset(0.0, 0.0), end: const Offset(1, 1.0)));

  @override
  void initState() {
    super.initState();
    _controller.reset();
    _controller.forward();
    _controller.addStatusListener((status) {
      if (status == AnimationStatus.completed) {
    _controller.reset();
    _controller.forward();
      }
    });
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      children: <Widget>[
        Container(height: 100),
        SlideTransition(
          position: _position,
          child: Opacity(
            opacity: 0.9,
            child: Container(
              child: Column(
                children: <Widget>[
                  Container(
                    width: 200,
                    height: 200,
                    color: Colors.red,
                    child: const Text('A'),
                  ),
                ],
              ),
            ),
          ),
        ),
      ],
    );
  }
}

The reason is that this line of code uses the wrong field.
https://github.com/flutter/engine/blob/main/flow/layers/layer_raster_cache_item.cc#L155

Here is the patch for it flutter/engine#34424

cc @flar @JsouLiang

flutter doctor -v

[✓] Flutter (Channel master, 3.1.0-0.0.pre.1468, on macOS 12.2.1 21D62 darwin-arm (Rosetta), locale zh-Hans-CN)
    • Flutter version 3.1.0-0.0.pre.1468 on channel master at /Users/bytedance/Develop/upstream/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 1add0d790d (6 hours ago), 2022-07-01 00:39:07 -0400
    • Engine revision caec3e305a
    • Dart version 2.18.0 (build 2.18.0-242.0.dev)
    • DevTools version 2.14.1
    • Pub download mirror https://dart-pub.byted.org
    • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /Users/bytedance/Library/Android/sdk
    • Platform android-32, build-tools 32.1.0-rc1
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 13F100
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.68.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.42.0

[✓] Connected device (3 available)
    • iPhone SE (2nd generation) (mobile) • 00008030-0018042E2E46802E • ios            • iOS 15.0 19A346
    • macOS (desktop)                     • macos                     • darwin-arm64   • macOS 12.2.1 21D62 darwin-arm (Rosetta)
    • Chrome (web)                        • chrome                    • web-javascript • Google Chrome 103.0.5060.53

[✓] HTTP Host Availability
    • All required HTTP hosts are available

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listengineflutter/engine related. See also e: labels.found in release: 3.1Found to occur in 3.1has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionwaiting for PR to land (fixed)A fix is in flight

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions