得到两个主要错误

getting two major errors

在创建待办事项应用程序时,我卡在了项目的执行过程中

    import 'package:flutter/material.dart';
    import '../database_helper.dart';
    import '../note.dart';
    import 'package:intl/intl.dart';
    class NoteDetail extends StatefulWidget {
      
    
    
      final String appBarTitle;
      final Note note;
    
      NoteDetail(this.note, this.appBarTitle);
       @override
      State<StatefulWidget> createstate(){
        return NoteDetailState(this.note,this.appBarTitle);
      }
    
      
      State<StatefulWidget> createState() {
        
        throw UnimplementedError();
      }
    }
    class NoteDetailState extends State<NoteDetail>{
      static  var _Priorities=['HIGH','LOW'];
      DatabaseHelper helper=DatabaseHelper();
      String appBarTitle;
      Note note;
      NoteDetailState(this.note,this.appBarTitle);
    
      TextEditingController titleController =TextEditingController();
      TextEditingController descriptionController=TextEditingController();
      
       @override
      Widget build(BuildContext context) {
        TextStyle textStyle=Theme.of(context).textTheme.****title****;-this is the error i am getting
    
        titleController.text=note.title;
        descriptionController=note.description as TextEditingController;
        return WillPopScope(  
      onWillPop: ()**{** - here is the another error
        moveToLastScreen();},
      
      
       child: Scaffold(
         appBar: AppBar(
           title: Text(appBarTitle),
           leading: IconButton(
             icon:Icon(Icons.arrow_back),
           onPressed: (){
             moveToLastScreen();
           },
      
      
         ),
       ),
       body: Padding(
                padding: EdgeInsets.all(10.0),
                child: Card(
                  shape: RoundedRectangleBorder(
                    borderRadius: BorderRadius.circular(15.0),
                  ),
                  child: ListView(
                    children: <Widget>[
                      Padding(
                        padding: EdgeInsets.only(top: 15.0, bottom: 5.0),
                        //dropdown menu
                        child: new ListTile(
                          leading: const Icon(Icons.low_priority),
                          title: DropdownButton(
                              items: _Priorities.map((String dropDownStringItem) {
                                return DropdownMenuItem<String>(
                                  value: dropDownStringItem,
                                  child: Text(dropDownStringItem,
                                      style: TextStyle(
                                          fontSize: 20.0,
                                          fontWeight: FontWeight.bold,
                                          color: Colors.red)),
                                );
                              }).toList(),
                              value: getPriorityAsString(note.priority),
                              onChanged: (valueSelectedByUser) {
                                setState(() {
                                  updatePriorityAsInt(valueSelectedByUser);
                                });
                              }),
                        ),
                      ),
                      // Second Element
                      Padding(
                        padding:
                            EdgeInsets.only(top: 15.0, bottom: 15.0, left: 15.0),
                        child: TextField(
                          controller: titleController,
                         style: textStyle,
                          onChanged: (value) {
                            updateTile();
                          },
                          decoration: InputDecoration(
                            labelText: 'Title',
                           labelStyle: textStyle,
                            icon: Icon(Icons.title),
                          ),
                        ),
                      ),
    
                      // Third Element
                      Padding(
                        padding:
                            EdgeInsets.only(top: 15.0, bottom: 15.0, left: 15.0),
                        child: TextField(
                          controller: descriptionController,
                          style: textStyle,
                          onChanged: (value) {
                            updatedescription();
                          },
                          decoration: InputDecoration(
                            labelText: 'Details',
                            icon: Icon(Icons.details),
                          ),
                        ),
                      ),
    
                      // Fourth Element
                      Padding(
                        padding: EdgeInsets.all(15.0),
                        child: Row(
                          children: <Widget>[
                            Expanded(
                              child: RaisedButton(
                                textColor: Colors.white,
                                color: Colors.green,
                                padding: const EdgeInsets.all(8.0),
                                child: Text(
                                  'Save',
                                  textScaleFactor: 1.5,
                                ),
                                onPressed: () {
                                  setState(() {
                                    debugPrint("Save button clicked");
                                    _save();
                                  });
                                },
                              ),
                            ),
                            Container(
                              width: 5.0,
                            ),
                            Expanded(
                              child: RaisedButton(
                                textColor: Colors.white,
                                color: Colors.red,
                                padding: const EdgeInsets.all(8.0),
                                child: Text(
                                  'Delete',
                                  textScaleFactor: 1.5,
                                ),
                                onPressed: () {
                                  setState(() {
                                     _delete();
                                  });
                                },
                              ),
                            ),
                          ],
                        ),
                      ),
                    ],
                  ),
                ),
              ),
       
        ),
        );
      }
    
        void updateTile(){
          note.title=titleController.text;
        }
        void updatedescription(){
          note.description=descriptionController.text;
        }
    
       void moveToLastScreen(){
          Navigator.pop(context,true);
        }
        void _save() async{
          moveToLastScreen();
          
          note.date=DateFormat.yMMMd().format(DateTime.now());
          int result;
          if (note.id !=null) {
            result=await helper.updateNote(note);
          }else{
            result=await helper.insertNote(note);
          }
        
    
        if (note !=0) {
          __showAlertDialog('Status','Note Saved Sucessfully');
        }else{
          __showAlertDialog('status', 'problem solving note');
        }
        }
    
      void __showAlertDialog(String title, String message) {
        AlertDialog alertDialog=AlertDialog(
             title: Text(title),
             content: Text(message),
           );
           showDialog(context: context, builder: (_)=>alertDialog);
        
      }
    
      void updatePriorityAsInt(Object? valueSelectedByUser) {
        var value;
        switch (value) {
                case 'HIGH':
                note.Priority=1;
                  
                  break;
                  case 'LOW':
                note.Priority=2;
                  
                  break;
                
      }
    
      
    }
    
    Future<void> _delete() async {
       moveToLastScreen();
             if (note.id!=null) {
               __showAlertDialog('status', 'first add note');
               return;
             }
             int result= await helper.deleteNote(note.id);
             if (result !=0) {
          __showAlertDialog('Status','Note deleted Sucessfully');
        }else{
          __showAlertDialog('status', '404 error');
        }
           }
    
      getPriorityAsString(int value) {
        String ?priority;
          switch (value) {
            case 1:
              
              priority=_Priorities[0];
              break;
              case 2:
              
              
              priority=_Priorities[1];
              break;
            
          }
          return priority;
      } 
    }

我遇到这样的错误。

请任何人帮助我

Flutter 刚刚更改了主题的名称,例如使用这个修复第一个错误,或者使用 titleMedium/titleBig.

TextStyle textStyle=Theme.of(context).textTheme.titleSmall

通过向最后一个函数添加默认值来修复 2. 错误。 Null-Safety 强制您从函数中 return 一些非 null 的东西,因此要么使函数可为空,要么将行为更改为:

getPriorityAsString(int value) {
  String priority = "";
  switch (value) {
    case 1:
      priority = "";
      break;
    case 2:
      priority = "";
      break;
  }
  return priority;
}