Steps to reproduce
- Run the following app in windows desktop:
- Minimize the APP Window,will trigger an assert below:
════════ Exception caught by rendering library ═════════════════════════════════════════════════════
The following assertion was thrown during paint():
'package:flutter/src/material/slider_theme.dart': Failed assertion: line 1456 pos 12: 'parentBox.size.width >= overlayWidth': is not true.
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=BUG.md
The relevant error-causing widget was:
Slider file:///D:/My%%20Documents/Desktop/flutter_app_demo/lib/main.dart:37:18
When the exception was thrown, this was the stack:
#2 BaseSliderTrackShape.getPreferredRect (package:flutter/src/material/slider_theme.dart:1456:12)
#3 _RenderSlider.paint (package:flutter/src/material/slider.dart:1377:52)
#4 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2323:7)
#5 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:191:13)
#6 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:133:15)
...
The following RenderObject was being processed when the exception was fired: _RenderSlider#12477
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=0.0, h=0.0)
... size: Size(0.0, 0.0)
RenderObject: _RenderSlider#12477
parentData: <none> (can use size)
constraints: BoxConstraints(w=0.0, h=0.0)
size: Size(0.0, 0.0)
════════════════════════════════════════════════════════════════════════════════════════════════════
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
double value = 0.5;
_onChange(newValue) {
setState(() {
print('$newValue');
value = newValue;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: RepaintBoundary(
child: Slider(
value: value,
onChanged: _onChange,
),
),
),
));
}
}
@clocksmith Hi, I have post a PR to fix this issue, please review, thank you.