显示带有日期的变量时不正确的语言环境

时间:2019-06-23 09:35:30

标签: flutter dart

我有一个DatePicker,当我将它添加到代码中时,自动用我的语言(俄语)写了几天和几个月,但是现在由于某种原因它用英语写了

我添加了语言环境('ru'),但没有帮助。选择日期后,日历中的语言仅发生更改,带有所选日期的输出变量以英语显示,而俄语则需要


  Future<Null> selectDate(BuildContext context) async {
    final DateTime picked = await showDatePicker(
      context: context,
      initialDate: date,
      firstDate: dateNow,
      lastDate: sixtyDaysFromNow,initialDatePickerMode: DatePickerMode.day,
      locale: Locale('ru','RU'),
    );
     sendDateToChooseTime(BuildContext context) {
       print(picked);
      Navigator.push(
          context,
          MaterialPageRoute(
            builder: (context) => ChooseTime(picked: DateFormat('EEEE dd MMMM').format(picked), phoneNumber:phoneNumber, service:service),
          ));
    }
    if (picked != null ) {
      Locale myLocale = Localizations.localeOf(context);
     // String picked = DateFormat('yyyy-MM-dd – kk:mm').format(now);
      sendDateToChooseTime(context);
    }

  }
localizationsDelegates: [
          // ... app-specific localization delegate[s] here
          GlobalMaterialLocalizations.delegate,
          GlobalWidgetsLocalizations.delegate,
        ],
        supportedLocales: [
          const Locale('en', 'US'),
          const Locale('ru'),
        ],

0 个答案:

没有答案