简体   繁体   中英

The relevant error-causing widget was: Scaffold

dashboardScreen() {
    return Scaffold(
        backgroundColor: Colors.white,
        body: Positioned(child:
        SingleChildScrollView(
          child: Positioned(child: Column(
              //margin: const EdgeInsets.fromLTRB(0, 40, 0, 30),
                children: persons.map((p) {
                  return personDetailCard(p);
                }).toList()
              ),
            ),
          ),
        ),
        );
  }

I'm getting this error how can i solve it?

The following assertion was thrown building AnimatedBuilder(animation: AnimationController#e4385(⏭ 1.000; paused), state: _AnimatedState#3a637): 'package:flutter/src/widgets/framework.dart': Failed assertion: line 4957 pos 16: 'child is: ParentDataElement'. 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=2_bug.md

The relevant error-causing widget was: Scaffold file:///C:/Users/Saffar%20Khan/Documents/GitHub/flutter_app_afs/afs_mobile_flutter/lib/dashboard_Receiver.dart:190:12 When the exception was thrown, this was the stack: #2 ParentDataElement._applyParentData.applyParentDataToChild (package:flutter/src/widgets/framework.dart:4957:16) #3 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14) #4 ParentDataElement._applyParentData.applyParentDataToChild (package:flutter/src/widgets/framework.dart:4958:15) #5 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14) #6 ParentDataElement._applyParentData.applyParentDataToChild (package:flutter/src/widgets/framework.dart:4958:15)

As you're not using Stack , you must remove Positioned widget.

Try this tree:

Scaffold(
  backgroundColor: Colors.white,
  body: SingleChildScrollView(
    child: Column(
      //margin: const EdgeInsets.fromLTRB(0, 40, 0, 30),
      children: persons.map((p) {
        return personDetailCard(p);
      }).toList(),
    ),
  ),
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM