buildSettingRow static method

Widget buildSettingRow({
  1. required BuildContext context,
  2. required String title,
  3. required bool value,
  4. required ValueChanged<bool> onChanged,
})

Implementation

static Widget buildSettingRow({
  required BuildContext context,
  required String title,
  required bool value,
  required ValueChanged<bool> onChanged,
}) {
  final colorsTheme = BaseThemeProvider.colorsOf(context);

  return Container(
    padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
    child: Row(
      children: [
        Expanded(
          child: Text(
            title,
            style: TextStyle(
              fontSize: 16,
              fontWeight: FontWeight.w400,
              color: colorsTheme.textColorPrimary,
            ),
          ),
        ),
        Switch(
          value: value,
          onChanged: onChanged,
          materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
          thumbColor: WidgetStateProperty.resolveWith<Color>((states) {
            return colorsTheme.textColorButton;
          }),
          trackColor: WidgetStateProperty.resolveWith<Color>((states) {
            if (states.contains(WidgetState.selected)) {
              return colorsTheme.switchColorOn;
            }
            return colorsTheme.switchColorOff;
          }),
          trackOutlineColor: WidgetStateProperty.resolveWith<Color?>((states) {
            return colorsTheme.clearColor;
          }),
        ),
      ],
    ),
  );
}