小编ujj*_*ali的帖子

重建父级时调用子级 init 方法 - flutter

据我了解和颤振的工作机制,有状态的小部件方法仅在小部件树中第一次构建时被调用一次,并且每次其状态更改或父级重建时都会调用构建方法方法。

 bottomNavigationBar: BottomNavigationBar(items: [
      BottomNavigationBarItem(icon: new Icon(Icons.home,), title: new Text("HOME", style: new TextStyle(fontSize: 11.0),),),
      BottomNavigationBarItem(icon: new Icon(Icons.message,), title: new Text("MESSAGES", style: new TextStyle(fontSize: 11.0),),),
      BottomNavigationBarItem(icon: new Icon(Icons.notifications,), title: new Text("NOTIFICATIONS", style: new TextStyle(fontSize: 11.0),),),
      BottomNavigationBarItem(icon: new Icon(Icons.assignment,), title: new Text("MENTOR", style: new TextStyle(fontSize: 11.0),),),
      BottomNavigationBarItem(icon: new Icon(Icons.account_circle,), title: new Text("PROFILE", style: new TextStyle(fontSize: 11.0),),),
    ],
      onTap: (int index){
        setState(() {
          _currentActiveIndex = index;
        });
      },
      currentIndex: _currentActiveIndex,
      type: BottomNavigationBarType.shifting,
    ),
    body: _getCurrentPage(_currentActiveIndex),
Run Code Online (Sandbox Code Playgroud)

这里的 _currentActiveIndex 是类的状态之一,其中根据 _currentActiveIndex 的值呈现单独的主体小部件。

 body: TabBarView(children: <Widget>[ …
Run Code Online (Sandbox Code Playgroud)

dart hybrid-mobile-app flutter

5
推荐指数
1
解决办法
1402
查看次数

用Flutter登录Facebook

Future<FirebaseUser> login({List<String> userData, var loginCallback, var cancelledCallback,
        var errorCallback}) async {
    var facebookLogin = FacebookLogin();
    var facebookLoginResult = await facebookLogin.logInWithReadPermissions(['email']);
    switch (facebookLoginResult.status) {
      case FacebookLoginStatus.error:
        print("Error");
        break;
      case FacebookLoginStatus.cancelledByUser:
        print("CancelledByUser");
        break;
      case FacebookLoginStatus.loggedIn:
        print("LoggedIn");
        break;
    }
  }
Run Code Online (Sandbox Code Playgroud)

使用flutter_facebook_login插件,它总是抛出此错误。无法弄清楚我要去哪里。这是错误的日志记录。

MissingPluginException(No implementation found for method loginWithReadPermissions on channel com.roughike/flutter_facebook_login)
E/flutter ( 6174): #0      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:278:7)
E/flutter ( 6174): <asynchronous suspension>
E/flutter ( 6174): #1      FacebookLogin.logInWithReadPermissions (package:flutter_facebook_login/flutter_facebook_login.dart:101:23)
E/flutter ( 6174): <asynchronous suspension>
E/flutter ( 6174): #2      FacebookAuth.login (package:shout_out/util/social_login.dart:26:25)
Run Code Online (Sandbox Code Playgroud)

facebook hybrid dart flutter

4
推荐指数
1
解决办法
1677
查看次数

如何在Firestore中的现有阵列中添加或删除项目?

Firestore最近添加了新的新方法FieldValue.arrayUnion(value)和FieldValue.arrayRemove(value),但我在flutter cloud_firestore包中找不到实现。有什么办法可以达到这个结果?

Firestore addUpdate:https ://firebase.google.com/docs/firestore/manage-data/add-data#update_elements_in_an_array

dart flutter google-cloud-firestore

2
推荐指数
2
解决办法
2499
查看次数