Flutter 在颤振中使环形压缩机指示器的背景透明
我已在登录时将CircularProgressIndicator集成到我的应用程序中。该指示器根据需要可见,但它用白色覆盖层隐藏了我的登录屏幕。我想使其背景透明,而不是白色。我试图给CircularProgressIndicator的背景色,但没有任何改变。这是我的密码:Flutter 在颤振中使环形压缩机指示器的背景透明,flutter,Flutter,我已在登录时将CircularProgressIndicator集成到我的应用程序中。该指示器根据需要可见,但它用白色覆盖层隐藏了我的登录屏幕。我想使其背景透明,而不是白色。我试图给CircularProgressIndicator的背景色,但没有任何改变。这是我的密码: child: !_isLoading ? _loginScreen(loginBloc.state) : Center( child: const SizedBox( width: 40,
child: !_isLoading ? _loginScreen(loginBloc.state) : Center(
child: const SizedBox(
width: 40,
height: 40,
child: CircularProgressIndicator(),
),
)
谢谢。您可以在其子对象上使用不同不透明度的
堆栈
例如
堆栈(
儿童:[
不透明(
不透明度:1,//您可以在加载时减少此值,以提供不同的效果
儿童:吸收点(
吸收:_isLoading,
子项:_loginScreen(loginBloc.state),
),
),
不透明(
不透明度:_isLoading?1.0:0,
子对象:CircularProgressIndicator(),
),
],
);
如果您需要有效的解决方案,我会在中大量使用它,我尝试过这个方法,但吸收指针似乎不起作用,因为我无法单击我的“loginScreen”小部件我交换了它们,这是可行的,但对于加载器,你们会失去一点清晰度。
Stack(
children: <Widget>[
Opacity(
opacity: 1, // You can reduce this when loading to give different effect
child: AbsorbPointer(
absorbing: _isLoading,
child: _loginScreen(loginBloc.state),
),
),
Opacity(
opacity: _isLoading ? 1.0 : 0,
child: CircularProgressIndicator(),
),
],
);