Text
const Text(
'的点点滴滴多多多多多多多多多多多多多多多多多多多多多多多多',
textDirection: TextDirection.ltr,
style: TextStyle(
color: Colors.blue,
fontWeight: FontWeight.w600,
fontStyle: FontStyle.italic,
),
textAlign: TextAlign.right,
overflow: TextOverflow.ellipsis,
maxLines: 2,
)
//富文本
RichText(
text: const TextSpan(
text: ('SDF'),
style: TextStyle(color: Colors.red),
children: [
TextSpan(
text: 'sdf',
style: TextStyle(color: Colors.blue),
),
]),
)
谷歌字体
material ICON
Color
Color.fromRGBO(0, 0, 0, .1) //等价于rgba(0, 0, 0, .1)
Color.fromARGB(900, 900, 200, 0)
Color(0xFF00FF00)
Container
padding(margin)
- EdgeInsets all、fromLTRB()、only()
decoration
- boxDecoration(边框、圆角、渐变、阴影、背景色、背景图片)
alignment
transform
- Matri(平移-translate、旋转-rotate、scale缩放、斜切skew)
border(如果要设置radius,边框样式上下左右必须一样)
border: Border.all(
width: 10.0,
color: Colors.red,
),
class MyWidget extends StatelessWidget {
const MyWidget({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
padding: const EdgeInsets.all(3),
decoration: const BoxDecoration(
border: Border(
top: BorderSide(color: Colors.red, width: 20), //2px solid red
left: BorderSide(color: Colors.red, width: 20), //2px solid red
right: BorderSide(color: Colors.red, width: 20), //2px solid red
bottom: BorderSide(color: Colors.red, width: 20), //2px solid red
),
// borderRadius: BorderRadius.all(
// Radius.circular(40), //border-radius:100% //上面边框必须样式一样,否则失败!!!
// ),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(
20.0), //!!!上面边框必须样式一样,否则失败 // border-radius:20px 0 0 0;
),
), //width:100%
child: const Text('322'),
);
}
}
background
color: Colors.red[100] //background:red
//背景渐变
gradient: const LinearGradient(
colors: [Colors.red, Colors.green],
),
对齐方向
transform
//transform: rotateZ(8deg);
transform: Matrix4.rotationZ(0.1)
//transform: translate(100px, 100px);
transform: Matrix4.translationValues(100, 100, 0)