我在 bootstrap Dropdowns 中包含了一个用于 React 的下拉按钮,但它不起作用并显示为普通按钮。你能给我一个解决方案吗?
<div className="dropdown">
<button className="btn btn-secondary
dropdown-toggle"
type="button"
id="dropdownMenuButton"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false">
Dropdown button
</button>
<div className="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a className="dropdown-item" href="#">Action</a>
<a className="dropdown-item" href="#">Another action</a>
<a className="dropdown-item" href="#">Something else here</a>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我正在开发一个纸牌游戏,它包括 2 个部分。
在 InputPage() 中,用户选择卡片,它有一个新的游戏按钮。但如果他/她不喜欢这些卡片,他/她可以重新开始游戏。InputPage() 中有一个重启游戏按钮,当用户点击它时,页面必须完全重启。我用 Navigator.of 方法做到了这一点。但是当用户转到 GamePage() 时,我收到了这样的错误:
Unhandled Exception: setState() called after dispose(): _GamePageState#d4518(lifecycle state: defunct, not mounted)
This error happens if you call setState() on a State object for a widget that no longer appears in the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error can occur when code calls setState() from a timer or an animation callback.
The preferred solution is to cancel the …Run Code Online (Sandbox Code Playgroud) 我正在为 android 设备从 flutter 设计一个聊天应用程序,但是当我添加一个用于 firebase 身份验证的插件时,它给出了以下异常。我正在接受你的回答。先感谢您!
Flutter: MissingPluginException(No implementation found for method createUserWithEmailAndPassword on channel plugins.flutter.io/firebase_auth)
这是注册屏幕中的代码
class _RegistrationScreenState extends State<RegistrationScreen> {
final _auth = FirebaseAuth.instance;
String email;
String password;
.
.
.
onPressed: () async{
try {
final newUser = await _auth.createUserWithEmailAndPassword(
email: email, password: password);
if(newUser!=null){
Navigator.pushNamed(context, ChatScreen.id);
}
}catch(e){
print(e);
}
},
Run Code Online (Sandbox Code Playgroud)
这是聊天屏幕中的代码
class _ChatScreenState extends State<ChatScreen> {
final _auth = FirebaseAuth.instance;
FirebaseUser loggedInUser;
@override
void initState(){
super.initState();
getCurrentUser();
}
void getCurrentUser() async{
try {
final …Run Code Online (Sandbox Code Playgroud)