Skip to content

[Web]: Gradient transforms do not work on web #56338

@mjohnsullivan

Description

@mjohnsullivan

Flutter version: Flutter (Channel dev, v1.18.0-8.0.pre, on Mac OS X 10.15.4 19E287, locale en-US)

The following code generates an error when run on the web:

══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞═════════════════════════════════════════════════════════
The following UnimplementedError was thrown during a scheduler callback:
matrix4 not supported in GradientRadial shader
When the exception was thrown, this was the stack:

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Gradient Tranform Test',
      theme: ThemeData(
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: Scaffold(body: Center(child: GradientExample())),
    );
  }
}

class GradientExample extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      width: 250,
      height: 250,
      decoration: BoxDecoration(
        gradient: RadialGradient(
          colors: [Colors.blue, Colors.green],
          transform: GradientRotation(3.14 / 4),
        ),
      ),
    );
  }
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions