Skip to content

Cannot get size from a render object that has not been through layout. #213

Description

@kangtian

════════ Exception caught by scheduler library ═════════════════════════════════
The following assertion was thrown during a scheduler callback:
Cannot get size from a render object that has not been through layout.
2

The size of this render object has not yet been determined because this render object has not yet been through layout, which typically means that the size getter was called too early in the pipeline (e.g., during the build phase) before the framework has determined the size and position of the render objects during layout.

The size getter was called for the following element: CustomPaint-[GlobalKey#c3fdf]
renderObject: RenderCustomPaint#fe468 NEEDS-LAYOUT NEEDS-PAINT
The render object from which the size was to be obtained was: RenderCustomPaint#fe468 NEEDS-LAYOUT NEEDS-PAINT
When the exception was thrown, this was the stack

    Container(
                              decoration: BoxDecoration(
                                  color: Colors.white10,
                                  borderRadius: BorderRadius.circular(3)),
                              width: screenAdapter.getscreenWidth() -
                                  screenAdapter.width(200),
                              height: screenAdapter.height(120),
                              child: Stack(
                                children: [
                                  Positioned(
                                      top: screenAdapter.height(20),
                                      child: LinearPercentIndicator(
                                        width:
                                            screenAdapter.getscreenWidth() -
                                                screenAdapter.width(220),
                                        lineHeight: screenAdapter.width(20),
                                        barRadius: const Radius.circular(4),
                                        percent: ranks.value!,
                                        linearGradient: GradientColor()
                                            .gradientColorsgrren,
                                        backgroundColor:
                                            const Color.fromARGB(
                                                99, 167, 181, 191),
                                      )),
                                  Positioned(
                                      left: (screenAdapter
                                                  .getscreenWidth() -
                                              screenAdapter.width(400)) *
                                          ranks.value,
                                      bottom: screenAdapter.height(15),
                                      child: Text(
                                        '${ranks.rate}',
                                        style: TextStyle(
                                            color: AppColors.subtitleColor,
                                            fontSize:
                                                screenAdapter.fontsize(42)),
                                        textScaleFactor: 1,
                                      ))
                                ],
                              ),
                            )

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions