0

Error: The argument for the named parameter 'body' was already specified.What we should do when we have two "bodys' in a scaffold in flutter

 Widget build(BuildContext context) {
          return Scaffold(
            appBar: AppBar(
             title: Text(widget.title),
                 ),
               body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.start,
            children: <Widget>[
              Flexible(
                child: gridView(),
              )
            ],
          ),
        ),

        body: SingleChildScrollView(
              child : Container(
               child: Padding(
                padding: const EdgeInsets.all(5),
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    Text(
                      "Enter the Device Details",
                      style: TextStyle(
                        color: Colors.white,
                        fontSize: 30,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
sr2k23
  • 127
  • 1
  • 2
  • 12

1 Answers1

0

Maybe something like this:

 @override
 Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title)),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.start,
            children: <Widget>[
              Flexible(
                child: child: gridView(),
              ),
              Container(
               child: Padding(
                padding: const EdgeInsets.all(5),
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    Text(
                      "Enter the Device Details",
                      style: TextStyle(
                        color: Colors.white,
                        fontSize: 30,
                        fontWeight: FontWeight.bold,
                      )
                    )
                  ]
                )
               )
              ),
            ],
          ),
        )
    );
  }
alecsam
  • 566
  • 3
  • 10
  • Thank you that solved my query ,but My Grid is not shown when I chose gallery image or camera photo child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ Flexible( child: child: gridView(), ), I have used image picker for Gallery and Camera images/photos – sr2k23 Sep 29 '20 at 10:26
  • I do not understand exactly, please post the code and the error – alecsam Sep 29 '20 at 11:02
  • I mean My App show photos from Gallery and Camera in Grid View at the begining, then the list view appaers i.e starts from Container( child: Padding( padding: const EdgeInsets.all(5), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( "Enter the Device Details", style: TextStyle( color: Colors.white, ) etc. – sr2k23 Sep 29 '20 at 12:34
  • My code is much longer is with List View Items with 12 number of items , hence it should be scrollable and flexible. Please help – sr2k23 Sep 29 '20 at 12:35
  • alecsam can I get your contact email id etc so that I can send my code and get a fix from you to my issue. – sr2k23 Sep 29 '20 at 12:44
  • First of all, this seems to be another issue. However, without a clear example, I can't implement your idea from the beginning. Maybe you can simplify your code and explain the error or what you want to achieve. – alecsam Sep 29 '20 at 12:50
  • There is no error now, but only thing needed is I want a scrollable list view under the Gridview Flexible( child: child: gridView(), ), That is in the next Container with Children Widgets which is starting after the gridview. – sr2k23 Sep 29 '20 at 12:55
  • `Expanded(child: Container(child: Padding(padding: const EdgeInsets.all(5), child: ListView(children: [Text("aaa"), Text("bbb"), Text("ccc"), Text("ddd"),],)))),` – alecsam Sep 29 '20 at 13:07
  • Thank you very much alcesam. Thanks for being with me and supporting. It worked very well. Nice support from you. – sr2k23 Sep 29 '20 at 13:27
  • Another Exception whenI try to retieve the text data after submit into sqflite. Another exception was thrown: SliverGeometry is not valid: The "scrollExtent" is negative. ════════ Exception caught by rendering library ═════════════════════════════════════════════════════ The following assertion was thrown during performLayout(): SliverGeometry is not valid: The "scrollExtent" is negative. – sr2k23 Sep 29 '20 at 13:43
  • You should open another issue and add relevant code. – alecsam Sep 30 '20 at 05:54