Flutter- TextField keeps saying "Too many positional arguments"
07:42 24 Apr 2022

I am trying to make an app that has a button that whenever you press it, it will pop up a bunch of TextFields to input stuff. However, I keep getting an error

Too many positional arguments - 0 expected but 1 found

For some reason, this only happens to my first TextField and not to any of the others (if I delete the first TextField, the error moves to the new first). I tried putting a semicolon in front of the first TextField and that made that error go away, but then I get a new error of ") expected" and if I put a ), then it auto comments out all my TextFields.

What am I doing wrong? (btw I have the correct imports at the top, just not sure if that is sensitive data so I'm leaving that out of this post)

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

  @override
  State createState() => _AdminScreenState();
}

class _AdminScreenState extends State {

  reloadUser() {
    setState(() {});
  }
  //this section is for adding stuff to database
  String name = "";
  String description = "";
  String dateFound = "";
  String locationFound = "";
  String currentLocation = "";
  String claimed = "";
  bool addDataVisible = false;
  //end of this section

    TextEditingController nameController = TextEditingController();
    TextEditingController descriptionController = TextEditingController();
    TextEditingController dateController = TextEditingController();
    TextEditingController locationController = TextEditingController();
    TextEditingController storedController = TextEditingController();
    TextEditingController claimedController = TextEditingController();

  showWidget(){
    setState(() {
      addDataVisible = true ;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Admin'),
      ),
      body: FirebaseAuth.instance.currentUser == null ? LoginButton(
        updateState: reloadUser,) : //Text('logged in'),
      TextButton(
        child: const Text('Click Here to Add New Item to Database'),
        onPressed: showWidget(),

    style: ButtonStyle(
    backgroundColor: MaterialStateProperty.all(Colors.blue),
    foregroundColor: MaterialStateProperty.all(Colors.white),
    ),
    ),

      //render the new widgets
   TextField(
     decoration: const InputDecoration(
       border: OutlineInputBorder(),
       labelText: 'Name of Item',
     ),
     controller: nameController,
     Visibility(
       visible: addDataVisible,
     ),
     onChanged: (text) {
       setState(() {
         name = text;
       });
     },
    //for description
   );
      TextField(
            controller: descriptionController,
            Visibility(
              visible: addDataVisible,
            ),
            decoration: const InputDecoration(
              border: OutlineInputBorder(),
              labelText: 'Description of Item',
            ),
            onChanged: (text) {
              setState(() {
                description = text;
              });
            },
            //for location found
          );TextField(
            controller: locationController,
            Visibility(
              visible: addDataVisible,
            ),
            decoration: const InputDecoration(
              border: OutlineInputBorder(),
              labelText: 'Location Found of Item',
            ),
            onChanged: (text) {
              setState(() {
                locationFound = text;
              });
            },
            //for current location
          );TextField(
            controller: storedController,
            Visibility(
              visible: addDataVisible,
            ),
            decoration: const InputDecoration(
              border: OutlineInputBorder(),
              labelText: 'Current Location of Item',
            ),
            onChanged: (text) {
              setState(() {
                currentLocation = text;
              });
            },
            //for timestamp
          );TextField(
            controller: dateController,
            Visibility(
              visible: addDataVisible,
            ),
            decoration: const InputDecoration(
              border: OutlineInputBorder(),
              labelText: 'Time Found for Item',
            ),
            onChanged: (text) {
              setState(() {
                dateFound = text;
              });
            },
            //for claimed or not
          );TextField(
            controller: claimedController,
            Visibility(
              visible: addDataVisible,
            ),
            decoration: const InputDecoration(
              border: OutlineInputBorder(),
              labelText: 'Item Been Claimed? (Put T or F please)',
            ),
            onChanged: (text) {
              setState(() {
                claimed = text;
              });
            },

          );TextButton(
            child: const Text('Click Here to Submit'),
            onPressed: _submit,
            style: ButtonStyle(
              backgroundColor: MaterialStateProperty.all(Colors.blue),
              foregroundColor: MaterialStateProperty.all(Colors.white),
            ),
          );
        },

      );
  }
}


_submit(){


}
flutter