Приложение Flutter Labeltext Текстовое поле локализации - PullRequest
0 голосов
/ 25 мая 2020

Я пытаюсь изменить текст метки в TextField. У меня проблема с изменением текста метки с помощью значения AppLocalization - как изменить текст метки?

Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text(AppLocalizations.of(context).translate('Hopsalpha'),),
          backgroundColor: Colors.green[800],

          //elevation: 0.0,
        ),
        body: Center(
          child: Container(

            child: Column(
              children: <Widget>[
                Container(
                  padding: EdgeInsets.all(20.0),
                  child: TextField(
                    cursorColor: Colors.green[800],
                    controller: _weight,
                    decoration: InputDecoration(
                        focusedBorder: UnderlineInputBorder(
                          borderSide: BorderSide(color: Colors.green[800], width: 2.0,),
                        ),

                        filled: true,
                        fillColor: Colors.green[10],

                        labelText: AppLocalizations.of(context).translate('weightreceipe'),
                        labelStyle: TextStyle(color: Colors.green[800])
                    ),
                    keyboardType: TextInputType.number,
                    inputFormatters: <TextInputFormatter>[
                      WhitelistingTextInputFormatter.digitsOnly
                    ],
                  ),
                ),

...