flutter textfield hinttext的对齐问题

默认是英文的,但是因为英文中文有区别,所以在输入中文的时候会有问题

一种解决方法:materialapp节点下添加

localizationsDelegates: [
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate
      ],
      locale: const Locale("en", "US"),
      supportedLocales: [
        const Locale("zh", "CH"),//CH和CN好像都行
        const Locale("en", "US")
      ],

 

或者,直接在需要用到的地方

Localizations(

    locale: Locale("zh", "CH"),
    delegates: [
    GlobalMaterialLocalizations.delegate,
    GlobalWidgetsLocalizations.delegate,
    ],

    child:你要嵌套的控件
)

忽然发现flutter嵌套的写法繁琐,但是扩展起来却是非常容易,套

你可能感兴趣的:(flutter)