createCupertinoScaffold static method

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

Implementation

static Widget createCupertinoScaffold(BuildContext context, int menuIndex,
    Function(Locale? locale) changeLocale) {
  return CupertinoPageScaffold(
      navigationBar: CupertinoNavigationBar(
        leading: Padding(
            padding: const EdgeInsets.symmetric(vertical: 10),
            child: DefaultTextStyle(
              style: CupertinoTheme.of(context).textTheme.navTitleTextStyle,
              child: const Text(L10n.title),
            )),
        trailing: CupertinoButton(
            padding: const EdgeInsets.symmetric(horizontal: 5),
            child: const MouseRegion(
              cursor: SystemMouseCursors.click,
              child: Icon(CupertinoIcons.globe),
            ),
            onPressed: () {
              showCupertinoModalPopup(
                  context: context,
                  builder: (_) => Container(
                        height: 150,
                        decoration: const BoxDecoration(
                          color: CupertinoColors.lightBackgroundGray,
                          border: Border(
                            top: BorderSide(
                              color: Color(0xff999999),
                              width: 1.0,
                            ),
                          ),
                        ),
                        child: CupertinoPicker(
                          itemExtent: 30,
                          scrollController: FixedExtentScrollController(
                              initialItem: menuIndex),
                          children: l10nSettings.locales
                              .map((l) => getLocaleText(l))
                              .toList(),
                          onSelectedItemChanged: (index) {
                            changeLocale(l10nSettings.locales[index]);
                          },
                        ),
                      ));
            }),
      ),
      child: WidgetHelper.createTestBody());
}