如何在一个容器中保存一个段落?

How to hold a paragraph in a container in flutter?

我正在尝试将应用程序用户的简历保存在卡片上。我从 API 读到的简介可以是任意长度。所以我无法添加文本小部件的最大行 属性。所以我做了类似下面的代码。

@override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.all(Sizes.componentSideMargin),
      child: Card(
        elevation: 7,
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(15.0),
        ),
        child: Expanded(
          child: Container(
            padding: const EdgeInsets.all(Sizes.componentSideMargin),
            child: Column(
              mainAxisSize: MainAxisSize.max,
              children: [
                Text("About $name"),
                const SizedBox(
                  height: 12,
                ),
                Expanded(child: Text(bio)),
              ],
            ),
          ),
        ),
      ),
    );
  }

目前,我已将以下文本作为 'bio' 传递。

static const LOREM_IPSUM =
      '''Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent nibh justo, ultrices quis mi. Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime mollitia, molestiae quas vel sint commodi repudiandae consequuntur voluptatum laborum numquam blanditiis harum quisquam eius sed odit fugiat iusto fuga praesentium optio, eaque rerum!''';

但它给了我以下错误。

E/flutter ( 7697): #61     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2466:11)
E/flutter ( 7697): #62     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
E/flutter ( 7697): #63     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2466:11)
E/flutter ( 7697): #64     RenderIgnorePointer.hitTest (package:flutter/src/rendering/proxy_box.dart:3317:31)
E/flutter ( 7697): #65     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
E/flutter ( 7697): #66     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2466:11)
E/flutter ( 7697): #67     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
E/flutter ( 7697): #68     RenderFractionalTranslation.hitTestChildren.<anonymous closure> (package:flutter/src/rendering/proxy_box.dart:2775:22)
E/flutter ( 7697): #69     BoxHitTestResult.addWithPaintOffset (package:flutter/src/rendering/box.dart:785:31)
E/flutter ( 7697): #70     RenderFractionalTranslation.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:2769:19)
E/flutter ( 7697): #71     RenderFractionalTranslation.hitTest (package:flutter/src/rendering/proxy_box.dart:2755:12)
E/flutter ( 7697): #72     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
E/flutter ( 7697): #73     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2466:11)
E/flutter ( 7697): #74     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
E/flutter ( 7697): #75     _RenderFocusTrap.hitTest (package:flutter/src/widgets/routes.dart:2141:19)
E/flutter ( 7697): #76     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
E/flutter ( 7697): #77     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2466:11)
E/flutter ( 7697): #78     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
E/flutter ( 7697): #79     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2466:11)
E/flutter ( 7697): #80     RenderOffstage.hitTest (package:flutter/src/rendering/proxy_box.dart:3436:31)
E/flutter ( 7697): #81     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
E/flutter ( 7697): #82     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2466:11)
E/flutter ( 7697): #83     _RenderTheatre.hitTestChildren.<anonymous closure> (package:flutter/src/widgets/overlay.dart:773:25)
E/flutter ( 7697): #84     BoxHitTestResult.addWithPaintOffset (package:flutter/src/rendering/box.dart:785:31)
E/flutter ( 7697): #85     _RenderTheatre.hitTestChildren (package:flutter/src/widgets/overlay.dart:768:33)
E/flutter ( 7697): #86     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2466:11)
E/flutter ( 7697): #87     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
E/flutter ( 7697): #88     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2466:11)
E/flutter ( 7697): #89     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
E/flutter ( 7697): #90     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2466:11)
E/flutter ( 7697): #91     RenderAbsorbPointer.hitTest (package:flutter/src/rendering/proxy_box.dart:3534:17)
E/flutter ( 7697): #92     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
E/flutter ( 7697): #93     RenderProxyBoxWithHitTestBehavior.hitTest (package:flutter/src/rendering/proxy_box.dart:178:19)
E/flutter ( 7697): #94     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
E/flutter ( 7697): #95     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2466:11)
E/flutter ( 7697): #96     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
E/flutter ( 7697): #97     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2466:11)
E/flutter ( 7697): #98     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
E/flutter ( 7697): #99     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2466:11)
E/flutter ( 7697): #100    RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
E/flutter ( 7697): #101    RenderBox.hitTest (package:flutter/src/rendering/box.dart:2466:11)
E/flutter ( 7697): #102    RenderView.hitTest (package:flutter/src/rendering/view.dart:185:14)
E/flutter ( 7697): #103    RendererBinding.hitTest (package:flutter/src/rendering/binding.dart:531:16)
E/flutter ( 7697): #104    GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:346:7)
E/flutter ( 7697): #105    GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:338:5)
E/flutter ( 7697): #106    GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:296:7)
E/flutter ( 7697): #107    GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:279:7)
E/flutter ( 7697): #108    _rootRunUnary (dart:async/zone.dart:1442:13)
E/flutter ( 7697): #109    _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter ( 7697): #110    _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
E/flutter ( 7697): #111    _invoke1 (dart:ui/hooks.dart:170:10)
E/flutter ( 7697): #112    PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:331:7)
E/flutter ( 7697): #113    _dispatchPointerDataPacket (dart:ui/hooks.dart:94:31)
E/flutter ( 7697): 

请指导我,实际的方法是什么。非常感谢。

试试这个

return  Padding(
      padding: const EdgeInsets.all(10),
      child: Card(
        elevation: 7,
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(15.0),
        ),
        child:  Container(
            padding: const EdgeInsets.all(10),
            child: Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                Text("About $name"),
                const SizedBox(
                  height: 12,
                ),
                 Text(bio)
              ],
            ),
          
        ),
      ),
    );