FlatButton is deprecated and shouldn't be used. Used TextButton instead.
Run Code Online (Sandbox Code Playgroud)
在我以前的FlatButton小部件上,我能够在按下时更改启动颜色。但现在我正在使用TextButton小部件,如何在小部件上MaterialApp ThemeData或直接在TextButton小部件上有效地更改其颜色。
目前这是我的 TextButton
TextButton(
style: TextButton.styleFrom(
primary: Colors.red,
textStyle: TextStyle(
color: Colors.black45,
fontFamily: "Courier Prime",
),
backgroundColor: Colors.transparent,
),
onPressed: () {},
child: Text(
"Student",
style: TextStyle(fontWeight: FontWeight.bold),
),
),
Run Code Online (Sandbox Code Playgroud)
overlayColor is used to indicate that the button is focused, hovered, or pressed.
Run Code Online (Sandbox Code Playgroud)
但我找不到这个overlayColor
我是 Flutter 新手。我需要有关 DataCell 中 OnTap 的帮助。例如,我想要的是行,而不是点击一个单元格。
这是我的代码
DataTable(
columns: <DataColumn>[
DataColumn(
label: Text("Title"),
),
DataColumn(
label: Text("Contacts"),
),
)
],
rows: contracts.map((contract) => DataRow(
cells: [
DataCell(Text(contract.title),
onTap: () {
Navigator.push(context, MaterialPageRoute(
builder: (context) => List(),),
);
}),
DataCell(Text(contract.contacts),
onTap: () {
Navigator.push(context, MaterialPageRoute(
builder: (context) => List(),),
);
}),).toList()
Run Code Online (Sandbox Code Playgroud)
我想单击特定行,它将路由到另一个页面并发送它的索引值。
我刚开始使用 FIrebase
随着重大更新,FlutterFire 添加了新方法
NEW: Added support for applyActionCode().
NEW: Added support for checkActionCode().
NEW: Added support for verifyPasswordResetCode().
Run Code Online (Sandbox Code Playgroud)
和文档https://firebase.flutter.dev/docs/auth/usage/
User user = FirebaseAuth.instance.currentUser;
if (!user.emailVerified) {
await user.sendEmailVerification();
}
//Firebase will send an automated email to the user with a unique code.
//This code can then be entered via the applyActionCode() method.
//You can first check whether the code is valid by using the checkActionCode() method:
Run Code Online (Sandbox Code Playgroud)
等待 user.sendEmailVerification(); 这只会向用户电子邮件发送验证链接以进行验证。不是验证码。
我应该怎么做才能通过电子邮件接收该代码?所以我可以使用verifyPasswordResetCode()方法。. 谢谢
我正在研究 Flutter 响应式 Web UI。我想在移动和桌面屏幕宽度的特定屏幕宽度上关闭打开的抽屉,所以如果我拉伸浏览器,抽屉应该关闭。
比如我打开抽屉(屏幕宽度小于500)
而当屏幕宽度大于 500 时,我希望打开的抽屉自动关闭。
注意:当抽屉打开时。我已经有一个代码来检查是否显示按钮菜单抽屉的屏幕宽度。但基本上,当用户打开抽屉然后突然拉伸浏览器时,抽屉应该关闭。
代码如下。谢谢您的帮助
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size.width;
return Scaffold(
drawer: Drawer(),
body: CustomNavBar(screenSize: size),
);
}
}
class CustomNavBar extends StatefulWidget {
final double screenSize;
const CustomNavBar({Key key, this.screenSize}) : super(key: key);
@override
_CustomNavBarState createState() => _CustomNavBarState();
}
class _CustomNavBarState extends State<CustomNavBar> {
@override
Widget build(BuildContext context) {
if (Scaffold.of(context).isDrawerOpen && widget.screenSize > 500) {
print("Drawer is Opened");
Scaffold.of(context).openEndDrawer(); //animation …Run Code Online (Sandbox Code Playgroud) 嗨,我在 Flutter web 上工作,当我将鼠标悬停在flatbutton 上时,我想更改文本颜色。它在悬停而不是按下。但是我如何检测/知道它被悬停了,所以我可以管理状态颜色。谢谢
FlatButton(
color: Colors.white,
textColor: Colors.teal[700], //when hovered text color change
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5),
side: BorderSide(
color: Colors.teal[700],
),
),
onPressed: () {},
child: Text("Log in"),
),
Run Code Online (Sandbox Code Playgroud) 我正在研究 flutter web。
我有两个屏幕,当我导航到第二个屏幕时,默认动画从底部开始,然后覆盖第一个屏幕。
我希望当我单击导航按钮时它从左向右滑动。
我已经在移动设备上看到了屏幕滑块,但这不是我想要的。
很正常。我看到有人这样做,但我找不到
谢谢