Skip to content

Scribble throws RenderBox was not laid out: RenderFractionalTranslation#23d29 NEEDS-LAYOUT NEEDS-PAINT when home & initial route are specified  #127803

Open

Description

@marcoancona

The following error occurs when focusing a TextField widget using the Apple Pencil on iPad. The error is not raised when tapping with a finger on the field to use the virtual keyboard. Scribbe does not work when this error is raised.

logs
════════ Exception caught by services library ══════════════════════════════════
The following assertion was thrown during method call TextInputClient.requestElementsInRect:
RenderBox was not laid out: RenderFractionalTranslation#23d29 NEEDS-LAYOUT NEEDS-PAINT
'package:flutter/src/rendering/box.dart':
box.dart:1
Failed assertion: line 1966 pos 12: 'hasSize'

2

Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=2_bug.md

When the exception was thrown, this was the stack
#2      RenderBox.size
box.dart:1966
#3      RenderFractionalTranslation.applyPaintTransform
proxy_box.dart:2988
#4      RenderObject.getTransformTo
object.dart:3174
#5      _ScribbleFocusableState.bounds
editable_text.dart:5006
#6      _ScribbleFocusableState.isInScribbleRect
editable_text.dart:4984
#7      TextInput._handleTextInputInvocation.<anonymous closure>
text_input.dart:1771
#8      WhereIterator.moveNext (dart:_internal/iterable.dart:441:13)
#9      MappedIterator.moveNext (dart:_internal/iterable.dart:392:19)
#10     new _GrowableList._ofOther (dart:core-patch/growable_array.dart:202:26)
#11     new _GrowableList.of (dart:core-patch/growable_array.dart:152:26)
#12     new List.of (dart:core-patch/array_patch.dart:47:28)
#13     Iterable.toList (dart:core/iterable.dart:494:7)
#14     TextInput._handleTextInputInvocation
text_input.dart:1779
#15     TextInput._loudlyHandleTextInputInvocation
text_input.dart:1746
#16     MethodChannel._handleAsMethodCall
platform_channel.dart:547
#17     MethodChannel.setMethodCallHandler.<anonymous closure>
platform_channel.dart:540
#18     _DefaultBinaryMessenger.setMessageHandler.<anonymous closure>
binding.dart:479
#19     _invoke2 (dart:ui/hooks.dart:174:13)
#20     _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:40:5)
#21     _Channel.push (dart:ui/channel_buffers.dart:130:31)
#22     ChannelBuffers.push (dart:ui/channel_buffers.dart:326:17)
#23     PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:686:22)
#24     _dispatchPlatformMessage (dart:ui/hooks.dart:86:31)
(elided 2 frames from class _AssertionError)
call: MethodCall(TextInputClient.requestElementsInRect, [271.5, 371.5, 60, 120])
════════════════════════════════════════════════════════════════════════════════
flutter doctor -v
[✓] Flutter (Channel stable, 3.10.2, on macOS 13.0 22A380 darwin-arm64, locale en-CH)
    • Flutter version 3.10.2 on channel stable at /Users/marcoancona/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 9cd3d0d9ff (6 days ago), 2023-05-23 20:57:28 -0700
    • Engine revision 90fa3ae28f
    • Dart version 3.0.2
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at /Users/marcoancona/Library/Android/sdk
    • Platform android-33, build-tools 32.0.0
    • Java binary at: ...
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14B47b
    • CocoaPods version 1.11.3

Activity

  1. changed the title [-]Scribbe issue - RenderBox was not laid out: RenderFractionalTranslation#23d29 NEEDS-LAYOUT NEEDS-PAINT[/-] [+]Scribble issue - RenderBox was not laid out: RenderFractionalTranslation#23d29 NEEDS-LAYOUT NEEDS-PAINT[/+] on May 29, 2023
  2. danagbemava-nc commented on May 30, 2023

    @danagbemava-nc
    Member

    Hi @marcoancona, please provide a complete minimal reproducible code sample along with steps to reproduce so that we can investigate this issue. I tested with the counter app with a TextField but I could not reproduce the error.

    Thank you

  3. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on May 30, 2023
  4. marcoancona commented on May 30, 2023

    @marcoancona
    Author

    Hi @danagbemava-nc ,
    While working on the minimal example I could narrow down the problem. The issue seems to only occur if MaterialApp is used with both a initialRoute and a home as in this example:

    import 'package:flutter/material.dart';
    
    void main() {
      runApp(const MyApp());
    }
    
    class MyApp extends StatelessWidget {
      const MyApp({super.key});
    
      // This widget is the root of your application.
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Flutter Demo',
          theme: ThemeData(
            colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
            useMaterial3: true,
          ),
          home: const MyHomePage(title: 'Flutter Demo Home Page'),
        );
      }
    }
    
    class MyHomePage extends StatefulWidget {
      const MyHomePage({super.key, required this.title});
    
      final String title;
    
      @override
      State<MyHomePage> createState() => _MyHomePageState();
    }
    
    class _MyHomePageState extends State<MyHomePage> {
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          initialRoute: "/home",
          routes: {
            "/home": (context) => const NewWidget(),
          },
          home: const NewWidget(), // < comment this out and the exception does not occurr
        );
      }
    }
    
    class NewWidget extends StatelessWidget {
      const NewWidget({
        super.key,
      });
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          resizeToAvoidBottomInset: true,
          appBar: AppBar(
            automaticallyImplyLeading: false,
          ),
          body: const Center(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.center,
              children: <Widget>[
                TextField(),
                SizedBox(
                  height: 12,
                ),
              ],
            ),
          ),
        );
      }
    }

    Now I also found that the documentation says Warning: When using initialRoute, don’t define a home property. Not sure if this then should be an expected error. Definitely, more guidance on the error message would help.

  5. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on May 30, 2023
  6. changed the title [-]Scribble issue - RenderBox was not laid out: RenderFractionalTranslation#23d29 NEEDS-LAYOUT NEEDS-PAINT[/-] [+]Scribble throws `RenderBox was not laid out: RenderFractionalTranslation#23d29 NEEDS-LAYOUT NEEDS-PAINT` when home & initial route are specified [/+] on May 31, 2023
  7. danagbemava-nc commented on May 31, 2023

    @danagbemava-nc
    Member

    Issue is reproducible using the code sample provided in #127803 (comment).

    Removing/Commenting home in the sample code makes Scribble work again. Looking at the widget tree in devtools, there are 2 NewWidget nodes so perhaps that's why the scribble cannot determine where to start and as such throws the error.

    Screenshot 2023-05-31 at 07 02 21

    The error logs are the same as what OP shared above. I agree that improving the error message would be helpful.

    Labeling for further insight from the team.

    flutter doctor -v
    [✓] Flutter (Channel stable, 3.10.2, on macOS 13.4 22F66 darwin-arm64, locale en-GB)
        • Flutter version 3.10.2 on channel stable at /Users/nexus/dev/sdks/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 9cd3d0d9ff (7 days ago), 2023-05-23 20:57:28 -0700
        • Engine revision 90fa3ae28f
        • Dart version 3.0.2
        • DevTools version 2.23.1
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
        • Android SDK at /Users/nexus/Library/Android/sdk
        • Platform android-33, build-tools 33.0.0
        • Java binary at: /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9971841/Android Studio.app/Contents/jbr/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 14.3)
        • Xcode at /Applications/Xcode-14.3.0.app/Contents/Developer
        • Build 14E222b
        • CocoaPods version 1.12.1
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2022.2)
        • Android Studio at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9971841/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.6+0-17.0.6b802.4-9586694)
    
    [✓] Android Studio (version 2022.2)
        • Android Studio at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9862592/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.6+0-17.0.6b802.4-9586694)
    
    [✓] IntelliJ IDEA Ultimate Edition (version 2023.1.2)
        • IntelliJ at /Users/nexus/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
        • Flutter plugin version 73.1.1
        • Dart plugin version 231.9065
    
    [✓] IntelliJ IDEA Ultimate Edition (version 2023.1.2)
        • IntelliJ at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.9011.34/IntelliJ IDEA.app
        • 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
    
    [✓] IntelliJ IDEA Ultimate Edition (version 2023.1.1)
        • IntelliJ at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.8770.65/IntelliJ IDEA.app
        • 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
    
    [✓] VS Code (version 1.78.2)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.64.0
    
    [✓] Connected device (4 available)
        • Nexus (mobile)       • 00008020-001875E83A38002E • ios            • iOS 16.5 20F66
        • Dean’s iPad (mobile) • 00008103-000825C811E3401E • ios            • iOS 16.5 20F66
        • macOS (desktop)      • macos                     • darwin-arm64   • macOS 13.4 22F66 darwin-arm64
        • Chrome (web)         • chrome                    • web-javascript • Google Chrome 113.0.5672.126
        ! Error: Nexus is busy: Fetching debug symbols for Nexus. Xcode will continue when Nexus is finished. (code -10)
    
    [✓] Network resources
        • All expected network resources are available.
    
    • No issues found!
    
    [!] Flutter (Channel master, 3.11.0-16.0.pre.22, on macOS 13.4 22F66 darwin-arm64, locale en-GB)
        • Flutter version 3.11.0-16.0.pre.22 on channel master at /Users/nexus/dev/sdks/flutters
        ! Warning: `flutter` on your path resolves to /Users/nexus/dev/sdks/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/nexus/dev/sdks/flutters. Consider adding /Users/nexus/dev/sdks/flutters/bin to the front of your path.
        ! Warning: `dart` on your path resolves to /Users/nexus/dev/sdks/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/nexus/dev/sdks/flutters. Consider adding /Users/nexus/dev/sdks/flutters/bin to the front of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision c8279488b1 (89 minutes ago), 2023-05-31 01:39:00 -0400
        • Engine revision b7fced3708
        • Dart version 3.1.0 (build 3.1.0-155.0.dev)
        • DevTools version 2.23.1
        • 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 33.0.0)
        • Android SDK at /Users/nexus/Library/Android/sdk
        • Platform android-33, build-tools 33.0.0
        • Java binary at: /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9971841/Android Studio.app/Contents/jbr/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 14.3)
        • Xcode at /Applications/Xcode-14.3.0.app/Contents/Developer
        • Build 14E222b
        • CocoaPods version 1.12.1
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2022.2)
        • Android Studio at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9971841/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.6+0-17.0.6b802.4-9586694)
    
    [✓] Android Studio (version 2022.2)
        • Android Studio at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9862592/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.6+0-17.0.6b802.4-9586694)
    
    [✓] IntelliJ IDEA Ultimate Edition (version 2023.1.2)
        • IntelliJ at /Users/nexus/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
        • Flutter plugin version 73.1.1
        • Dart plugin version 231.9065
    
    [✓] IntelliJ IDEA Ultimate Edition (version 2023.1.2)
        • IntelliJ at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.9011.34/IntelliJ IDEA.app
        • 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
    
    [✓] IntelliJ IDEA Ultimate Edition (version 2023.1.1)
        • IntelliJ at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.8770.65/IntelliJ IDEA.app
        • 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
    
    [✓] VS Code (version 1.78.2)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.64.0
    
    [✓] Connected device (4 available)
        • Nexus (mobile)       • 00008020-001875E83A38002E • ios            • iOS 16.5 20F66
        • Dean’s iPad (mobile) • 00008103-000825C811E3401E • ios            • iOS 16.5 20F66
        • macOS (desktop)      • macos                     • darwin-arm64   • macOS 13.4 22F66 darwin-arm64
        • Chrome (web)         • chrome                    • web-javascript • Google Chrome 113.0.5672.126
        ! Error: Nexus is busy: Fetching debug symbols for Nexus. Xcode will continue when Nexus is finished. (code -10)
    
    [✓] Network resources
        • All expected network resources are available.
    
    ! Doctor found issues in 1 category.
    
    
  8. added
    a: text inputEntering text in a text field or keyboard related problems
    platform-iosiOS applications specifically
    frameworkflutter/packages/flutter repository. See also f: labels.
    a: tabletTablets and landscape phones
    a: error messageError messages from the Flutter framework
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    and removed
    in triagePresently being triaged by the triage team
    on May 31, 2023
  9. 22 remaining items

  10. justinmc commented on Oct 3, 2024

    @justinmc
    Contributor

    Moving this to team-text-input since @LongCatIsLooong is taking a look.

  11. flutter-triage-bot commented on Feb 7, 2025

    @flutter-triage-bot

    This issue is assigned to @LongCatIsLooong but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!

  12. added
    ⏳Bot is counting down the days until it unassigns the issue
    on Feb 7, 2025
  13. flutter-triage-bot commented on Apr 25, 2025

    @flutter-triage-bot

    This issue was assigned to @LongCatIsLooong but has had no status updates in a long time. To remove any ambiguity about whether the issue is being worked on, the assignee was removed.

  14. removed
    ⏳Bot is counting down the days until it unassigns the issue
    on Apr 25, 2025
  15. justinmc commented on May 1, 2025

    @justinmc
    Contributor

    From triage, @LongCatIsLooong thought this was likely a framework issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: error messageError messages from the Flutter frameworka: tabletTablets and landscape phonesa: text inputEntering text in a text field or keyboard related problemsf: routesNavigator, Router, and related APIs.found in release: 3.10Found to occur in 3.10found in release: 3.11Found to occur in 3.11frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions