build abstract method

Widget build(
  1. BuildContext context,
  2. WidgetRef ref,
  3. Locale state,
  4. LanguageSwitcherNotifier notifier,
  5. List<LocaleInfo> supportedLocales,
)

Build method that concrete implementations must override.

This method receives all necessary data for building language switcher UI:

  • context: The build context for accessing theme and navigation
  • ref: WidgetRef for accessing Riverpod providers
  • state: Current locale state from the language switcher provider
  • notifier: LanguageSwitcherNotifier for changing locales
  • supportedLocales: List of all supported locales from app configuration

Example implementation:

@override
Widget build(
  BuildContext context,
  WidgetRef ref,
  Locale state,
  LanguageSwitcherNotifier notifier,
  List<LocaleInfo> supportedLocales,
) {
  return Column(
    children: supportedLocales.map((localeInfo) {
      return RadioListTile<Locale>(
        value: localeInfo.locale,
        groupValue: state,
        title: Text(localeInfo.displayName),
        onChanged: (locale) {
          if (locale != null) notifier.changeLocale(locale);
        },
      );
    }).toList(),
  );
}

Implementation

Widget build(
  BuildContext context,
  WidgetRef ref,
  Locale state,
  LanguageSwitcherNotifier notifier,
  List<LocaleInfo> supportedLocales,
);