flutter_percent_indicator icon indicating copy to clipboard operation
flutter_percent_indicator copied to clipboard

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

Open kangtian opened this issue 1 year ago • 1 comments

════════ 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,
                                      ))
                                ],
                              ),
                            )

kangtian avatar Jun 13 '24 06:06 kangtian

I don't know why an error occurred

kangtian avatar Jun 13 '24 06:06 kangtian