eBay / flutter_glove_box

Various eBay tools for Flutter development
BSD 3-Clause "New" or "Revised" License
323 stars 69 forks source link

Support asset paths that include % and [, etc #182

Closed CORDEA closed 2 months ago

CORDEA commented 1 year ago

Hi team, thank you for the great package! I found a small problem, and tried to fix it. Could you please check it?

Error details

In the current release, the following error occurs when characters such as % are used in the asset path.

package:flutter/src/services/asset_bundle.dart 339:7  PlatformAssetBundle.load
package:golden_toolkit/src/font_loader.dart 30:37     loadAppFonts

Unable to load asset: "packages/custom_font/fonts/Raleway-Regular%25test.ttf".
The asset does not exist or has empty data.

I found that some characters such as % and [ in the asset path included in fontType are encoded. For example, Raleway-Regular!@$%^&*()[].ttf will be Raleway-Regular!@$%25%5E&*()%5B%5D.ttf.

How to reproduce

Create a package containing custom fonts like below.

flutter:
  fonts:
    - family: Raleway
      fonts:
        - asset: fonts/Raleway-Regular%test.ttf

And the create a widget using this font.

class CustomFontLabel extends StatelessWidget {
  const CustomFontLabel({super.key, required this.text});

  final String text;

  @override
  Widget build(BuildContext context) {
    return Text(
      text,
      style: const TextStyle(
        fontFamily: 'Raleway',
        package: 'custom_font',
        fontSize: 46,
      ),
    );
  }
}

Write a golden test using this widget on the app side, and it will fail.

void main() {
  setUp(() async {
    await loadAppFonts();
  });

  testGoldens('test', (tester) async {
    const widget = WidgetUsingCustomFontLabel();
    await tester.pumpWidgetBuilder(
      widget,
      wrapper: materialAppWrapper(),
    );
    await screenMatchesGolden(tester, 'test');
  });
}
coreysprague commented 2 months ago

@CORDEA

I deeply apologize, but we have decided to end-of-life this project 😞


This repo is no longer maintained

09/12/2024 Update:

Unfortunately we have made the tough decision to no longer actively maintain this repository. While the package has served us and the community well, we don't have the capacity to give it the attention it deserves.

We realize that this decision means that open pull requests will not be merged. Our hope is that the community will rally and focus their efforts around more actively maintained packages for aiding in golden-based tests.

Once again, we want to thank each and every one of you for your contributions over the years.

Thank you for your understanding.

Best regards,

The eBay Motors App team

CORDEA commented 2 months ago

Hi, @coreysprague!

Thank you for your kind comment and for your team's maintenance over the years!