DraggableDialogThemeData.from constructor

DraggableDialogThemeData.from(
  1. BuildContext context
)

Creates a default theme for the dialog based on the current ThemeData.

Implementation

factory DraggableDialogThemeData.from(BuildContext context) {
  final theme = Theme.of(context);
  final isDarkMode = theme.brightness == Brightness.dark;

  return isDarkMode
      ? DraggableDialogThemeData(
          headerColor: Colors.grey[800],
          contentColor: const Color(0xFF202020),
          footerColor: Colors.grey[850],
          titleStyle:
              theme.textTheme.titleLarge?.copyWith(color: Colors.white70),
          buttonStyle: ElevatedButton.styleFrom(
            backgroundColor: const Color(0xFF3b89b9),
            shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.circular(5)),
          ),
          buttonTextStyle:
              theme.textTheme.labelLarge?.copyWith(color: Colors.white),
        )
      : DraggableDialogThemeData(
          headerColor: Colors.blueGrey[50],
          contentColor: Colors.white,
          footerColor: Colors.grey[100],
          titleStyle:
              theme.textTheme.titleLarge?.copyWith(color: Colors.black87),
          buttonStyle: ElevatedButton.styleFrom(
            backgroundColor: const Color(0xFF3b89b9),
            shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.circular(5)),
          ),
          buttonTextStyle:
              theme.textTheme.labelLarge?.copyWith(color: Colors.white),
        );
}