当前位置:网站首页>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
边栏推荐
- [JVM] - Division de la mémoire en JVM
- 指定默认参数值 仍报错:error: the following arguments are required:
- Study on modified triphosphate: lumiprobe amino-11-ddutp
- The latest examination questions and answers for the eight members (standard members) of Liaoning architecture in 2022
- Have you finished the examination of level II cost engineer? There are also qualification regulations!
- How to do a good job of gateway high availability protection in the big promotion scenario
- Extjs图书管理系统源码 智能化图书管理系统源码
- Can wechat applets import the data in the cloud development database into makers with one click in the map component
- Is it enough for the project manager to finish the PMP? no, it isn't!
- 项目经理考完PMP就够了?不是的!
猜你喜欢
羧酸研究:Lumiprobe 磺基花青7二羧酸
开关电源电压型与电流型控制
JS中的链表(含leetcode例题)<持续更新~>
MySQL export database dictionary to excel file
2022 high altitude installation, maintenance and removal examination questions and answers
IP datagram sending and forwarding process
Sharing | intelligent environmental protection - ecological civilization informatization solution (PDF attached)
[untitled] drv8825 stepping motor drive board schematic diagram
When excel copies the contents of a row, the columns are separated by the tab "\t"
What is the difference between AC and DC?
随机推荐
北斗三号短报文终端在大坝安全监测方案的应用
Learn Taiji Maker - mqtt Chapter 2 (IV) esp8266 reserved message application
codeforces每日5题(均1700)
2022 high altitude installation, maintenance and removal examination questions and answers
Learning Tai Chi Maker - mqtt Chapter II (VI) mqtt wills
How high is the gold content of grade II cost engineer certificate? Just look at this
Sharing | intelligent environmental protection - ecological civilization informatization solution (PDF attached)
metaRTC5.0编程之p2p网络穿透(stun)指南
Lumiprobe cell imaging analysis: PKH26 cell membrane labeling kit
sqlmap工具使用手册
DPDK 源码测试时性能下降问题
Concurrent wait/notify description
Operation of 2022 power cable judgment question simulation examination platform
mysql 导出查询结果成 excel 文件
MySQL 45 talk | 05 explain the index in simple terms (Part 2)
Programmer - Shepherd
JS中的链表(含leetcode例题)<持续更新~>
2022 new version NFT source code source code of China meta universe digital collection art trading platform
Leetcode 88: merge two ordered arrays
Disable right-click, keyboard open console events