-
-
Notifications
You must be signed in to change notification settings - Fork 213
Description
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: Tkko
Describe the bug
I'm trying to achieve the following behaviour:
I'd like to number appear instantly after user input, just like regular TextField. Setting pinAnimationType: PinAnimationType.none simply removes the scale animation. Instead, it shows AnimatedSwitch where it's replacing the cursor with the value.
Setting animationDuration: Duration.zero to remove the transition animation makes Flutter framework to throw an error with following stacktrace:
The following assertion was thrown while notifying listeners for AnimationController:
A RenderAnimatedSize was mutated in its own performLayout implementation.
A RenderObject must not re-dirty itself while still being laid out.
The RenderObject being mutated was: RenderAnimatedSize#fdc0f relayoutBoundary=up19 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: offset=Offset(0.0, 0.0) (can use size)
constraints: BoxConstraints(0.0<=w<=382.0, 0.0<=h<=Infinity)
size: Size(382.0, 54.0)
alignment: Alignment.topCenter
textDirection: ltr
But setting the duration to Duration(milliseconds: 1) removes this error
To Reproduce
You can use this code snippet to reproduce it:
LayoutBuilder(
builder: (context, constraints) {
// 40 is padding of 8 between each item
final itemWith = (constraints.maxWidth - 40.0) / 6;
final defaultTheme = PinTheme(
width: itemWith,
textStyle: textTheme.bodyLarge?.copyWith(fontSize: 24.0),
padding: const EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: inputDecorationTheme.fillColor ?? Colors.transparent,
borderRadius: BorderRadius.circular(8.0),
border: Border.all(color: inputDecorationTheme.border?.borderSide.color ?? Colors.transparent),
),
);
return Pinput(
controller: _controller,
length: 6,
pinAnimationType: PinAnimationType.none,
animationDuration: Duration.zero,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
LengthLimitingTextInputFormatter(6),
],
errorTextStyle: inputDecorationTheme.errorStyle,
defaultPinTheme: defaultTheme,
focusedPinTheme: defaultTheme.copyWith(
decoration: defaultTheme.decoration?.copyWith(
border: Border.all(color: Colors.blue),
),
),
errorPinTheme: defaultTheme.copyWith(
decoration: defaultTheme.decoration?.copyWith(
border: Border.all(color: Colors.red),
),
),
);
},
),The widget that throws might be located at lib/src/pinput_state.dart at 522:18
Pinput version:
5.0.1
Result of: flutter doctor --verbose
Details
[!] Flutter (Channel [user-branch], 3.22.3, on macOS 15.3 24D60 darwin-x64, locale en-GB) ! Flutter version 3.22.3 on channel [user-branch] at /Users/dev/Dev/FlutterSDK/flutter Currently on an unknown channel. Run `flutter channel` to switch to an official channel. If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install. ! Upstream repository unknown source is not a standard remote. Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error. • Framework revision b0850beeb2 (9 months ago), 2024-07-16 21:43:41 -0700 • Engine revision 235db911ba • Dart version 3.4.4 • DevTools version 2.34.3 • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.[!] Android toolchain - develop for Android devices (Android SDK version 36.0.0)
• Android SDK at /Users/liubomyr.ishchenko/Library/Android/sdk
✗ cmdline-tools component is missing
Run path/to/sdkmanager --install "cmdline-tools;latest"
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 16.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16E140
• CocoaPods version 1.16.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2024.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-x64 • macOS 15.3 24D60 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 134.0.6998.167
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 2 categories.
Smartphone (please complete the following information):
- Device: iPhone 7+
- OS: iOS 15.8.2