flutter_gen icon indicating copy to clipboard operation
flutter_gen copied to clipboard

[BUG]: Cannot generate colors

Open DJTB opened this issue 3 years ago • 3 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Version

5.1.0+1

Command type

build_runner (Default)

What happened?

First time checking out this package.

Attempting to run with the following colors file (taken from the example dir)

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="white">#FFFFFF</color>
    <color name="black">#000000</color>
    <color name="gray_70">#EEEEEE</color>
    <color name="gray_410">#979797</color>
    <color name="crimson_red" type="material">#CF2A2A</color>
    <color name="yellow_ocher" type="material material-accent">#DF9527</color>
</resources>

throws

Unhandled exception:
FormatException: Invalid radix-16 number (at line 2, character 2)

Not sure what I'm doing wrong here or if it's a legitimate bug 🤷

Relevant a pubspec.yaml.

name: theme_x
version: 0.1.0+1
publish_to: none

environment:
  sdk: '>=2.18.0 <3.0.0'
  flutter: 3.3.8

dependencies:
  flutter:
    sdk: flutter

dev_dependencies:
  build_runner: ^2.3.3
  flutter_gen_runner: ^5.1.0+1
  flutter_test:
    sdk: flutter
  very_good_analysis: ^3.1.0

flutter_gen:
  colors:
    inputs:
      - assets/colors/colors.xml

flutter:
  uses-material-design: true # Include the Material Icons font

  # Assets for the application
  assets:
    - assets/audio/
    - assets/images/
    - assets/text/
    - assets/translations/

  fonts:
    - family: Graphik
      fonts:
        - asset: assets/fonts/Graphik-Regular.otf
          weight: 400
        - asset: assets/fonts/Graphik-Medium.otf
          weight: 500
        - asset: assets/fonts/Graphik-Semibold.otf
          weight: 600
    - family: Boing
      fonts:
        - asset: assets/fonts/Boing-Medium.ttf
          weight: 500
    - family: Icons
      fonts:
        - asset: assets/fonts/Stile_X_Icons.ttf

Relevant log output

FlutterGen v5.1.0+1 Loading ... theme_x/pubspec.yaml
Unhandled exception:
FormatException: Invalid radix-16 number (at line 2, character 2)

 ^

#0      int._handleFormatError (dart:core-patch/integers_patch.dart:131)
#1      int._parse (dart:core-patch/integers_patch.dart:72)
#2      int.parse (dart:core-patch/integers_patch.dart:65)
#3      new HexColor (package:color/hex_color.dart:18)
#4      swatchFromPrimaryHex (package:flutter_gen_core/utils/color.dart:20)
#5      _colorStatement (package:flutter_gen_core/generators/colors_generator.dart:64)
#6      MappedListIterable.elementAt (dart:_internal/iterable.dart:413)
#7      ListIterable.forEach (dart:_internal/iterable.dart:39)
#8      generateColors (package:flutter_gen_core/generators/colors_generator.dart:55)
#9      FlutterGenerator.build (package:flutter_gen_core/flutter_generator.dart:53)
#10     main (file:///Users/runner/work/flutter_gen/flutter_gen/packages/command/bin/flutter_gen_command.dart:48)
#11     _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:295)
#12     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192)

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

DJTB avatar Dec 20 '22 04:12 DJTB

@DJTB Thank you for reporting. I will check it.

wasabeef avatar Dec 27 '22 08:12 wasabeef

@DJTB DJ Can you tell me your Flutter and Dart versions?

wasabeef avatar Dec 28 '22 03:12 wasabeef

I'm not sure since I didn't keep this repo around. It was created with https://pub.dev/packages/very_good_cli.

I am currently on:

Flutter 3.3.10 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 135454af32 (3 weeks ago) • 2022-12-15 07:36:55 -0800
Engine • revision 3316dd8728
Tools • Dart 2.18.6 • DevTools 2.15.0

But I expect when I filed this bug I would have been using Flutter 3.3.8 and Dart 2.18.x

Happy to close this issue if you were unable to reproduce.

DJTB avatar Jan 03 '23 22:01 DJTB

@DJTB Could you reproduce this with the latest environment setup? I don't see any problems with the color XML so I guess it's something about an actual XML (because the content you've provided is our example).

AlexV525 avatar Jun 27 '24 02:06 AlexV525

Likely an issue with my setup at the time.

DJTB avatar Jun 27 '24 06:06 DJTB