settingsList method

Widget settingsList(
  1. BuildContext context
)

Implementation

Widget settingsList(BuildContext context) {
  return Column(
    crossAxisAlignment: CrossAxisAlignment.start,
    children: [
      settingsWidget(context,
          title: 'defaultdistrolocation-text'.i18n(),
          name: 'Default Distro Location',
          tooltip: 'distropath-text'.i18n(),
          suffix: IconButton(
            icon: const Icon(FluentIcons.open_folder_horizontal, size: 15.0),
            onPressed: () async {
              String? path = await FilePicker.platform.getDirectoryPath(
                initialDirectory: prefs.getString("DistroPath") ?? defaultPath,
              );
              if (path != null &&
                  _settings['Default Distro Location'] != null) {
                _settings['Default Distro Location']!.text = path;
              } else {
                // User canceled the picker
              }
            },
          ),
          placeholder: prefs.getString("DistroPath") ?? defaultPath),
      Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
        Padding(
          padding: const EdgeInsets.all(8.0),
          child: Expander(
            header: Text('showdockershort-text'.i18n(),
                style: const TextStyle(fontWeight: FontWeight.w500)),
            content: Padding(
              padding: const EdgeInsets.only(bottom: 8.0, top: 4.0),
              child: Row(
                children: [
                  Tooltip(
                      message: 'showdockershort-text'.i18n(),
                      child: ToggleSwitch(
                        checked: showDocker,
                        onChanged: (value) {
                          setState(() {
                            showDocker = value;
                            prefs.setBool('showDocker', value);
                          });
                        },
                      )),
                  const SizedBox(
                    width: 10.0,
                  ),
                  Text('showdockerlong-text'.i18n()),
                ],
              ),
            ),
          ),
        ),
      ]),
      Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
        Padding(
          padding: const EdgeInsets.all(8.0),
          child: Expander(
            header: Text('language-text'.i18n(),
                style: const TextStyle(fontWeight: FontWeight.w500)),
            content: Padding(
              padding: const EdgeInsets.only(bottom: 8.0, top: 4.0),
              child: Tooltip(
                  message: 'language-text'.i18n(),
                  // Menu
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text(
                        'languagechange-text'.i18n(),
                      ),
                      const SizedBox(
                        height: 20.0,
                      ),
                      Builder(
                        builder: (context) {
                          var lang =
                              Localizations.localeOf(context).languageCode;
                          var selectedLanguage =
                              prefs.getString('language') ?? lang;

                          // Language menu
                          return ComboBox<String>(
                              value: selectedLanguage,
                              items: supportedLocalesList
                                  .map((e) => ComboBoxItem(
                                      value: e.languageCode,
                                      child: Text(e.toString())))
                                  .toList(),
                              onChanged: (language) {
                                String curLanguage = language ?? lang;
                                prefs.setString('language', curLanguage);
                                setState(() {
                                  selectedLanguage = curLanguage;
                                });
                              });
                        },
                      ),
                    ],
                  )),
            ),
          ),
        ),
        // Padding(
        //   padding: const EdgeInsets.all(8.0),
        //   child: Expander(
        //     header: Text('dockerrepo-text'.i18n(),
        //         style: const TextStyle(fontWeight: FontWeight.w500)),
        //     content: Padding(
        //       padding: const EdgeInsets.only(bottom: 8.0, top: 4.0),
        //       child: Tooltip(
        //         message: 'dockerrepo-text'.i18n(),
        //         child: TextBox(
        //           controller: _dockerrepoController,
        //           placeholder: 'https://registry-1.docker.io',
        //         ),
        //       ),
        //     ),
        //   ),
        // ),
        Padding(
          padding: const EdgeInsets.all(8.0),
          child: Expander(
            header: Text('syncipaddress-text'.i18n(),
                style: const TextStyle(fontWeight: FontWeight.w500)),
            content: Padding(
              padding: const EdgeInsets.only(bottom: 8.0, top: 4.0),
              child: Tooltip(
                message: 'syncipaddress-text'.i18n(),
                child: TextBox(
                  controller: _syncIpTextController,
                  placeholder: '192.168.1.20',
                ),
              ),
            ),
          ),
        ),
        Padding(
          padding: const EdgeInsets.all(8.0),
          child: Expander(
            header: Text('repofordistro-text'.i18n(),
                style: const TextStyle(fontWeight: FontWeight.w500)),
            content: Padding(
              padding: const EdgeInsets.only(bottom: 8.0, top: 4.0),
              child: Tooltip(
                message: 'repofordistro-text'.i18n(),
                child: TextBox(
                  controller: _repoTextController,
                  placeholder: defaultRepoLink,
                ),
              ),
            ),
          ),
        ),
      ]),
      const Padding(
        padding: EdgeInsets.only(top: 8.0, bottom: 8.0),
        child: Divider(),
      ),
      Center(
        child: Text("globalconfiguration-text".i18n()),
      ),
      Padding(
        padding: const EdgeInsets.all(10.0),
        child: Text(
          'globalconfigurationinfo-text'.i18n(),
          style: const TextStyle(fontSize: 12.0, fontStyle: FontStyle.italic),
        ),
      ),
      settingsWidget(context,
          title: 'kernel',
          tooltip: 'absolutewindowspath-text'.i18n(),
          placeholder: ''),
      settingsWidget(context,
          title: 'memory',
          tooltip: 'memoryinfo-text'.i18n(),
          type: SettingsType.size,
          sizePostfix: 'GB',
          sizeMin: 1,
          sizeMax:
              (SysInfo.getTotalPhysicalMemory() ~/ 1024 ~/ 1024 ~/ 1024) + 1,
          placeholder: ''),
      settingsWidget(context,
          title: 'processors',
          tooltip: 'processorinfo-text'.i18n(),
          type: SettingsType.size,
          sizeMin: 1,
          sizeMax: SysInfo.cores.length,
          placeholder: ''),
      settingsWidget(context,
          title: 'localhostForwarding',
          tooltip: 'wildcardinfo-text'.i18n(),
          type: SettingsType.bool),
      settingsWidget(context,
          title: 'kernelCommandLine',
          tooltip: 'kernelcmdinfo-text'.i18n(),
          placeholder: ''),
      settingsWidget(context,
          title: 'swap', tooltip: 'swapinfo-text'.i18n(), placeholder: ''),
      settingsWidget(context,
          title: 'swapFile', tooltip: 'vhdinfo-text'.i18n(), placeholder: ''),
      settingsWidget(context,
          title: 'pageReporting',
          tooltip: 'unusedmemoryinfo-text'.i18n(),
          type: SettingsType.bool),
      settingsWidget(context,
          title: 'guiApplications',
          tooltip: 'guiinfo-text'.i18n(),
          type: SettingsType.bool),
      settingsWidget(context,
          title: 'debugConsole',
          tooltip: 'consoleinfo-text'.i18n(),
          type: SettingsType.bool),
      settingsWidget(context,
          title: 'nestedVirtualization',
          tooltip: 'nestedvirtinfo-text'.i18n(),
          type: SettingsType.bool),
      settingsWidget(context,
          title: 'vmIdleTimeout',
          tooltip: 'vmidleinfo-text'.i18n(),
          placeholder: ''),
    ],
  );
}