Flutter 双嵌套UI布局导致空调用时堆栈溢出()

Flutter 双嵌套UI布局导致空调用时堆栈溢出(),flutter,flutter-layout,Flutter,Flutter Layout,我的应用程序使用层次化的UI设计和扩展设计来实现正确的布局(当然) 我的一个层次结构是一个简单的3层方法: HomePage (content) -> UiBaseMain (structure for content) -> UiBase (scaffolding) 详细信息:(和一个MVCE)-我已经尝试缩

我的应用程序使用层次化的UI设计和扩展设计来实现正确的布局(当然)

我的一个层次结构是一个简单的3层方法:

HomePage (content) -> 
                       UiBaseMain (structure for content) -> 
                                                             UiBase (scaffolding)

详细信息:(和一个MVCE)-我已经尝试缩小到最简单的形式,以便反复抛出此错误

在物理设备和AVD上测试,都会出现堆栈溢出错误

UiBase(ui\u component\u base.dart)(所有布局都基于此)

UiBaseMain(ui\u main\u navbar\u appbar.dart)(其中,所有主要ui内容都显示在仪表板、设置等上,理想情况下,仪表板、设置等也包含一个小徽标在顶部、底部导航栏等上)


问题


这是我这边的问题,还是其他人可以确认并影响颤振框架中的bug的问题?

您必须在这里传递
widget。widget
,因为它是一个有状态的小部件,否:返回UiBase( widget:widget, ); 对不起,不方便从电话里写信

import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

class UiBase extends StatelessWidget {
  final Widget widget;

  const UiBase({Key key, this.widget})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
          padding: const EdgeInsets.only(left: 8.0, right: 8.0),
          width: double.infinity,
          child: widget),
    );
  }
}
import 'package:mytestapp/ui/design/ui_component_base.dart';
import 'package:flutter/widgets.dart';

class UiBaseMain extends StatefulWidget {
  final Widget widget;

  const UiBaseMain({Key key, this.widget}) : super(key: key);

  @override
  _UiBaseMain createState() => _UiBaseMain();
}

class _UiBaseMain extends State<UiBaseMain> {

  @override
  Widget build(BuildContext context) {

    return UiBase(
      widget: widget,
    );
  }
}
import 'package:mytestapp/ui/design/ui_main_navbar_appbar.dart';
import 'package:flutter/widgets.dart';

class HomePage extends StatefulWidget {
  const HomePage({Key key}) : super(key: key);

  @override
  _HomePage createState() => _HomePage();
}

class _HomePage extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return UiBaseMain(
      widget: Text("test"),
    );
  }
}
======== Exception caught by widgets library =======================================================
The following StackOverflowError was thrown building Material(type: canvas, color: Color(0xfffafafa), dependencies: [_InheritedTheme, _LocalizationsScope-[GlobalKey#1c4c4], _EffectiveTickerMode], state: _MaterialState#b2ccd):
Stack Overflow

The relevant error-causing widget was: 
  Scaffold file:///C:/Users/CybeX/mytestapp/mytestapp-mobile-flutter/lib/ui/design/ui_component_base.dart:14:12
When the exception was thrown, this was the stack: 
#0      _WordWrapParseMode.values (package:flutter/src/foundation/diagnostics.dart:776:6)
#1      _SyncIterator.moveNext (dart:core-patch/core_patch.dart:165:25)
#2      Iterable.length (dart:core/iterable.dart:429:15)
#3      _PrefixedStringBuilder._finalizeLine (package:flutter/src/foundation/diagnostics.dart:856:30)
#4      _PrefixedStringBuilder.write (package:flutter/src/foundation/diagnostics.dart:973:9)
...
====================================================================================================

======== Exception caught by widgets library =======================================================
The method 'call' was called on null.
Receiver: null
Tried calling: call()
The relevant error-causing widget was: 
  Scaffold file:///C:/Users/CybeX/mytestapp/mytestapp-mobile-flutter/lib/ui/design/ui_component_base.dart:14:12
====================================================================================================

======== Exception caught by widgets library =======================================================
The method 'call' was called on null.
Receiver: null
Tried calling: call()
The relevant error-causing widget was: 
  Scaffold file:///C:/Users/CybeX/mytestapp/mytestapp-mobile-flutter/lib/ui/design/ui_component_base.dart:14:12
====================================================================================================