如何解决未为类型“_CreateEventState”定义方法“FormBuilderDateTimePicker”
我正在尝试将 FormBuilder
用于我的项目以将事件添加到日历,我使用了 ForBuilderTextfield()
和 FormBuilderSwitch()
,但是当我尝试将 FormBuilderDateTimePicker
定义为输入日期我收到以下错误:
未为该类型定义方法“FormBuilderDateTimePicker” '_CreateEventState'
我的 pubsec.yaml
包含以下软件包:
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.0
firebase_core: ^1.0.0
google_sign_in: ^4.5.9
provider: ^4.3.3
firebase_auth: ^1.0.1
flutter_signin_button: ^1.1.0
google_fonts: ^2.0.0
flutter_bloc: ^3.2.0
flutter_secure_storage: ^3.3.5
googleapis: ^1.0.0
googleapis_auth: ^1.1.0
path_provider: ^2.0.1
file_picker: ^3.0.0
url_launcher: ^6.0.2
intl: any
table_calendar: ^2.3.3
firebase_storage: ^8.0.3
flutter_form_builder: any
dependency_overrides:
intl: ^0.17.0-nullsafety.2
flutter_form_builder: ^6.0.0-nullsafety.1
我的 _CreateEventState
课:
class _CreateEventState extends State<CreateEvent> {
final _formKey = GlobalKey<FormBuilderState>();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Add an Event',style: GoogleFonts.openSans(
fontWeight: FontWeight.bold,fontStyle: FontStyle.italic,fontSize: 25,color: AppColors.royalBlue,),backgroundColor: Colors.white,//Change the color of the back button to make it visible to the user.
iconTheme: IconThemeData(
color: AppColors.royalBlue,body: ListView(
padding: const EdgeInsets.all(16.0),children: <Widget>[
FormBuilder(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,crossAxisAlignment: CrossAxisAlignment.start,children: [
//The text above the title field - styling
RichText(
text: TextSpan(
text: 'Event Title',style: TextStyle(
color: AppColors.blue,fontFamily: 'Raleway',fontSize: 18,fontWeight: FontWeight.bold,SizedBox(height: 7.0),FormBuilderTextField(
name: "EventTitle",cursorColor: AppColors.lightBlue,style: TextStyle(
color: AppColors.royalBlue,decoration: InputDecoration(
contentPadding: EdgeInsets.only(
left: 15,bottom: 13,top: 13,right: 13,hintText: 'eg: HR meeting',SizedBox(height: 16.0),FormBuilderSwitch(
name: "PublicEvent",title: RichText(
text: TextSpan(
text: 'Public Event',style: TextStyle(
color: AppColors.blue,fontSize: 16,initialValue: false,controlAffinity: ListTileControlAffinity.leading,decoration: InputDecoration(
border: InputBorder.none,RichText(
text: TextSpan(
text: 'Event Date',style: TextStyle(
color: AppColors.blue,//Add the FormBuilderDateTimePicker here
],]
)
);
}```
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。