darkTheme property

ThemeData darkTheme

Shows when the current mode is a dark theme.

Implementation

ThemeData get darkTheme => ThemeData(
      scaffoldBackgroundColor: Colors.black,
      textTheme: textTheme,
      switchTheme: SwitchThemeData(
        thumbColor: MaterialStateColor.resolveWith((states) {
          return states.contains(MaterialState.selected)
              ? Colors.red
              : Colors.grey;
        }),
        trackColor: MaterialStateColor.resolveWith((states) {
          return states.contains(MaterialState.selected)
              ? Colors.red.withOpacity(0.5)
              : Colors.grey;
        }),
      ),
      appBarTheme: const AppBarTheme(
        elevation: 0,
        centerTitle: false,
        backgroundColor: Colors.black,
        foregroundColor: Colors.white,
      ),
      bottomNavigationBarTheme: BottomNavigationBarThemeData(
        elevation: 0,
        type: BottomNavigationBarType.fixed,
        selectedLabelStyle: textTheme.labelSmall,
        unselectedLabelStyle: textTheme.labelSmall,
        showSelectedLabels: true,
        showUnselectedLabels: true,
        backgroundColor: Colors.black,
      ),
      popupMenuTheme: const PopupMenuThemeData(
        color: Color.fromARGB(255, 30, 30, 30),
        shape: RoundedRectangleBorder(),
      ),
      dialogTheme: const DialogTheme(
        backgroundColor: Color.fromARGB(255, 30, 30, 30),
        shape: RoundedRectangleBorder(),
      ),
      cardColor: const Color.fromARGB(255, 30, 30, 30),
      textButtonTheme: TextButtonThemeData(
        style: TextButton.styleFrom(
          foregroundColor: Colors.white,
        ),
      ),
      listTileTheme: ListTileThemeData(
        dense: true,
        selectedTileColor: Colors.grey.shade600,
        selectedColor: Colors.white,
        horizontalTitleGap: 0,
      ),
      inputDecorationTheme: const InputDecorationTheme(
        enabledBorder: UnderlineInputBorder(
          borderSide: BorderSide(
            color: Colors.white70,
          ),
        ),
        focusedBorder: UnderlineInputBorder(
          borderSide: BorderSide(color: Colors.red),
        ),
      ),
      scrollbarTheme: ScrollbarThemeData(
        thumbVisibility: MaterialStateProperty.all(true),
      ),
      sliderTheme: const SliderThemeData(
        thumbColor: Colors.red,
        activeTrackColor: Colors.red,
        inactiveTrackColor: Colors.grey,
        trackShape: RectangularSliderTrackShape(),
        trackHeight: 2,
        thumbShape: RoundSliderThumbShape(enabledThumbRadius: 6),
      ),
      colorScheme: ColorScheme.fromSwatch()
          .copyWith(
            primary: Colors.red,
            secondary: Colors.red,
            brightness: Brightness.dark,
          )
          .copyWith(background: Colors.black),
    );