fluttercommunity / font_awesome_flutter

The Font Awesome Icon pack available as Flutter Icons
Other
834 stars 236 forks source link

RangeError was thrown building FaIcon-[<'secondaryGlyph'> #171

Closed ghenry closed 2 years ago

ghenry commented 3 years ago

Hi all,

I seem to be getting this on upgrading to Flutter 2.2.1 and I've not changed anything I can see. I've added this to the file in question:

// @dart=2.11

as I'm not fully null safety migrated yet and this may well be nothing to do with FA, but it's all I've got to go on. Any ideas?

======== Exception caught by widgets library =======================================================
The following RangeError was thrown building FaIcon-[<'secondaryGlyph'>](IconData(U+11F5EA), color: Color(0x662092ed), dirty, dependencies: [Directionality, IconTheme]):
Invalid value: Not in inclusive range 0..1114111: 1177066

The relevant error-causing widget was: 
  FaDuotoneIcon file:///home/ghenry/AndroidStudioProjects/surevoip_talk/lib/src/view/home.dart:307:43
When the exception was thrown, this was the stack: 
#0      new String.fromCharCode (dart:core-patch/string_patch.dart:45:5)
#1      FaIcon.build (package:font_awesome_flutter/src/fa_icon.dart:106:22)
#2      StatelessElement.build (package:flutter/src/widgets/framework.dart:4648:28)
#3      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4574:15)
#4      Element.rebuild (package:flutter/src/widgets/framework.dart:4267:5)

Thanks.

michaelspiss commented 3 years ago

You may need to run the update script again. 9.1.0 mainly contained changes for duotone icons

ghenry commented 3 years ago

In my pro override repo? I’m pretty sure I did as I started from scratch at 9.1.0. I’ll add that I’m using v6 beta icons.json and ttfs in the 5.15 repo, but tools update.sh did run ok.

They are working in my Drawer but some pages and bottomnav I get this error. Very weird.

On Thu, 10 Jun 2021 at 23:17, Michael Spiss @.***> wrote:

You may need to run the update script again. 9.1.0 mainly contained changes for duotone icons

ghenry commented 3 years ago

Just confirmed, ./tools/update.sh was run.

michaelspiss commented 3 years ago

I tested v6 beta before releasing 9.1.0 and did not find any errors. Can you run the example app in font_awesome_flutter to test wether this is an issue in your app or with this package?

michaelspiss commented 3 years ago

To explain the error: secondaryGlyph is the key of the secondary colored part of a duotone icon (which is a FaIcon as well). As we are not using any arrays, my guess was that there was an update to an icon which changed its address in the ttf files.

ghenry commented 3 years ago

That was my next min test case.

On Fri, 11 Jun 2021 at 11:13, Michael Spiss @.***> wrote:

I tested v6 beta before releasing 9.1.0 and did not find any errors. Can you run the example app in font_awesome_flutter to test wether this is an issue in your app or with this package?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fluttercommunity/font_awesome_flutter/issues/171#issuecomment-859471865, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABG66E5VJDTS3VUF4O7IQTTSHOTPANCNFSM46PN4KWA .

ghenry commented 3 years ago

Hmmm, flutter run gives me:

lib/main.dart:112:43: Error: Getter not found: 'search'.                
            icon: FaIcon(FontAwesomeIcons.search),                      
                                          ^^^^^^                        

FAILURE: Build failed with an exception.                                

* Where:                                                                
Script '/home/ghenry/development/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1035

in the core FA repo of yours updated for fontawesome-pro-6.0.0-beta1-web

ghenry commented 3 years ago

Yeah, they've renamed most icons now which I had to sort in my code:

https://fontawesome.com/v5.15/icons/search?style=solid

is now:

https://fontawesome.com/v6.0/icons/magnifying-glass?style=solid

Thanks.

ghenry commented 3 years ago

Switching to this and I can run the app:

icon: FaIcon(FontAwesomeIcons.magnifyingGlass),                      

but I hit the same error in the example app as I'm getting in my app on quite a few icons as I scroll down.

I can share my pro repo with you if you like? I just followed the instructions like normal for pro. The fact that the thin style is there should show that I did it correct?

Screenshot_1623414099 Screenshot_1623414090 Screenshot_1623414085 Screenshot_1623414075

Thanks.

ghenry commented 3 years ago

Full error on Android 11 simulator:

══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following RangeError was thrown building FaIcon-[<'secondaryGlyph'>](IconData(U+11F9EE), color:
Color(0xdd000000), dirty, dependencies: [IconTheme, Directionality]):
Invalid value: Not in inclusive range 0..1114111: 1178094

The relevant error-causing widget was:
  FaIcon-[<'secondaryGlyph'>]
  file:///home/ghenry/src/font_awesome_flutter_pro/lib/src/fa_duotone_icon.dart:61:11

When the exception was thrown, this was the stack:
#0      new String.fromCharCode (dart:core-patch/string_patch.dart:45:5)
#1      FaIcon.build (package:font_awesome_flutter/src/fa_icon.dart:106:22)
#2      StatelessElement.build (package:flutter/src/widgets/framework.dart:4648:28)
#3      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4574:15)
#4      Element.rebuild (package:flutter/src/widgets/framework.dart:4267:5)
#5      ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4553:5)
#6      ComponentElement.mount (package:flutter/src/widgets/framework.dart:4548:5)
#7      Element.inflateWidget (package:flutter/src/widgets/framework.dart:3611:14)
#8      MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:6221:36)
#9      MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6232:32)
...     Normal element mounting (42 frames)
#51     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3611:14)
#52     MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:6221:36)
#53     MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6232:32)
...     Normal element mounting (115 frames)
#168    Element.inflateWidget (package:flutter/src/widgets/framework.dart:3611:14)
#169    Element.updateChild (package:flutter/src/widgets/framework.dart:3363:18)
#170    SliverMultiBoxAdaptorElement.updateChild (package:flutter/src/widgets/sliver.dart:1241:37)
#171    SliverMultiBoxAdaptorElement.createChild.<anonymous closure> (package:flutter/src/widgets/sliver.dart:1226:20)
#172    BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2535:19)
#173    SliverMultiBoxAdaptorElement.createChild (package:flutter/src/widgets/sliver.dart:1219:12)
#174    RenderSliverMultiBoxAdaptor._createOrObtainChild.<anonymous closure> (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:349:23)
#175    RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:1889:59)
#176    PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:912:15)
#177    RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1889:14)
#178    RenderSliverMultiBoxAdaptor._createOrObtainChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:338:5)
#179    RenderSliverMultiBoxAdaptor.insertAndLayoutChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:484:5)
#180    RenderSliverGrid.performLayout (package:flutter/src/rendering/sliver_grid.dart:658:17)
#181    RenderObject.layout (package:flutter/src/rendering/object.dart:1779:7)
#182    RenderSliverEdgeInsetsPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:137:12)
#183    RenderSliverPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:371:11)
#184    RenderObject.layout (package:flutter/src/rendering/object.dart:1779:7)
#185    RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:510:13)
#186    RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1574:12)
#187    RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1483:20)
#188    RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1636:7)
#189    PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:881:18)
#190    RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:462:19)
#191    WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:876:13)
#192    RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:328:5)
#193    SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1144:15)
#194    SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1082:9)
#195    SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:998:5)
#199    _invoke (dart:ui/hooks.dart:163:10)
#200    PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:259:5)
#201    _drawFrame (dart:ui/hooks.dart:126:31)
(elided 3 frames from dart:async)

════════════════════════════════════════════════════════════════════════════════════════════════════

Another exception was thrown: A RenderFlex overflowed by 99839 pixels on the bottom.
D/skia    ( 5739):    1 Shader compilation error
D/skia    ( 5739):    2 ------------------------
D/skia    ( 5739):    3 Errors:
D/skia    ( 5739):    4 

Another exception was thrown: RangeError: Invalid value: Not in inclusive range 0..1114111: 1176765

Another exception was thrown: A RenderFlex overflowed by 99839 pixels on the bottom.
D/skia    ( 5739):    1 Shader compilation error
D/skia    ( 5739):    2 ------------------------
D/skia    ( 5739):    3 Errors:
D/skia    ( 5739):    4 

Another exception was thrown: RangeError: Invalid value: Not in inclusive range 0..1114111: 1176701

Another exception was thrown: A RenderFlex overflowed by 99839 pixels on the bottom.

Another exception was thrown: RangeError: Invalid value: Not in inclusive range 0..1114111: 1176702

Another exception was thrown: A RenderFlex overflowed by 99839 pixels on the bottom.

Another exception was thrown: RangeError: Invalid value: Not in inclusive range 0..1114111: 1176398

Another exception was thrown: A RenderFlex overflowed by 99839 pixels on the bottom.
ghenry commented 3 years ago

And my changes in core repo for pro:

localhost ~/src/font_awesome_flutter_pro/example [master*]$ gits
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
    modified:   android/.gradle/buildOutputCleanup/buildOutputCleanup.lock
    modified:   android/.gradle/buildOutputCleanup/outputFiles.bin
    modified:   lib/icons.dart
    modified:   lib/main.dart
    modified:   ../lib/font_awesome_flutter.dart
    modified:   ../lib/fonts/fa-brands-400.ttf
    modified:   ../lib/fonts/fa-regular-400.ttf
    modified:   ../lib/fonts/fa-solid-900.ttf
    modified:   ../pubspec.yaml

Untracked files:
  (use "git add <file>..." to include in what will be committed)
    ../icons.json
    ../lib/fonts/fa-duotone-900.ttf
    ../lib/fonts/fa-light-300.ttf
    ../lib/fonts/fa-thin-100.ttf

no changes added to commit (use "git add" and/or "git commit -a")
kyiii commented 3 years ago

Am also experiencing this as of the latest FA pro version.

ghenry commented 3 years ago

I went back to 5.15.3. Works well with 9.10

On Sat, 19 Jun 2021, 06:52 kyiii, @.***> wrote:

Am also experiencing this as of the latest FA pro version.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fluttercommunity/font_awesome_flutter/issues/171#issuecomment-864360817, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABG66CRVHU54AQGWNVRAV3TTQWA3ANCNFSM46PN4KWA .

michaelspiss commented 3 years ago

They've changed the duotone font file's layout for v6, that's why it isn't working anymore. Working on it right now.

ghenry commented 3 years ago

Handy! As well as reverse all the names. Nothing wrong with the names before.

michaelspiss commented 3 years ago

@stedekay just drew my attention to a new attribute in icons.json - namely "aliases". Will see what I can do with this. If you have input regarding this, please leave a comment in #159

michaelspiss commented 3 years ago

It looks like we have to wait a bit longer for them to finish v6. Currently the documentation (https://fontawesome.com/v6.0) mentions addresses which do not exist within the font files.

michaelspiss commented 2 years ago

Support for duotone icons has been discontinued with version 10 of font_awesome_flutter. For the reasons why, please have a look at this comment.