如何在颤振中使用可扩展?

时间:2020-12-27 15:51:06

标签: flutter dart flutter-layout

我希望在我的应用中具有扩展行为。但是在扩展时,它会引发 RenderOverFlow 错误。

这是我的代码

ExpandableNotifier(
      child: Container(
        height: 400.0,
        width: double.infinity,
        alignment: Alignment.bottomCenter,
        padding: EdgeInsets.all(15.0),
        margin: EdgeInsets.all(8.0),
        decoration: BoxDecoration(
          color: Color(0xFFFFA5A4),
          image: DecorationImage(
            fit: BoxFit.cover,
            image: AssetImage('assets/images/illus.png'),
          ),
          borderRadius: BorderRadius.circular(15.0),
        ),
        child: Align(
          alignment: Alignment.bottomCenter,
          child: ScrollOnExpand(
            child: Container(
              height: 300.0,
              width: double.infinity,
              padding: EdgeInsets.all(10.0),
              margin:
                  EdgeInsets.only(top: 8.0, bottom: 0, left: 8.0, right: 8.0),
              decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(15.0),
                  color: Color(0xFFFFFFFF)),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text(
                        'Text',
                        style: TextStyle(
                          fontSize: 15,
                          color: Color(0xFFFFA5A4),
                        ),
                      ),
                      Row(
                        children: [
                          MoreWidgets();
                        //removed bracktes to make ques cleaner
                  
                  ExpandablePanel(
                    header: Padding(
                      padding: const EdgeInsets.symmetric(
                          horizontal: 0, vertical: 0.0)
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text(
                            "Title",
                            overflow: TextOverflow.ellipsis,
                           
                              //removed bracktes to make ques cleaner
                    collapsed: Padding(
                      padding: const EdgeInsets.all(8.0),
                      child: Text(
                        "Some more text",
                        overflow: TextOverflow.ellipsis,
                        maxLines: 3,
                        
                         //removed bracktes to make ques cleaner
                    expanded: Padding(
                      padding: const EdgeInsets.all(8.0),
                      child: Text(
                        "very big text",
                        overflow: TextOverflow.ellipsis,
                        maxLines: 90,
                        )
                           //removed bracktes to make ques cleaner
                 SomeMoreWidgets();
                     //removed bracktes to make ques cleaner

我尝试将文本包装在 SingleChildScrollView 中,但没有帮助。

我尝试了所有方法,但还是不行。我尝试阅读文档,但没有用。我在其中找不到任何有用的内容。

请帮忙,我被困在这两天了。

0 个答案:

没有答案