微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ParentDataWidget 的错误使用颤振应用程序

如何解决ParentDataWidget 的错误使用颤振应用程序

我被这个问题困扰了很长时间

in debug console

我不知道怎么解决,请帮忙 它说灵活,而我没有使用灵活的小部件。 我只使用了扩展,即使我删除了扩展的小部件仍然有同样的错误 我还尝试删除除列表视图构建器小部件之外的所有内容,但我仍会收到相同的错误

这是代码

import 'package:Flutter/material.dart';
import 'package:todoy/Colors.dart';
import 'Taskslistview.dart';
import 'TasksListTile.dart';
import 'package:provider/provider.dart';
import 'Helper.dart';

    bool isChekec = false;
    
        class TasksScreen extends StatelessWidget {
          Widget buildsheet(BuildContext context) {
            return SingleChildScrollView(
              child: Column(
                children: [
                  Container(
                    decoration: Boxdecoration(
                      color: Colors.white,),height: 400,child: Padding(
                      padding: EdgeInsets.only(left: 50.0,right: 50),child: Column(
                        crossAxisAlignment: CrossAxisAlignment.stretch,children: [
                          SizedBox(
                            height: 10,Center(
                              child: Text(
                            'Add Task',style: TextStyle(
                                fontSize: 30,color: Provider.of<Helper>(context).choosedcolor),)),TextField(
                            decoration: Inputdecoration(
                                helperStyle: TextStyle(color: Colors.red),helperText: Provider.of<Helper>(context).alreadyexist
                                    ? "this task already exist"
                                    : " "),textAlign: TextAlign.center,onChanged: (value) {
                              if (Provider.of<Helper>(context,listen: false)
                                  .tasknames
                                  .contains(value)) {
                                Provider.of<Helper>(context,listen: false)
                                    .alreadyture();
                              } else {
                                Provider.of<Helper>(context,listen: false)
                                    .alreadyfalse();
                              }
                              Provider.of<Helper>(context,listen: false)
                                  .addtaskname(value);
        
                              Provider.of<Helper>(context,listen: false)
                                  .addtaskname(value);
        
                              print(Provider.of<Helper>(context,listen: false)
                                  .addedtask);
                            },SizedBox(
                            height: 10,Container(
                            height: 50,// ignore: deprecated_member_use
                            child: FlatButton(
                                color: Provider.of<Helper>(context).choosedcolor,onpressed: () {
                                  if (Provider.of<Helper>(context,listen: false)
                                      .alreadyexist) {
                                    print("you cant");
                                  } else if (Provider.of<Helper>(context,listen: false)
                                          .addedtask ==
                                      "") {
                                    print("ffgg");
                                  } else {
                                    Provider.of<Helper>(context,listen: false).addname(
                                        Provider.of<Helper>(context,listen: false)
                                            .addedtask);
                                    Provider.of<Helper>(context,listen: false)
                                        .add(TasksListTile(
                                      isChcked: isChekec,nameofthetask:
                                          Provider.of<Helper>(context,listen: false)
                                              .addedtask,));
                                    Provider.of<Helper>(context,listen: false)
                                        .addedtask = "";
                                    Navigator.pop(context);
                                  }
                                },child: Text(
                                  "ADD",style: TextStyle(color: Colors.white,fontSize: 20),)
                        ],],);
          }
        
          @override
          Widget build(BuildContext context) {
            return MaterialApp(
              home: Scaffold(
                backgroundColor: Provider.of<Helper>(context).choosedcolor,body: Column(
                  crossAxisAlignment: CrossAxisAlignment.stretch,children: [
                    Padding(
                      padding: const EdgeInsets.only(left: 300.0,top: 30,right: 15),child: GestureDetector(
                        onTap: () {
                          Navigator.push(context,MaterialPageRoute(builder: (context) => ColoRSScreen()));
                        },child: CircleAvatar(
                            radius: 35,backgroundColor: Colors.white,child: Icon(
                              Icons.invert_colors,size: 40,color: Provider.of<Helper>(context).choosedcolor,Padding(
                      padding: EdgeInsets.only(left: 40.0,top: 40),child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,children: [
                          Padding(
                            padding: EdgeInsets.only(left: 10.0),child: Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,children: [
                                CircleAvatar(
                                    radius: 35,child: Icon(
                                      Icons.list,Padding(
                                  padding: const EdgeInsets.only(right: 30.0),child: Container(
                                    height: 67,child: FittedBox(
                                      child: FloatingActionButton(
                                        child: Icon(Icons.delete_forever,color: Provider.of<Helper>(context)
                                                .choosedcolor),onpressed: () {
                                          Provider.of<Helper>(context,listen: false)
                                              .remove();
                                        },Padding(
                            padding: EdgeInsets.only(top: 8.0,left: 10,bottom: 10),child: Text(
                              "Todoy",fontSize: 40),textAlign: TextAlign.start,Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,children: [
                              Text(
                                ' ${Provider.of<Helper>(context).tasks.length} Tasks',Padding(
                                padding: const EdgeInsets.only(right: 30.0),child: Container(
                                  height: 70,child: FittedBox(
                                    child: FloatingActionButton(
                                      child: Text(
                                        "+",style: TextStyle(
                                            fontSize: 50,onpressed: () {
                                        showModalBottomSheet(
                                            context: context,builder: buildsheet);
                                      },SizedBox(
                      height: 20,Expanded(
                      child: Container(
                        padding: EdgeInsets.only(left: 20),decoration: Boxdecoration(
                            color: Colors.white,borderRadius: BorderRadius.only(
                                topLeft: Radius.circular(40),topRight: Radius.circular(40))),child: Taskslistview(),);
          }
        }

在任务列表视图中:

class Taskslistview extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    bool isChecked = false;
    return ListView.builder(
      itemCount: Provider.of<Helper>(context).tasks.length,itemBuilder: (context,index) {
        return TasksListTile(
          isChcked: isChecked,nameofthetask:
              Provider.of<Helper>(context,listen: false).tasknames[index],);
      },);
  }
}

请帮助我尝试了一切修复它没有任何效果

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?