Text组件
import 'package:flutter/material.dart';
class TextDemo extends StatelessWidget {
const TextDemo({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Text(
"文本内容" * 100,
maxLines: 3,
overflow: TextOverflow.ellipsis,
);
}
}
class TextDemoContainer extends StatelessWidget {
const TextDemoContainer({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
color: Colors.deepOrangeAccent,
child: Text(
"文本内容",
maxLines: 3,
overflow: TextOverflow.ellipsis,
textDirection: TextDirection.ltr,
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 20,
backgroundColor: Colors.green
) ,
),
);
}
}

|