createMaterialScaffold static method

Widget createMaterialScaffold(
  1. BuildContext context,
  2. int menuIndex,
  3. dynamic changeLocale(
    1. Locale? locale
    )
)

Implementation

static Widget createMaterialScaffold(BuildContext context, int menuIndex,
    Function(Locale? locale) changeLocale) {
  return Scaffold(
      appBar: AppBar(
        title: const Text(L10n.title),
        actions: <Widget>[
          Padding(
            padding: const EdgeInsets.symmetric(horizontal: 5),
            child: DropdownButtonHideUnderline(
              child: ButtonTheme(
                alignedDropdown: true,
                child: DropdownButton<L10nLocale>(
                  icon: const Icon(
                    Icons.language,
                    color: Colors.white,
                  ),
                  onChanged: changeLocale,
                  value: l10nSettings.locales[menuIndex],
                  items: l10nSettings.locales
                      .map<DropdownMenuItem<L10nLocale>>(
                        (l) => DropdownMenuItem<L10nLocale>(
                          value: l,
                          child: Row(
                            children: <Widget>[getLocaleText(l)],
                          ),
                        ),
                      )
                      .toList(),
                ),
              ),
            ),
          ),
        ],
      ),
      body: createTestBody());
}