当前位置:网站首页>Detailed usage configuration of the shutter textbutton, overview of the shutter buttonstyle style and Practice
Detailed usage configuration of the shutter textbutton, overview of the shutter buttonstyle style and Practice
2022-06-28 05:26:00 【Young people who get up early】
.
—— Holding a sword in the end of the world , Start with your little accumulation , Where to go , We must keep improving , Beautiful application experience From the processing of details , More from the self-demand and efforts of farmers
Flutter It's Google's latest mobile development framework .
【x1】 Daily reminder of WeChat official account At any time Accumulate... Every day I can't help it Scan the code at the bottom of the article to pay attention to
【x2】 Various series of video tutorials Free and open source Focus on You don't get lost
【x3】 Series articles One million Demo At any time Copy and paste Use
【x4】 Source code at a glance
【x5】 A short video is a different experience
TextButton yes 1.20.0 Launched a new button , The basic use code is as follows :
TextButton(
onPressed: () {},
child: Text("TextButton Button "),
)
- 1.
- 2.
- 3.
- 4.
Then run the effect as follows :

This effect looks more comfortable , There is a sticky effect of ripple transition .
modify TextButton The style of Need to pass through ButtonStyle To modify the , Described below :
// This is a text button The style under click event is not set
Widget buildTextButton2() {
return TextButton(
child: Text("TextButton Button "),
// Add a click event
onPressed: () {},
// Set whether the button automatically gets focus
autofocus: true,
// Define the text style
style: ButtonStyle(
// Defines the style of the text The color set here doesn't work
textStyle: MaterialStateProperty.all(
TextStyle(fontSize: 18, color: Colors.red)),
// Set the color of the font and icon on the button
//foregroundColor: MaterialStateProperty.all(Colors.deepPurple),
// A more elegant way to set
foregroundColor: MaterialStateProperty.resolveWith(
(states) {
if (states.contains(MaterialState.focused) &&
!states.contains(MaterialState.pressed)) {
// The color of the focus
return Colors.blue;
} else if (states.contains(MaterialState.pressed)) {
// Color when pressed
return Colors.deepPurple;
}
// The default state is gray
return Colors.grey;
},
),
// The background color
backgroundColor: MaterialStateProperty.resolveWith((states) {
// Set the background color when pressed
if (states.contains(MaterialState.pressed)) {
return Colors.blue[200];
}
// The default is not to use the background color
return null;
}),
// Set the water ripple color
overlayColor: MaterialStateProperty.all(Colors.yellow),
// Set shadow It doesn't apply to TextButton
elevation: MaterialStateProperty.all(0),
// Set the inside margin of the button
padding: MaterialStateProperty.all(EdgeInsets.all(10)),
// Set the size of the button
minimumSize: MaterialStateProperty.all(Size(200, 100)),
// Set borders
side:
MaterialStateProperty.all(BorderSide(color: Colors.grey, width: 1)),
// Outer border decoration Will be covered side Configuration style
shape: MaterialStateProperty.all(StadiumBorder()),
),
);
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.
- 56.
With the character of Xiaobian , To achieve a million Demo Copy and paste at any time is sure to need the source code The complete source code is here
With the character of Xiaobian , There must be a set of videos , Click here for details
have interest in You can focus on Watermelon Video — Young people who get up early
Flutter Cross platform APP Development New version button TextButton Detailed use of

边栏推荐
- How to learn programmable logic controller (PLC)?
- When excel copies the contents of a row, the columns are separated by the tab "\t"
- 双向电平转换电路
- jsp连接oracle实现登录注册(简单)
- Learning Tai Chi Maker - mqtt Chapter II (VI) mqtt wills
- MySQL export database dictionary to excel file
- 基于微信小程序的婚纱影楼门户小程序
- Reactive dye research: lumiprobe af594 NHS ester, 5-isomer
- Amino dye research: lumiprobe fam amine, 6-isomer
- JS 文本框失去焦点修改全半角文字和符号
猜你喜欢
![[JVM series] JVM tuning](/img/e1/086f76ec6c9b56d97430b1e073f5a6.png)
[JVM series] JVM tuning

Carboxylic acid study: lumiprobe sulfoacyanine 7 dicarboxylic acid

CpG solid support research: lumiprobe general CpG type II

What is the difference between AC and DC?

Excel将一行的内容进行复制时,列与列之间是用制表符“\t”进行分隔的

Sqlmap tool user manual

sqlmap工具使用手册

电源插座是如何传输电的?困扰小伙伴这么多年的简单问题

Study on modified triphosphate: lumiprobe amino-11-ddutp

2022 low voltage electrician examination questions and answers
随机推荐
Have you finished the examination of level II cost engineer? There are also qualification regulations!
Camera Basics
关系数据库与文档数据库对比
如何学习可编程逻辑控制器(PLC)?
[Linux] - using xshell to install MySQL on Linux and realize the deployment of webapp
Opencv实现颜色检测
QCOM LCD调试
活性染料研究:Lumiprobe AF594 NHS 酯,5-异构体
The short video local life section has become popular. How to grasp the new opportunities?
程序员-放羊娃
Lumiprobe细胞成像分析:PKH26 细胞膜标记试剂盒
Sharing | intelligent environmental protection - ecological civilization informatization solution (PDF attached)
Amino dye research: lumiprobe fam amine, 6-isomer
gsap的简单用法
氨基染料研究:Lumiprobe FAM 胺,6-异构体
jsp连接oracle实现登录注册(简单)
Learn Taiji Maker - mqtt Chapter 2 (IV) esp8266 reserved message application
Metartc5.0 API programming guide (I)
JS text box loses focus to modify width text and symbols
Operation of 2022 power cable judgment question simulation examination platform