language_picker library Language Picker

Classes

ChangeLanguageWidget
L10nErrorKeyProvider
LanguageModel
This class should be used to create objects for the languages that your app is going to use.
LanguagePickerBloc
The LanguagePickerBloc handles the logic providing a state for the fetched list of languages from the LanguageService. It has a state for the currently selected language currentLanguage and an event setCurrent to update this state.
LanguagePickerBlocEvents
A contract class containing all events of the LanguagePickerBloC.
LanguagePickerBlocStates
A contract class containing all states of the LanguagePickerBloC.
LanguagePickerDependencies
LanguagePickerModalConfiguration
LanguagePickerTheme
LanguageService
This class should be extended in you project and each of its method should have an implementation. It is added as a dependency in the LanguagePickerBloc. In your implementation you can add in the constructor of the class a data source as a dependency from which to get the list of languages used in your app and send requests to update the currently selected language for the user.
MessagePanelError<BlocType extends RxBlocTypeBase>
MessagePanelWidget
SelectedLanguageModel
SelectLanguageItem
The class is used to display the languageModel in the list of languages
SvgFile
asset_classes option lets you define completely custom classes for handling assets based on their extension Here we used SvgFile to automatically convert svg assets into widgets

Functions

showChangeLanguageBottomSheet({required BuildContext context, required LanguageService service, required dynamic onChanged(LanguageModel language), required String translate(LanguageModel), Widget headerBuilder(BuildContext)?, Widget errorBuilder(ErrorModel?)?, Widget itemBuilder(SelectedLanguageModel model, bool loading, BuildContext context)?, LanguagePickerModalConfiguration modalConfiguration = const LanguagePickerModalConfiguration(), MessagePanelState messageState = MessagePanelState.important}) → void
Display a bottom modal sheet, designed to display a list of available languages, from which to choose one to be set as the language Locale() to your MaterialApp()

Typedefs

ErrorStateCallback<BlocType extends RxBlocTypeBase> = Stream<ErrorModel?> Function(BlocType bloc)

Exceptions / Errors

EmptyListErrorModel
ErrorAccessDeniedModel
Exception thrown whenever some part of the application or package requires access to a resource or a part of the code where it has none.
ErrorModel
The base error model from which all other errors inherit.
GenericErrorModel
UnknownErrorModel