yako-dev/flutter-settings-ui

Switch not toggling

Nikotecnology opened this issue · 1 comments

Hi, i installed the last version of this library, but i can't toggle a switch, it works only if i swipe but it don't toggle, here is my code

//(Outside The build function)
void changeAuthState(bool value) {
     this.isSwitched = true;
  }

...
Expanded(
    child: SettingsList(
      lightTheme: const SettingsThemeData(
          settingsListBackground: Color.fromRGBO(242, 242, 242, 1)
      ),
      darkTheme: const SettingsThemeData(
          settingsListBackground: Color.fromRGBO(48, 48, 48, 1)
      ),
      sections: [
        SettingsSection(
          tiles: <SettingsTile>[
            SettingsTile.switchTile(
              onToggle: (value) => changeAuthState(value),
              initialValue: isSwitched,
              leading: const Icon(Icons.fingerprint_outlined),
              title: Text('Accedi con $type'),
            ),
          ],
        ),
      ],
  )

@Nikotecnology your code need an update. In the changeAuthState method, you always isSwitched set as true, not value.