Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Locale functionality doesn't run properly #20

Open
frmunozr10 opened this issue Jun 26, 2019 · 5 comments
Open

Locale functionality doesn't run properly #20

frmunozr10 opened this issue Jun 26, 2019 · 5 comments

Comments

@frmunozr10
Copy link

frmunozr10 commented Jun 26, 2019

Hello,
When I fill up locale variable with a location different to Locale('en') I've run into an issue:

I/flutter ( 5182): When the exception was thrown, this was the stack:
I/flutter ( 5182): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:50:5)
I/flutter ( 5182): #1 _DatePickerDialogState.didChangeDependencies
package:date_range_picker/date_range_picker.dart:1033

Localizations variable in date_range_picker.dart file is null.

If I change Locale('fr') to Locale('en') localizations variable is not null and all run properly.

Code:
final List picked = await DateRangePicker.showDatePicker(
context: context,
initialFirstDate: DateTime.now(),
initialLastDate: (DateTime.now()).add(Duration(days: 2)),
firstDate: (DateTime.now()).subtract(Duration(days: 1)),
lastDate: (DateTime.now()).add(Duration(days: 365)),
locale: Locale('fr')
);

Any way around this?

Thanks.

@love-bk
Copy link

love-bk commented Jul 1, 2019

I also have this problem.

@TinkerBuild
Copy link

same problem

1 similar comment
@PauloKlixto
Copy link

same problem

@rainbowChenhong
Copy link

config MaterialLocalizations can solve this problem

1.pubspec.yaml add dependencies

flutter_localizations: sdk: flutter
2.main.dart
import 'package:flutter_localizations/flutter_localizations.dart';
//MaterialApp
//增加国际化 localizationsDelegates: [ //此处 GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, ], supportedLocales: [ //此处 const Locale('zh', 'CH'), ]

3 date_range_picker
locale: const Locale('zh', 'CH')

then it can work

@arthurstefe
Copy link

config MaterialLocalizations can solve this problem

1.pubspec.yaml add dependencies

flutter_localizations: sdk: flutter
2.main.dart
import 'package:flutter_localizations/flutter_localizations.dart';
//MaterialApp
//增加国际化 localizationsDelegates: [ //此处 GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, ], supportedLocales: [ //此处 const Locale('zh', 'CH'), ]

3 date_range_picker
locale: const Locale('zh', 'CH')

then it can work
It works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants