草庐IT

flutter - 文档与集合

我正在为Firestore苦苦挣扎。问题是如何构建数据,而不会陷入计费陷阱/噩梦。我有以下数据结构:schoolcourse1section1page1page2section2page1page2...我假设一门类(class)通常不会超过50个部分。使用集合所以我可以使用一个集合并为每个部分创建一个文档,其中包含每个部分的名称和描述。db.collection("schools").document("school1").collection("courses").document("course1").collection("sections").snapshots()文档结构:

flutter - 文档与集合

我正在为Firestore苦苦挣扎。问题是如何构建数据,而不会陷入计费陷阱/噩梦。我有以下数据结构:schoolcourse1section1page1page2section2page1page2...我假设一门类(class)通常不会超过50个部分。使用集合所以我可以使用一个集合并为每个部分创建一个文档,其中包含每个部分的名称和描述。db.collection("schools").document("school1").collection("courses").document("course1").collection("sections").snapshots()文档结构:

android-studio - 小部件未显示在 Stack 上并且 InkResponse 上没有 Ink 效果

我正在开发我的第一个Flutter应用程序,我遇到了两个问题。-容纳我的Image小部件的Container小部件没有显示在Stack小部件上。点击InkResponse容器时没有Ink效果我尝试重写Container以显示图像,并使用Image.Network作为url而不是Assets,但无济于事。finalappLogo=newContainer(child:newImage(image:newAssetImage('assets/discord.png')),);List_getApps(Listapps){List_appWidgets=[];//makeaGridtileo

android-studio - 小部件未显示在 Stack 上并且 InkResponse 上没有 Ink 效果

我正在开发我的第一个Flutter应用程序,我遇到了两个问题。-容纳我的Image小部件的Container小部件没有显示在Stack小部件上。点击InkResponse容器时没有Ink效果我尝试重写Container以显示图像,并使用Image.Network作为url而不是Assets,但无济于事。finalappLogo=newContainer(child:newImage(image:newAssetImage('assets/discord.png')),);List_getApps(Listapps){List_appWidgets=[];//makeaGridtileo

flutter - 您应该为 ChangeNotifier 使用 "extends"还是 "with"关键字? - flutter

我见过几个使用“extends”和“with”关键字扩展ChangeNotifier的模型示例。我不确定有什么区别。classmyModelextendsChangeNotifier{...}classmyModelwithChangeNotifier{...}这两者有什么区别?我应该使用哪一个? 最佳答案 您可以使用extends(继承)或with(作为mixin)。这两种方法都允许您访问ChangeNotifier中的notifyListeners()方法。继承扩展ChangeNotifier意味着ChangeNotifier是

flutter - 您应该为 ChangeNotifier 使用 "extends"还是 "with"关键字? - flutter

我见过几个使用“extends”和“with”关键字扩展ChangeNotifier的模型示例。我不确定有什么区别。classmyModelextendsChangeNotifier{...}classmyModelwithChangeNotifier{...}这两者有什么区别?我应该使用哪一个? 最佳答案 您可以使用extends(继承)或with(作为mixin)。这两种方法都允许您访问ChangeNotifier中的notifyListeners()方法。继承扩展ChangeNotifier意味着ChangeNotifier是

flutter - 为 Sliver child 设置自定义高度

在下面的代码中我遇到了问题,我正在尝试为Sliverchild的每个child设置自定义高度,我刚刚在Flutter上了解了这个小部件,我想修复它,例如:CustomScrollView(slivers:[SliverFixedExtentList(itemExtent:MediaQuery.of(context).size.height,delegate:SliverChildListDelegate([ConstrainedBox(constraints:BoxConstraints(maxHeight:50.0,minHeight:50.0),child:Text('dddddd

flutter - 为 Sliver child 设置自定义高度

在下面的代码中我遇到了问题,我正在尝试为Sliverchild的每个child设置自定义高度,我刚刚在Flutter上了解了这个小部件,我想修复它,例如:CustomScrollView(slivers:[SliverFixedExtentList(itemExtent:MediaQuery.of(context).size.height,delegate:SliverChildListDelegate([ConstrainedBox(constraints:BoxConstraints(maxHeight:50.0,minHeight:50.0),child:Text('dddddd

flutter - 如何正确实例化 didChangeDependencies 中的 bloc?

我正尝试在我从google的flutterudacity类(class)创建的单位转换应用程序中使用bloc架构。我的问题是实例化我的Bloc。我遵循文档并从上下文以及didChangeDependencies方法中的一些其他属性实例化了我的Bloc。在didChangeDependencies中,我设置了bloc的默认单位。这一直有效,直到我专注于导致小部件树刷新的文本输入字段。发生这种情况时,再次运行didChangeDependencies,将单位设置回默认值。这会阻止我使用默认转换之外的任何转换,因为didChangeDependencies每次调用时都会重置单位。我已经尝试在

flutter - 如何正确实例化 didChangeDependencies 中的 bloc?

我正尝试在我从google的flutterudacity类(class)创建的单位转换应用程序中使用bloc架构。我的问题是实例化我的Bloc。我遵循文档并从上下文以及didChangeDependencies方法中的一些其他属性实例化了我的Bloc。在didChangeDependencies中,我设置了bloc的默认单位。这一直有效,直到我专注于导致小部件树刷新的文本输入字段。发生这种情况时,再次运行didChangeDependencies,将单位设置回默认值。这会阻止我使用默认转换之外的任何转换,因为didChangeDependencies每次调用时都会重置单位。我已经尝试在