dropDown method Null safety

Column dropDown(
  1. String title,
  2. String dropdownValue,
  3. dynamic array,
  4. BuildContext context,
  5. String message,
  6. dynamic newGamePageState,
  7. Null param6(
    1. String msg
    )
)

Returns a Column. It's a dropdown that contains the array options, a title, a param6 callback function to update the info and a message to show below the dropdown.

Implementation

static Column dropDown(String title, String dropdownValue, array, BuildContext context, String message, newGamePageState, Null Function(String msg) param6){
  switch(title){
    case 'Duration':
      index1 = dropdownValue;
      break;
    case 'Difficulties':
      index2 = dropdownValue;
      break;
    case 'Category':
      index3 = dropdownValue;
      break;
  }
  TextStyle ts = const TextStyle(fontSize: 15, color: Colors.white);
  if(Sizes.getScreenSize(context).width > 400){
    ts = const TextStyle(fontSize: 16, color: Colors.white);
  }
  return Column(
    //mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        SizedBox(
          width: Sizes.getUserInputSize(context).width,
          height: Sizes.getPixelSize(0.03305741296, context),
          child: Text(title, style: Theme.of(context).textTheme.headline4),
        ),
        SizedBox(
          height: Sizes.getPixelSize(0.01756543124, context),
        ),
        SizedBox(
          width: Sizes.getScreenSize(context).width * 0.8,
          //height: Sizes.getScreenSize(context).height * 0.055,
          child: Container(
            decoration: BoxDecoration(
              gradient: LinearGradient(
                  begin: Alignment.centerLeft,
                  end: Alignment.centerRight,
                  colors: CustomColors.userInputColors()
              ),
              borderRadius: const BorderRadius.all(Radius.circular(10.0)),
            ),
            child: Row(
              children: [
                const SizedBox(width: 10),
                Expanded(child: DropdownButtonFormField(
                  dropdownColor: CustomColors.dropdownColor(),
                  value: dropdownValue,
                  alignment: Alignment.centerLeft,
                  decoration: const InputDecoration(border: InputBorder.none),
                  onChanged: (String? newValue) {
                    //setState(() {
                    dropdownValue = newValue!;
                    switch(title){
                      case 'Duration':
                        switch(dropdownValue){
                          case "Fast":
                            index1 = dropdownValue;
                            param6.call("This should take a couple of minutes. To be fair it's a lot of time, don't be ashamed...");
                            break;
                          case "Mid":
                            index1 = dropdownValue;
                            param6.call("5 minutes maximum, it's only 10 questions!");
                            break;
                          case "Large":
                            index1 = dropdownValue;
                            param6.call("I mean it's 20 questions at 20 seconds per question plus 5 seconds per answer: (20 * (20+5))/60 = 8.3 minutes");
                            break;
                          case "Marathon":
                            index1 = dropdownValue;
                            param6.call("Ah yes, 30 questions. Consider touching some grass...");
                            break;
                        }
                        index1 = dropdownValue;
                        break;
                      case 'Difficulties':
                        index2 = dropdownValue;
                        switch(dropdownValue){
                          case "Any":
                            param6.call("You'll get a mix of easy, medium, hard and extreme questions; balanced, as everything should be.");
                            break;
                          case "Easy":
                            param6.call("Only easy questions for the kids of the family!");
                            break;
                          case "Medium":
                            param6.call("Not a real challenge, I hope you won't be able to fail this...");
                            break;
                          case "Hard":
                            param6.call("The challenge begins, with a little luck you might hit one!");
                            break;
                        /*case "Extreme":
                          param6.call("Do you really have what it takes?");
                          break;*/
                        }
                        break;
                      case 'Category':
                        index3 = dropdownValue;
                        switch(dropdownValue){
                          case "Any":
                            param6.call("Questions from all categories, shaken and stirred up.");
                            break;
                          case "GeneralKnowledge":
                            param6.call("A little here and a little there, it can be anything.");
                            break;
                          case "Entertainment":
                            param6.call("If you are one of those who have seen all the episodes of Friends, this is your category!");
                            break;
                          case "Science":
                            param6.call("If you don’t know if the mitochondria is the powerhouse of the cell, change category.");
                            break;
                          case "Sports":
                            param6.call("Remember that as much as you get all the questions right, you will still run out of breath after going up ten stairs.");
                            break;
                          case "Mythology":
                            param6.call("If you think that the Thor character was created by Marvel, you should rethink a lot of things.");
                            break;
                          case "Art":
                            param6.call("\"To play, or not to play, that is the question.\"");
                            break;
                          case "History":
                            param6.call("Are you amazing at remembering dates that nobody cares about events that matter even less?");
                            break;
                        }
                        break;
                    }
                    //});
                  },
                  items: array.map<DropdownMenuItem<String>>((String value) {
                    return DropdownMenuItem<String>(
                        value: value,
                        alignment: Alignment.center,
                        child: Center(child: Text(
                          value,
                          style: ts,
                        ),)
                    );
                  }).toList(),
                )
                ),
              ],
            ),
          ),
        ),
        SizedBox(height: Sizes.getPixelSize(0.01152870648, context)),
        SizedBox(
          width: Sizes.getUserInputSize(context).width,
          height: Sizes.getPixelSize(0.05269629369,context),
          child: Row(
              children: [
                const Image(image: AssetImage('assets/icons/infoIcon.png'), width: 20,height: 20),
                Separators.horizontalSeparator(0.02, context),
                Expanded(child: SizedBox(
                  child: Text(message, style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w400, color: Colors.white)),
                ))
              ]
          ),
        ),
        SizedBox(height: Sizes.getPixelSize(0.02305741296, context))
      ]
  );
}