Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Commit

Permalink
fix(ui): fix AppBar color
Browse files Browse the repository at this point in the history
  • Loading branch information
Craftplacer committed May 22, 2023
1 parent 210fd8b commit 236bdf2
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/kaiteki/lib/ui/main/views/kaiteki.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class _KaitekiMainScreenViewState extends ConsumerState<KaitekiMainScreenView> {

return Scaffold(
backgroundColor: isCompact ? null : getOutsideColor(context),
appBar: buildAppBar(context),
appBar: buildAppBar(context, !isCompact),
body: isCompact
? body
: _buildDesktopView(
Expand Down Expand Up @@ -281,7 +281,7 @@ class _KaitekiMainScreenViewState extends ConsumerState<KaitekiMainScreenView> {
);
}

PreferredSizeWidget buildAppBar(BuildContext context) {
PreferredSizeWidget buildAppBar(BuildContext context, bool immerse) {
if (ref.watch(useSearchBar).value) {
return PreferredSize(
preferredSize: const Size.fromHeight(56.0 + 8.0 * 2),
Expand All @@ -306,26 +306,28 @@ class _KaitekiMainScreenViewState extends ConsumerState<KaitekiMainScreenView> {
);
}

Color? foregroundColor;
Color? backgroundColor, foregroundColor;

final outsideColor = getOutsideColor(context);
if (outsideColor != null) {
foregroundColor = ThemeData.estimateBrightnessForColor(outsideColor)
.inverted
.getColor();
if (immerse) {
final backgroundColor = getOutsideColor(context);
if (backgroundColor != null) {
foregroundColor = ThemeData.estimateBrightnessForColor(backgroundColor)
.inverted
.getColor();
}
}

final theme = Theme.of(context);
return AppBar(
backgroundColor: outsideColor,
backgroundColor: backgroundColor,
foregroundColor: foregroundColor,
title: Text(
appName,
style: theme.ktkTextTheme?.kaitekiTextStyle,
),
actions: _buildAppBarActions(context),
elevation: 0.0,
scrolledUnderElevation: outsideColor != null ? 0.0 : 4.0,
scrolledUnderElevation: immerse ? 0.0 : 4.0,
);
}
}

0 comments on commit 236bdf2

Please sign in to comment.