我的BottomNavigationBar是全白的。当有3图标时它工作正常,但当增加到 时4,导航栏会变成完全白色。仍然可以选择和更改选项卡。
这是运行小部件时控制台的输出。
ic=null mNaviBarColor -15724014 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
Run Code Online (Sandbox Code Playgroud)
这是导航栏的构建:
_bottomNavChildren[_currentIndex],
bottomNavigationBar: BottomNavigationBar(
onTap: onTabTapped,
currentIndex: _currentIndex,
items: [
BottomNavigationBarItem(
icon: Icon(Icons.search),
title: Text('Browse'),
),
BottomNavigationBarItem(
icon: Icon(Icons.message),
title: Text('Messages'),
),
BottomNavigationBarItem(
icon: Icon(Icons.person_outline),
title: Text('Profile'),
Run Code Online (Sandbox Code Playgroud)
这是List指向相关索引类的小部件。
int _currentIndex = 0;
final List<Widget> _bottomNavChildren = [
BrowsePage(),
MessagesPage(),
ProfilePage(),
];
Run Code Online (Sandbox Code Playgroud)
有人知道问题是什么吗?谢谢
在 Dart 中,如何检索集合文档中自动生成的 ID?
我有一个名为“用户”的集合,其中包含带有用户详细信息的自动 ID 文档。你怎么找回那个ID?
ID eg: yyHYmbDelykMPDWXHJaV
Run Code Online (Sandbox Code Playgroud)
我正在尝试获取此 ID。首次创建文档时,首次创建用户时,将user.uid存储在其集合中。
我可以从users数据库中检索所有我不想要的数据:
void getData() {
databaseReference
.collection('users')
.getDocuments()
.then((QuerySnapshot snapshot) {
snapshot.documents.forEach((f) => print('${f.data}'));
});
}
Run Code Online (Sandbox Code Playgroud)
我可以获得当前用户的 user.uid 的未来参考,但这仍然没有给我唯一的文档 ID。
Future<DocumentReference> getUserDoc() async {
final FirebaseAuth _auth = FirebaseAuth.instance;
final Firestore _firestore = Firestore.instance;
FirebaseUser user = await _auth.currentUser();
DocumentReference ref =
_firestore.collection('users').document(user.uid);
print(ref);
return ref;
}
Run Code Online (Sandbox Code Playgroud)
是否可以针对数据库用户搜索 user.uid 并以这种方式检索 ID?
我有一个基本的登录页面,其中包含一个“电子邮件”、“密码”和一个“SwitchListTile”(开关),用户可以选择这些页面来确认阅读法律文件。在“登录”时,我希望显示“文本”。默认是不可见的。
我使用“可见性”类实现了文本的可见性。现在我想使用“if-else”检查使其可见。
SwitchListTile(
value: _acceptTerms,
onChanged: (bool value) {
setState(() {
_acceptTerms = value;
});
},
title: Text('Accept T&Cs'),
),
SizedBox(height: 5.0),
Visibility(
visible: false,
child: Text(
'Please accept Terms & Conditions!',
style: TextStyle(color: Colors.red),
)),
SizedBox(
height: 10.0,
),
RaisedButton(
color: Theme.of(context).primaryColor,
textColor: Colors.white,
child: Text('LOGIN'),
onPressed: () {
print(_emailValue);
print(_passwordValue);
if(_acceptTerms) {
Navigator.pushReplacementNamed(context, '/products');
} else {
//code to make invisible text visible
}
},
),
Run Code Online (Sandbox Code Playgroud)
我还是 Flutter 和 Dart 开发的新手。谢谢。
我有两个用于注册表单的单选按钮,我希望它们水平相邻,我已经使用了,Row但是随附的文本不会选择单选按钮,只有选择单选按钮本身才能执行此操作...
我知道 RadioListTile 允许使用单选按钮和标签,但据我所知它只能垂直定位。将其包裹Text在 InkWell 中可能可行,但我不确定如何保存状态。
Row(
children: <Widget>[
Row(
children: <Widget>[
Radio(
value: 0,
groupValue: _radioGroupValue,
activeColor: Colors.white,
onChanged: (int value) {
changeRadioSelection(value);
}),
Text(
'Client',
style: TextStyle(color: Colors.white, fontSize: 15.0),
)
],
),
SizedBox(
width: 20.0,
),
Row(
children: <Widget>[
Radio(
value: 1,
groupValue: _radioGroupValue,
onChanged: (int value) {
changeRadioSelection(value);
},
activeColor: Colors.white,
),
Text(
'Customer',
style: TextStyle(color: Colors.white, fontSize: 15.0),
)
],
)
],
),
Run Code Online (Sandbox Code Playgroud)
状态控制方法:
void changeRadioSelection(int value) {
setState(() {
_radioGroupValue …Run Code Online (Sandbox Code Playgroud) 使用FirebaseAuth和FirebaseUser创建用户登录方法时,Android Studio中出现错误。主要是告诉我将FirebaseUser强制转换或更改为AuthResult,这两者均导致无法创建Firebase用户,从而导致在通道plugins.flutter.io/firebase_auth上找不到方法createUserWithEmailAndPassword的实现。
我尝试了Android Studio的响应,但没有运气。最好的解决方法是还原到较早的FirebaseAuth版本。我当前正在使用版本:firebase_auth:^ 0.14.0。
FirebaseUser user = await FirebaseAuth.instance.signInWithEmailAndPassword(email: _email, password: _password);
我error: A value of type 'AuthResult' can't be assigned to a variable of type 'FirebaseUser'.在使用上面的代码时收到。
当我将其更改FirebaseUser为AuthResult或将其强制转换为时as FirebaseUser,会收到消息No implementation found for method createUserWithEmailAndPassword on channel plugins.flutter.io/firebase_auth.,并且不会在Firebase数据库中创建用户。
如何使用最新版本的FirebaseAuth,而不会遇到此错误?
编辑:我已经尝试过与此主题相关的问题/答案,包括使用最新的SDKcompile版本都无济于事。