macosui / macos_ui

Flutter widgets and themes implementing the current macOS design language.
https://macosui.github.io/macos_ui/#/
MIT License
1.82k stars 178 forks source link

MacosListTile RenderFlex overflowed #264

Closed jonsaw closed 2 years ago

jonsaw commented 2 years ago

Description

MacosListTile with long text does not wrap or does not cut off text with an ellipsis. Triggers a RenderFlex overflowed exception instead.

Steps To Reproduce

Code sample ```dart import 'package:flutter/cupertino.dart'; import 'package:macos_ui/macos_ui.dart'; class PropertiesMacosPage extends StatelessWidget { const PropertiesMacosPage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MacosScaffold( toolBar: ToolBar( actions: [ ToolBarIconButton( label: 'Toggle sidebar', icon: const MacosIcon( CupertinoIcons.sidebar_left, ), onPressed: () => MacosWindowScope.of(context).toggleSidebar(), showLabel: false, ), ], title: const Text('Properties'), ), children: [ ResizablePane( minWidth: 180, startWidth: 200, resizableSide: ResizableSide.right, builder: (context, scrollController) => Column(children: const [ MacosListTile( title: Text('This is a long text'), subtitle: Text( 'This is a long subtitle with lots of random text', overflow: TextOverflow.ellipsis, ), ), ]), ), ContentArea( builder: (context, scrollController) => const Center( child: Text('Properties'), ), ), ], ); } } ```

Expected behavior

Expect text to wrap accordingly or cuts off with an ellipsis if TextOverflow is set.

Screenshots

Screenshot 2022-06-20 at 6 54 50 PM

Logs

Logs ``` [ +1 ms] The Flutter DevTools debugger and profiler on macOS is available at: http://127.0.0.1:9103?uri=http://127.0.0.1:58123/znMJ6xK1clo=/ [+1686 ms] ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════ The following assertion was thrown during layout: A RenderFlex overflowed by 48 pixels on the right. The relevant error-causing widget was: Row Row:file:///Users/jonsaw/Code/experiments/macos_ui/lib/src/layout/macos_list_tile.dart:49:16 To inspect this widget in Flutter DevTools, visit: http://127.0.0.1:9103/#/inspector?uri=http%3A%2F%2F127.0.0.1%3A58123%2FznMJ6xK1clo%3D%2F&inspectorRef=inspector-0 The overflowing RenderFlex has an orientation of Axis.horizontal. The edge of the RenderFlex that is overflowing has been marked in the rendering with a yellow and black striped pattern. This is usually caused by the contents being too big for the RenderFlex. Consider applying a flex factor (e.g. using an Expanded widget) to force the children of the RenderFlex to fit within the available space instead of being sized to their natural size. This is considered an error condition because it indicates that there is content that cannot be seen. If the content is legitimately bigger than the available space, consider clipping it with a ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex, like a ListView. The specific RenderFlex in question is: RenderFlex#93062 relayoutBoundary=up12 OVERFLOWING: creator: Row ← MouseRegion ← Listener ← _GestureSemantics ← RawGestureDetector ← GestureDetector ← MacosListTile ← Column ← RepaintBoundary ← CustomPaint-[GlobalKey#d956b] ← MouseRegion ← Listener ← ⋯ parentData: (can use size) constraints: BoxConstraints(0.0<=w<=199.0, 0.0<=h<=Infinity) size: Size(199.0, 28.0) direction: horizontal mainAxisAlignment: start mainAxisSize: max crossAxisAlignment: start textDirection: ltr verticalDirection: down ◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤ ════════════════════════════════════════════════════════════════════════════════════════════════════ ``` ``` [✓] Flutter (Channel master, 3.1.0-0.0.pre.1312, on macOS 12.3.1 21E258 darwin-arm, locale en-MY) • Flutter version 3.1.0-0.0.pre.1312 at /Users/jonsaw/Development/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 4f034a4045 (9 hours ago), 2022-06-19 21:54:10 -0400 • Engine revision 7327d809f9 • Dart version 2.18.0 (build 2.18.0-190.0.dev) • DevTools version 2.14.0 [✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1) • Android SDK at /Users/jonsaw/Library/Android/sdk • Platform android-32, build-tools 32.1.0-rc1 • Java binary at: /Applications/Android Studio Preview.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 13.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 13E113 • CocoaPods version 1.11.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio • Android Studio at /Applications/Android Studio Preview.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 11.0.13+0-b1751.21-8125866) [✓] VS Code (version 1.69.0-insider) • VS Code at /Applications/Visual Studio Code - Insiders.app/Contents • Flutter extension version 3.42.0 [✓] Connected device (2 available) • macOS (desktop) • macos • darwin-arm64 • macOS 12.3.1 21E258 darwin-arm • Chrome (web) • chrome • web-javascript • Google Chrome 102.0.5005.115 [✓] HTTP Host Availability • All required HTTP hosts are available • No issues found! ```