PensilThemeData constructor
PensilThemeData({
- Brightness? brightness,
- IconThemeData? primaryIconTheme,
- UserTileThemeData? userTileTheme,
- GalleryHeaderThemeData? galleryHeaderTheme,
- MarkdownThemeData? markdownTheme,
Builds a PensilThemeData with default values, if none are given.
Implementation
factory PensilThemeData({
Brightness? brightness,
IconThemeData? primaryIconTheme,
UserTileThemeData? userTileTheme,
GalleryHeaderThemeData? galleryHeaderTheme,
MarkdownThemeData? markdownTheme,
}) {
// Use the given brightness, or a default
final _brightness = brightness ?? Brightness.light;
// Determine dark or light
final isDark = _brightness == Brightness.dark;
// Use the given primaryIconTheme or a default.
primaryIconTheme ??= IconThemeData(
color: isDark ? const Color(0xff959595) : const Color(0xff757575),
);
// Use the given userTileTheme or a default.
userTileTheme ??= const UserTileThemeData(
usernameTextStyle: TextStyle(
color: Color(0xff333333),
fontWeight: FontWeight.w700,
fontSize: 14,
),
timestampTextStyle: TextStyle(
color: Color(0xff7a8287),
fontWeight: FontWeight.w400,
height: 1.5,
fontSize: 14,
),
avatarSize: 46,
);
// Use the given galleryHeaderTheme or a default.
galleryHeaderTheme ??= const GalleryHeaderThemeData(
backgroundColor: Colors.black,
closeButtonColor: Colors.white,
titleTextStyle: TextStyle(
color: Colors.white,
),
);
markdownTheme ??= const MarkdownThemeData(
h1: TextStyle(
fontSize: 24,
height: 1.15,
fontWeight: FontWeight.w300,
),
h2: TextStyle(
fontSize: 22,
height: 1.15,
fontWeight: FontWeight.normal,
),
h3: TextStyle(
fontSize: 20,
height: 1.15,
fontWeight: FontWeight.w500,
),
h4: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
),
h5: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
),
h6: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
),
p: TextStyle(fontSize: 14),
);
return PensilThemeData.raw(
brightness: _brightness,
primaryIconTheme: primaryIconTheme,
userTileTheme: userTileTheme,
galleryHeaderTheme: galleryHeaderTheme,
markdownTheme: markdownTheme,
);
}