Flutter学习之-Text & Button
2021-06-09 本文已影响0人
CocoaJason
Text学习
class TextDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
color: Colors.green,
child: Text(
"文本",
maxLines: 1,
overflow: TextOverflow.ellipsis,
textDirection: TextDirection.rtl,
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white),
),
);
}
}
Simulator Screen Shot - iPad Pro (12.9-inch) (5th generation) - 2021-06-09 at 20.59.17.png
Button学习
class ButtonDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
children: [
ElevatedButton(
onPressed: () {},
child: Text('漂浮按钮'),
),
TextButton(
onPressed: () {},
child: Text("漂浮按钮"),
),
TextButton.icon(
label: Text("data"),
onPressed: () {},
icon: Icon(Icons.add),
style: TextButton.styleFrom(backgroundColor: Colors.red)),
OutlinedButton(onPressed: () {}, child: Text("OutlinedButton")),
IconButton(onPressed: () {}, icon: Icon(Icons.home))
],
);
}
}
Simulator Screen Shot - iPad Pro (12.9-inch) (5th generation) - 2021-06-09 at 20.59.29.png