I have a minimlaist sample app running on Android with GetX as State Management lib only. There are two screens LandingPage and MainScreen. On going back from MainScreen to LandingPage screen, the controller is not autodisposing as expected. I am using Flutter's Navigation only without wrapping with GetMaterialApp.
我的期望是,在实例化控制器时,控制器公开的值应重置为其初始值。但是,小部件继续显示控制器的最后一个值。
我现在使用的是最新版本的 Flutter 和 GetX:分别为 2.2.3 和 4.3.8
感谢您的帮助。
代码:
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return GetMaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.purple,
),
home: LandingScreen(), …Run Code Online (Sandbox Code Playgroud) 我正在使用 CustomPainter 绘制折线图,其中线条(描边)需要具有不同的颜色,并且填充颜色应该是不同的阴影。我可以绘制图表,但两者的颜色相同。但是,我需要颜色不同。我如何使用 CustomPainter 来做到这一点?
另外,我想知道如何在可能的情况下用不同的颜色而不是单一的颜色绘制一条路径。
感谢您的帮助!
我的应用程序中有一个表单,它足够长,可以超出屏幕,并放入 ListView 中以启用滚动。我的验证器工作正常。虽然如果验证失败的表单字段超出了屏幕,我需要将屏幕滚动到验证失败的表单字段。
我怎样才能做到这一点?