简体   繁体   English

Flutter 轻松加载,如何编辑其文字样式(下划线、字体系列、大小)?

[英]Flutter easy loading, how do you edit its text style (underline, font family, size)?

Hi so basically I added an import that which allows user to use "Easyloading".嗨,基本上我添加了一个允许用户使用“Easyloading”的导入。 This is the package ( https://pub.dev/packages/flutter_easyloading )这是 package ( https://pub.dev/packages/flutter_easyloading )

Basically you add style or let default do it.基本上你添加样式或让默认来做。 However, I customized mine:但是,我定制了我的:

EasyLoading.instance
      ..displayDuration = const Duration(milliseconds: 1500)
      ..loadingStyle = EasyLoadingStyle.light
      ..indicatorType = EasyLoadingIndicatorType.wave
      ..maskType = EasyLoadingMaskType.clear
      ..userInteractions = false;

Reason I edited, because I want to have much control as possible when it comes to style, unfortunately editting it or not, I was not able to edit the text as much as I want to.我编辑的原因,因为我希望在样式方面尽可能多地控制,不幸的是,无论是否编辑,我都无法像我想要的那样编辑文本。

EasyLoading.show(status: 'loading...');

When I do this action it displays well, However I wish to edit its Boldness text, underline, and "font family style".当我执行此操作时,它显示得很好,但是我希望编辑它的粗体文本、下划线和“字体系列样式”。

RaisedButton(
              onPressed: () {
                EasyLoading.instance
                  ..displayDuration = const Duration(milliseconds: 2000)
                  ..backgroundColor = Colors.white
                  ..indicatorColor = Colors.black
                  ..maskColor = Colors.black
                  ..userInteractions = false;
                EasyLoading.show(status: 'loading...');
                Navigator.push(this.context,
                    MaterialPageRoute(builder: (context) => RegisterAccount()));
              },
              child: Text("Register"),
            ),

See I studied the plugin and they have not used any kind of styling to the text.看我研究了插件,他们没有对文本使用任何样式。 They have just mentioned Color and font size.他们刚刚提到了颜色和字体大小。 So you have to add those from there according to your wish, at the code definition which you can access when you import the plugin at the top by clicking view definitions.因此,您必须根据自己的意愿在代码定义中添加那些,当您通过单击视图定义在顶部导入插件时可以访问该代码定义。

So at this place in container.dart as shown in the package definition here EASY LOADING EDIT所以在 container.dart 中的这个地方,如 package 定义中所示 这里EASY LOADING EDIT

Text(
                _status,
                style: TextStyle(
                  color: EasyLoadingTheme.textColor,
                  fontSize: EasyLoadingTheme.fontSize,
                ),
                textAlign: EasyLoadingTheme.textAlign,
              )

You can add your own style in the TextStyle.您可以在 TextStyle 中添加自己的样式。 Hope this could help:)希望这可以帮助:)

EasyLoading.instance
..displayDuration = const Duration(seconds: 3)
..indicatorType = EasyLoadingIndicatorType.cubeGrid
..loadingStyle = EasyLoadingStyle.custom
..indicatorSize = 45.0
..radius = 10.0
..progressColor = Colors.blue.shade900
..backgroundColor = Colors.blueGrey
..indicatorColor = Colors.white
..textColor = Colors.white
..textStyle = const TextStyle(fontSize:22,fontStyle: FontStyle.italic )
..maskColor = Colors.grey.withOpacity(0.7)
..userInteractions = true
..maskType = EasyLoadingMaskType.custom
..dismissOnTap = isDismiss;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM