深入理解Widget有状态和无状态
参考https://www.jb51.net/article/263730.htm
无状态
StatelessWidget
class LessComponent extends StatelessWidget { const LessComponent({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Container(); } }
有状态--State
StatefulWidget
class FulComponent extends StatefulWidget { const FulComponent({Key? key}) : super(key: key); @override _FulComponentState createState() => _FulComponentState(); } class _FulComponentState extends State<FulComponent> { @override Widget build(BuildContext context) { return Container(); } }