Skip to content

Commit ba8cce8

Browse files
committed
Update ArnaTheme and ArnaThemeData
1 parent 80052a4 commit ba8cce8

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
- Update ArnaTextField
2020
- Add ArnaTextFormField
2121
- Add ArnaTextSelectionControls
22+
- Update ArnaThemeData
23+
- Update ArnaTheme
2224

2325
## 0.4.5
2426

lib/src/theme/theme.dart

+8-9
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,9 @@ class ArnaTheme extends StatelessWidget {
5050
///
5151
/// See also:
5252
///
53-
/// * [maybeBrightnessOf], which returns null if no valid [ArnaTheme] or
54-
/// [MediaQuery] exists, instead of throwing.
55-
/// * [ArnaThemeData.brightness], the property takes precedence over
56-
/// [MediaQueryData.platformBrightness] for descendant Arna widgets.
53+
/// * [maybeBrightnessOf], which returns null if no valid [ArnaTheme] or [MediaQuery] exists, instead of throwing.
54+
/// * [ArnaThemeData.brightness], the property takes precedence over [MediaQueryData.platformBrightness] for
55+
/// descendant Arna widgets.
5756
static Brightness brightnessOf(BuildContext context) {
5857
final _InheritedArnaTheme? inheritedTheme = context.dependOnInheritedWidgetOfExactType<_InheritedArnaTheme>();
5958
return inheritedTheme?.theme.data.brightness ?? MediaQuery.of(context).platformBrightness;
@@ -68,10 +67,9 @@ class ArnaTheme extends StatelessWidget {
6867
///
6968
/// See also:
7069
///
71-
/// * [ArnaThemeData.brightness], the property takes precedence over
72-
/// [MediaQueryData.platformBrightness] for descendant Arna widgets.
73-
/// * [brightnessOf], which throws if no valid [ArnaTheme] or
74-
/// [MediaQuery] exists, instead of returning null.
70+
/// * [ArnaThemeData.brightness], the property takes precedence over [MediaQueryData.platformBrightness] for
71+
/// descendant Arna widgets.
72+
/// * [brightnessOf], which throws if no valid [ArnaTheme] or [MediaQuery] exists, instead of returning null.
7573
static Brightness? maybeBrightnessOf(BuildContext context) {
7674
final _InheritedArnaTheme? inheritedTheme = context.dependOnInheritedWidgetOfExactType<_InheritedArnaTheme>();
7775
return inheritedTheme?.theme.data.brightness ?? MediaQuery.maybeOf(context)?.platformBrightness;
@@ -89,8 +87,9 @@ class ArnaTheme extends StatelessWidget {
8987
}
9088
}
9189

92-
/// _InheritedArnaTheme which extends InheritedWidget
90+
/// _InheritedArnaTheme which extends InheritedWidget.
9391
class _InheritedArnaTheme extends InheritedWidget {
92+
/// Creates a InheritedArnaTheme.
9493
const _InheritedArnaTheme({
9594
required this.theme,
9695
required super.child,

lib/src/theme/theme_data.dart

+6-3
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ class ArnaThemeData with Diagnosticable {
2121
/// * [ArnaThemeData.dark], which creates dark theme.
2222
factory ArnaThemeData({Brightness? brightness, Color? accentColor, ArnaTextTheme? textTheme}) {
2323
final ArnaTextTheme defaultTextTheme = brightness == Brightness.dark ? ArnaTypography.dark : ArnaTypography.light;
24-
final ArnaTextTheme effectiveTextTheme = textTheme ?? defaultTextTheme;
2524

2625
return ArnaThemeData.raw(
2726
brightness: brightness,
2827
accentColor: accentColor ?? ArnaColors.blue,
29-
textTheme: effectiveTextTheme,
28+
textTheme: textTheme ?? defaultTextTheme,
3029
);
3130
}
3231

@@ -35,7 +34,11 @@ class ArnaThemeData with Diagnosticable {
3534
///
3635
/// This will rarely be used directly. It is used by [lerp] to create intermediate themes based on two themes created
3736
/// with the [ArnaThemeData] constructor.
38-
const ArnaThemeData.raw({required this.brightness, required this.accentColor, required this.textTheme});
37+
const ArnaThemeData.raw({
38+
required this.brightness,
39+
required this.accentColor,
40+
required this.textTheme,
41+
});
3942

4043
/// A default light theme.
4144
factory ArnaThemeData.light() => ArnaThemeData(brightness: Brightness.light, textTheme: ArnaTypography.light);

0 commit comments

Comments
 (0)