fromJson static method

ThemeData fromJson(
  1. Map<String, dynamic> json
)

Decodes the given json to a ThemeData. This expects the value to have the following structure:

{
  "androidOverscrollIndicator": <AndroidOverscrollIndicator>,
  "appBarTheme": <AppBarTheme>,
  "applyElevationOverlayColor": <bool>,
  "backgroundColor": <Color>,
  "bannerTheme": <MaterialBannerThemeData>,
  "bottomAppBarColor": <Color>,
  "bottomAppBarTheme": <BottomAppBarTheme>,
  "bottomNavigationBarTheme": <BottomNavigationBarThemeData>,
  "bottomSheetTheme": <BottomSheetThemeData>,
  "brightness": <Brightness>,
  "buttonBarTheme": <ButtonBarThemeData>,
  "buttonTheme": <ButtonThemeData>,
  "canvasColor": <Color>,
  "cardColor": <Color>,
  "cardTheme": <CardTheme>,
  "checkboxThemeData": <CheckboxThemeData>,
  "chipTheme": <ChipThemeData>,
  "colorScheme": <ColorScheme>,
  "cupertinoOverrideTheme": <CupertinoThemeData>,
  "cursorColor": <Color>,
  "dataTableTheme": <DataTableThemeData>,
  "dialogBackgroundColor": <Color>,
  "dialogTheme": <DialogTheme>,
  "disabledColor": <Color>,
  "dividerColor": <Color>,
  "dividerTheme": <DividerThemeData>,
  "drawerTheme": <DrawerThemeData>,
  "elevatedButtonTheme": <ElevatedButtonThemeData>,
  "errorColor": <Color>,
  "floatingActionButtonTheme": <FloatingActionButtonThemeData>,
  "focusColor": <Color>,
  "fontFamily": <String>,
  "highlightColor": <Color>,
  "hintColor": <Color>,
  "hoverColor": <Color>,
  "iconTheme": <IconThemeData>,
  "indicatorColor": <Color>,
  "inputDecorationTheme": <InputDecorationTheme>,
  "listTileTheme": <ListTileThemeData>,
  "materialTapTargetSize": <MaterialTapTargetSize>,
  "navigationBarTheme": <NavigationBarThemeData>,
  "navigationRailTheme": <NavigationRailThemeData>,
  "outlinedButtonTheme": <OutlinedButtonThemeData>,
  "pageTransitionsTheme": <PageTransitionsTheme>,
  "platform": <TargetPlatform>,
  "popupMenuTheme": <PopupMenuThemeData>,
  "primaryColor": <Color>,
  "primaryColorBrightness": <Brightness>,
  "primaryColorDark": <Color>,
  "primaryColorLight": <Color>,
  "primaryIconTheme": <IconThemeData>,
  "primarySwatch": <MaterialColor>,
  "primaryTextTheme": <TextTheme>,
  "progressIndicatorTheme": <ProgressIndicatorTheme>,
  "radioTheme": <RadioThemeData>,
  "scaffoldBackgroundColor": <Color>,
  "scrollbarTheme": <ScrollbarThemeData>,
  "secondaryHeaderColor": <Color>,
  "selectedRowColor": <Color>,
  "shadowColor": <Color>,
  "sliderTheme": <SliderThemeData>,
  "snackBarTheme": <SnackBarThemeData>,
  "splashColor": <Color>,
  "splashFactory": <InteractiveInkFeatureFactory>,
  "switchTheme": <SwitchThemeData>,
  "tabBarTheme": <TabBarTheme>,
  "textButtonTheme": <TextButtonThemeData>,
  "textSelectionColor": <Color>,
  "textSelectionHandleColor": <Color>,
  "textSelectionTheme": <TextSelectionThemeData>,
  "textTheme": <TextTheme>,
  "timePickerTheme": <TimePickerThemeData>,
  "toggleButtonsTheme": <ToggleButtonsThemeData>,
  "toggleableActiveColor": <Color>,
  "tooltipTheme": <TooltipThemeData>,
  "typography": <Typography>,
  "unselectedWidgetColor": <Color>,
  "visualDensity": <VisualDensity>
}

Implementation

static ThemeData fromJson(Map<String, dynamic> json) =>
    ThemeDecoder.decodeThemeData(json) ?? ThemeData();