Skip to content

Layout background not rendered #443

@apalala-dev

Description

@apalala-dev

Description

The fills and strokes of texts wrapped in Layout are not shown.

Steps To Reproduce

This is my sample class for the reproducible example :

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:rive/rive.dart';

class BackgroundLayoutTextTest extends StatefulWidget {
  const BackgroundLayoutTextTest({super.key, required this.assetPath});

  final String assetPath;

  @override
  State<BackgroundLayoutTextTest> createState() =>
      _BackgroundLayoutTextTestState();
}

class _BackgroundLayoutTextTestState extends State<BackgroundLayoutTextTest> {
  RiveFile? _riveData;

  @override
  void initState() {
    super.initState();
    _loadRiveAsset();
  }

  @override
  Widget build(BuildContext context) {
    if (_riveData == null) {
      return Placeholder();
    } else {
      return RiveAnimation.direct(
        _riveData!,
        artboard: 'test',
        alignment: Alignment.topCenter,
        fit: BoxFit.fitWidth,
      );
    }
  }

  Future<void> _loadRiveAsset() async {
    final data = await rootBundle.load(widget.assetPath);
    _riveData = RiveFile.import(data);
    setState(() {});
  }
}

Source .riv/.rev file

text_background.zip

Expected behavior

The Layout's background should be visible as on the Rive editor:
image

Screenshots

Backgrounds are not visibles, the blue is the fill color of the artboard:
image

Device & Versions (please complete the following information)

  • Device: Redmi 9C
  • OS: Android 11
  • Flutter Version: Copy-paste the output of flutter --version
Flutter 3.24.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 2663184aa7 (3 months ago) • 2024-09-11 16:27:48 -0500
Engine • revision 36335019a8
Tools • Dart 3.5.3 • DevTools 2.37.3

Additional context

The attached rive files are just a reproducible example but the production animation is a bit more complex.

Any workaround appreciated 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions