我正在尝试使用 bloc 模式创建带有 API 数据的列表视图,错误如下:
'package:flutter/src/widgets/framework.dart':断言失败:第 5120 行 pos 12:'child == _child':不正确。
我的列表文件:
import 'package:Instant_Feedback/Dashboard/PeopleList/bloc/bloc.dart';
import 'package:Instant_Feedback/People/strongConnection_model.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class PeopleListing extends StatefulWidget {
@override
State<StatefulWidget> createState() => _PeopleListingState();
}
class _PeopleListingState extends State<PeopleListing> {
PeopleListBloc peopleBloc;
@override
void initState() {
super.initState();
peopleBloc = BlocProvider.of<PeopleListBloc>(context);
peopleBloc.dispatch(DisplayPeopleList());
}
@override
Widget build(BuildContext context) {
return BlocBuilder(
bloc: peopleBloc,
builder: (context, state){
if (state is PeopleUninitializedState) {
print("PeopleUninitializedState");
} else if (state is PeopleFetchingState) {
print("PeopleFetchingState");
} else if (state is …Run Code Online (Sandbox Code Playgroud) 我正在学习Spring boot,遇到了一个问题。我创建了一个费用类,如下所示:
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Data
@Table(name="expense")
public class Expense {
@Id
private Long id;
private Instant expensedate;
private String description;
private String location;
@ManyToOne
private Category category;
@JsonIgnore
@ManyToOne
private User user;
}
Run Code Online (Sandbox Code Playgroud)
现在我正在尝试创建一个控制器来添加/删除费用对象。以下方法用于创建费用对象:
@PostMapping("/expenses")
ResponseEntity<Expense> createExpense(@Valid @RequestBody Expense expense) throws URISyntaxException{
Expense result = expenseRepository.save(expense);
return ResponseEntity.created(new URI("/api/expense" + result.getId())).body(result);
}
Run Code Online (Sandbox Code Playgroud)
但在此方法中我收到以下错误:
Expanse 类型的 getId() 方法未定义
我在登录时在我的应用程序中集成了 CircularProgressIndicator。该指示器根据需要可见,但它用白色覆盖物隐藏了我的登录屏幕。我想让它的背景透明而不是白色。我试图给 CircularProgressIndicator 的背景颜色,但它没有做任何改变。这是我的代码:
child: !_isLoading ? _loginScreen(loginBloc.state) : Center(
child: const SizedBox(
width: 40,
height: 40,
child: CircularProgressIndicator(),
),
)
Run Code Online (Sandbox Code Playgroud)
谢谢你。