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

ProgressBar throws error when the parent is too small #969

Open
Wii42 opened this issue Nov 17, 2023 · 2 comments
Open

ProgressBar throws error when the parent is too small #969

Wii42 opened this issue Nov 17, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@Wii42
Copy link

Wii42 commented Nov 17, 2023

When the ProgressBarWidget is used, bot no value is specified (so the loading animation is shown), i get the following error with fluent_ui 4.7.7. Because of the error the progress bar is not displayed. Using fluent 4.7.6 or specifying a value in 4.7.7 seems to work fine with no error thrown.

Dart: 3.1.5
Flutter: 3.13.9

======== Exception caught by rendering library =====================================================
The following assertion was thrown during paint():
'package:flutter/src/foundation/math.dart': Failed assertion: line 12 pos 10: 'min <= max && !max.isNaN && !min.isNaN': is not true.

The relevant error-causing widget was: 
  ProgressBar ProgressBar:file:[...]
When the exception was thrown, this was the stack: 
2      clampDouble (package:flutter/src/foundation/math.dart:12:10)
3      OffsetExtension.clamp (package:fluent_ui/src/utils.dart:163:7)
4      _ProgressBarPainter.paint.drawLine (package:fluent_ui/src/controls/surfaces/progress_indicators.dart:183:17)
5      _ProgressBarPainter.paint (package:fluent_ui/src/controls/surfaces/progress_indicators.dart:199:5)
6      RenderCustomPaint._paintWithPainter (package:flutter/src/rendering/custom_paint.dart:573:13)
7      RenderCustomPaint.paint (package:flutter/src/rendering/custom_paint.dart:615:7)
8      RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7)
9      PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13)
10     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13)
11     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7)
12     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13)
13     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13)
14     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7)
15     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13)
16     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13)
17     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7)
18     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13)
19     _RenderLayoutBuilder.paint (package:flutter/src/widgets/layout_builder.dart:338:15)
20     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7)
21     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13)
22     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:2875:15)
23     RenderFlex.paint (package:flutter/src/rendering/flex.dart:1040:7)
24     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7)
25     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13)
26     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13)
27     RenderTransform.paint (package:flutter/src/rendering/proxy_box.dart:2555:17)
28     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7)
29     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13)
30     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13)
31     RenderAnimatedOpacityMixin.paint (package:flutter/src/rendering/proxy_box.dart:1060:11)
32     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7)
33     PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:168:11)
34     PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:111:5)
35     PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:1144:31)
36     RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:496:19)
37     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:918:13)
38     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:360:5)
39     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1297:15)
40     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1227:9)
41     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1085:5)
42     _invoke (dart:ui/hooks.dart:170:13)
43     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:401:5)
44     _drawFrame (dart:ui/hooks.dart:140:31)
(elided 2 frames from class _AssertionError)
The following RenderObject was being processed when the exception was fired: RenderCustomPaint#14dfb
...  parentData: <none> (can use size)
...  constraints: BoxConstraints(w=945.6, h=0.0)
...  size: Size(945.6, 0.0)
...  painter: _ProgressBarPainter#8b3d1()
RenderObject: RenderCustomPaint#14dfb
  parentData: <none> (can use size)
  constraints: BoxConstraints(w=945.6, h=0.0)
  size: Size(945.6, 0.0)
  painter: _ProgressBarPainter#8b3d1()
@bdlukaa
Copy link
Owner

bdlukaa commented Nov 25, 2023

Sorry, but I can not reproduce this issue on the example app. Can you try it there? Is there any reproducible snippet I can try? Are you trying on Flutter Web?

@Wii42
Copy link
Author

Wii42 commented Nov 28, 2023

It seems like i missidentified the situation where the bug happens a bit.
It only seems to occur when the ProgressBar is placed within a SizedBox with height between 0 and 2, when this SizedBox is then placed in a Column, as shown in the code snippet below.

This minimal app runs fine on fluent_ui 4.7.6 but it throws the above mentioned error when using fluent_ui 4.7.7 or later.

import 'package:fluent_ui/fluent_ui.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return const FluentApp(
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return const NavigationView(
      content: Column(
        children: [
          SizedBox(
            height: 2,
            child: ProgressBar(),
          ),
        ],
      ),
    );
  }
}

If value in ProgressBar is specified or not seems to make no difference, contrary to my initial comment.

I hope this helps:)

@bdlukaa bdlukaa added the bug Something isn't working label Dec 14, 2023
@bdlukaa bdlukaa changed the title Error when using ProgressBar with no value specified ProgressBar throws error when the parent is too small Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

2 participants