我有点困惑,我最近一直在研究flutter的状态管理,我想知道如果将自定义有状态小部件放置在无状态小部件中会发生什么,假设 widgetA (父级)是无状态小部件并且它有一个子 WidgetB这是一个有状态的小部件,另一个子 WidgetC 是一个无状态的小部件。
现在我的问题是:
如果您有可以帮助我理解的外部链接或资源,请提供
我正在尝试处理一个我刚刚开始的项目,在编辑应用程序时,我意识到即使我多次更改了设计,热重载和热重启都不起作用。我唯一会在屏幕上看到变化的时间是卸载应用程序并再次运行时,
我正在模拟器上测试该应用程序,并且正在使用 Android Studio。
我在输入这个问题之前搜索了一个解决方案,这就是我尝试过的:
它曾经工作得很好,现在不是了,这是一个例子:
import 'package:gradient_app_bar/gradient_app_bar.dart';
import '../constants.dart';
class PlantScreen extends StatefulWidget {
@override
_PlantScreenState createState() => _PlantScreenState();
}
class _PlantScreenState extends State<PlantScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: GradientAppBar(
centerTitle: true,
title: Text('plant A'),
gradient: LinearGradient(
colors: Constants.primaryGradient,
begin: Alignment.topLeft,
end: Alignment.bottomRight),
),
body: Container(
constraints: BoxConstraints.expand(),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: Constants.primaryVariantGradient,
begin: Alignment.topLeft,
end: Alignment.bottomRight),
),
child: Column(
children: <Widget>[
Card( …Run Code Online (Sandbox Code Playgroud)