hnvn / flutter_shimmer

A package provides an easy way to add shimmer effect in Flutter project
BSD 3-Clause "New" or "Revised" License
1.79k stars 204 forks source link

Shimmer on flutter web throwing UnimplementedError #52

Open Simouche opened 3 years ago

Simouche commented 3 years ago

Hello, I have this code:

  const ProductCard({Key? key}) : super(key: key);

  @override
  _ProductCardState createState() => _ProductCardState();
}

class _ProductCardState extends State<ProductCard> {
  @override
  Widget build(BuildContext context) {
    return Shimmer.fromColors(
      baseColor: Colors.grey[300]!,
      highlightColor: Colors.grey[100]!,
      enabled: true,
      child: Column(
        mainAxisSize: MainAxisSize.max,
        children: <Widget>[
          Stack(
            alignment: AlignmentDirectional.topEnd,
            children: <Widget>[
              Image.asset("assets/images/placeholders/1.png"),
              Container(
                margin: EdgeInsets.only(top: 10.0, right: 10.0),
                padding: EdgeInsets.symmetric(horizontal: 5.0, vertical: 1.0),
                color: BROWN,
                child: Text(
                  "NEW",
                  style: Theme.of(context).textTheme.headline5,
                ),
              )
            ],
          ),
          SizedBox(height: 5.0),
          Text(
            translate(Keys.Pages_Products_Category),
            style: Theme.of(context).textTheme.headline6,
          ),
          SizedBox(height: 5.0),
          Text(
            "Product Name",
            style:
                Theme.of(context).textTheme.headline5!.copyWith(color: BLACK),
          ),
          SizedBox(height: 5.0),
          Text(
            "5000.00 DZD",
            style: Theme.of(context).textTheme.caption,
          ),
        ],
      ),
    );
  }
}

When i try to run it on the web, it throws UnimplementedError:

======== Exception caught by scheduler library =====================================================
The following UnimplementedError was thrown during a scheduler callback:
UnimplementedError

When the exception was thrown, this was the stack: 
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 236:49  throw_
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/_engine/engine/canvaskit/layer_scene_builder.dart 196:5   pushShaderMask
packages/flutter/src/rendering/layer.dart 1779:26                                                                          addToScene
packages/flutter/src/rendering/layer.dart 407:5                                                                            [_addToSceneWithRetainedRendering]
packages/flutter/src/rendering/layer.dart 994:14                                                                           addChildrenToScene

any idea about that? how to fix that?