如何为调用showLicensePage后出现的进度指示器自定义样式?
自定义showLicensePage圆形进度指示器颜色的实现方法
可以实现,showLicensePage会继承传入context对应的主题配置,只需在调用位置外层嵌套自定义Theme覆盖进度指示器的主题属性即可,修改后的代码如下:
OutlinedButton( onPressed: () { Theme( data: Theme.of(context).copyWith( // 自定义圆形进度指示器颜色 progressIndicatorTheme: const ProgressIndicatorThemeData( color: Colors.green, // 替换为你需要的目标颜色 ), // 如需修改许可证页面其他样式,可在此处补充其他Theme配置项 ), child: Builder( builder: (context) { showLicensePage( context: context, applicationIcon: const MyAppIcon(48), ); return const SizedBox.shrink(); }, ), ); }, child: Text( AppLocalizations.key(context, 'licenses'), ), ),
如果需要全局修改所有页面的进度指示器颜色,直接在项目根MaterialApp的theme参数中配置progressIndicatorTheme即可,无需在调用处单独嵌套Theme。
内容的提问来源于stack exchange,提问作者rozerro
相关产品推荐
相关产品推荐

