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

Getting error like 'dart:ui/painting.dart': Failed assertion: line 1147: '<optimized out>': is not true. #120

Closed
sureace opened this issue Nov 11, 2020 · 7 comments · Fixed by #135

Comments

@sureace
Copy link

sureace commented Nov 11, 2020

When i migrate to latest version, i getting this error continuously in the logs like infinite. Below is my code.
PinCodeTextField( appContext: context, length: 6, pinTheme: PinTheme( shape: PinCodeFieldShape.box, borderRadius: BorderRadius.circular(10), borderWidth: 1, fieldWidth: SizeConfig.widthMultiplier * 12, fieldHeight: SizeConfig.widthMultiplier * 12, activeColor: Colors.black87, selectedColor: AppTheme.btnGreen, inactiveColor: Colors.grey[300], ), textStyle: TextStyle(fontSize: 14,fontWeight: FontWeight.normal), onChanged: (value){ print(value); setState(() { smsPinEntered = false; smsPin = value; }); }, onCompleted: (status){ print("Completed :$status"); setState(() { smsPinEntered = true; }); }, beforeTextPaste: (text) { print("Allowing to paste $text"); //if you return true then it will show the paste confirmation dialog. Otherwise if false, then nothing will happen. //but you can show anything you want here, like your pop up saying wrong paste format or etc return true; } )

@adar2378
Copy link
Owner

Hi could you show your flutter doctor info. Which flutter channel and version you're using.

@sureace
Copy link
Author

sureace commented Nov 11, 2020

Hi thanks for prompt response. Error has gone after change the code with below.

PinCodeTextField(
appContext: context,
length: 6,
obscureText: false,
obscuringCharacter: '*',
animationType: AnimationType.fade,
cursorColor: Colors.black,
animationDuration: Duration(milliseconds: 300),
backgroundColor: Colors.transparent,
enableActiveFill: true,
controller: pinController,
keyboardType: TextInputType.number,
pinTheme: PinTheme(
shape: PinCodeFieldShape.box,
borderRadius: BorderRadius.circular(10),
borderWidth: 1,
activeFillColor: Colors.white,
inactiveFillColor: Colors.grey[100],
selectedFillColor: Colors.white,
fieldWidth: SizeConfig.widthMultiplier * 12,
fieldHeight: SizeConfig.widthMultiplier * 12,
activeColor: Colors.black87,
selectedColor: AppTheme.btnGreen,
inactiveColor: Colors.grey[300],
),
textStyle: TextStyle(fontSize: 14,fontWeight: FontWeight.normal),
onChanged: (value){
print(value);
setState(() {
smsPinEntered = false;
smsPin = value;
});
},
onCompleted: (status){
print("Completed :$status");
setState(() {
smsPinEntered = true;
});
},
beforeTextPaste: (text) {
print("Allowing to paste $text");
//if you return true then it will show the paste confirmation dialog. Otherwise if false, then nothing will happen.
//but you can show anything you want here, like your pop up saying wrong paste format or etc
return true;
}
)

Flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.22.3, on Mac OS X 10.15.4 19E287, locale en)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
[✓] Android Studio (version 3.5)

@adar2378
Copy link
Owner

Glad to hear it. Which change solved the error?

@wwwhttpru
Copy link

Solution to the problem.
cursorColor: Colors.black.

@Tmarks2
Copy link

Tmarks2 commented Dec 3, 2020

Changing
cursorColor: Colors.black Fixed The Problem for me as Well! Thank you @wwwhttpru

@darkang3lz92
Copy link
Contributor

darkang3lz92 commented Dec 17, 2020

Caused by Theme.textSelectionTheme.cursorColor null value (Probably from flutter recent update?). Is this better if we assign default cursorColor as Theme.accentColor if check that Theme.textSelectionTheme.cursorColor is null?

Check in this order
User assign cursor Color > Theme.textSelectionTheme.cursorColor > Theme.accentColor

@adar2378
Copy link
Owner

Yeah sounds like a good idea! The recent update looks a bit inconsistent which is causing this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants