Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wheel with enableTonalPalette -> LateInitializationError: Field '_activeColorSwatchList@1082511434' has not been initialized. #71

Closed
te8uekm12 opened this issue Jan 9, 2024 · 4 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@te8uekm12
Copy link

To reproduce the problem you need to modify example from: https://pub.dev/packages/flex_color_picker/example with

class _ColorPickerPageState extends State<ColorPickerPage> {
...
@override
  void initState() {
	...
	dialogPickerColor = const Color(0xFF613E42); \\ Set custom color to force wheel
	...
   }

   ...
  Future<bool> colorPickerDialog() async {
    return ColorPicker(
    ...
    enableTonalPalette: true, \\Enable tonal palete
    ...
    ).showPickerDialog(
     ...
    );
   }
}

Then you have to:

  • click on color swatch from section ''Click this color to modify it in a dialog..' to open 'Select color' with Wheel dialog active
  • select any color from tonal palete
  • change tab to primary then you will get an exception:
======== Exception caught by widgets library =======================================================
The following LateError was thrown building ColorPicker(dirty, state: _ColorPickerState#a56bf):
LateInitializationError: Field '_activeColorSwatchList@1082511434' has not been initialized.

The relevant error-causing widget was: 
  ColorPicker ColorPicker:file:///D:/workspace/mobile/ex_app/lib/ag/main.dart:255:12
When the exception was thrown, this was the stack: 
#0      _ColorPickerState._activeColorSwatchList (package:flex_color_picker/src/color_picker.dart)
#1      _ColorPickerState.build (package:flex_color_picker/src/color_picker.dart:1709:42)
#2      StatefulElement.build (package:flutter/src/widgets/framework.dart:5583:27)
#3      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5471:15)
#4      StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5634:11)
#5      Element.rebuild (package:flutter/src/widgets/framework.dart:5187:7)
#6      BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2895:19)
#7      WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:984:21)
@rydmike rydmike self-assigned this Jan 11, 2024
@rydmike
Copy link
Owner

rydmike commented Jan 19, 2024

Hi @te8uekm12,

Thanks for this report and sorry for the delay.
I have verified the bug, identified the bug cause and made a fix.
I just need to test and verify it a bit more.
I should be able to release the fix later today.

@rydmike rydmike added bug Something isn't working and removed in triage labels Jan 19, 2024
@rydmike rydmike added this to the 3.3.1 milestone Jan 19, 2024
rydmike added a commit that referenced this issue Jan 20, 2024
ALSO: Improve tests, including more coverage and test case for this issue.
@rydmike
Copy link
Owner

rydmike commented Jan 20, 2024

The bug is fixed, but the package is not released yet. GitHub auto closes an issues with a FIX is mentioned that references and issue. I re-opened the issue and will close it manually when the updated package that contains the fix has actually been released on pub.

@rydmike rydmike reopened this Jan 20, 2024
@rydmike
Copy link
Owner

rydmike commented Jan 20, 2024

Version 3.3.1 with the fix has been released.

@rydmike rydmike closed this as completed Jan 20, 2024
rydmike added a commit that referenced this issue Jan 21, 2024
ALSO: Improve tests, including more coverage and test case for this issue.

(cherry picked from commit 30dc6c5)
@te8uekm12
Copy link
Author

Works great, thanks for help:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants