Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compose: Compose-box border is subtle in dark mode #1233

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 60 additions & 1 deletion lib/widgets/compose_box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,63 @@ import 'store.dart';
import 'text.dart';
import 'theme.dart';

/// Compose-box styles that differ between light and dark theme.
///
/// These styles will animate on theme changes (with help from [lerp]).
class ComposeBoxTheme extends ThemeExtension<ComposeBoxTheme> {
factory ComposeBoxTheme.light(BuildContext context) {
return ComposeBoxTheme._(
boxShadow: null,
);
}

factory ComposeBoxTheme.dark(BuildContext context) {
return ComposeBoxTheme._(
boxShadow: [BoxShadow(
color: DesignVariables.dark().bgTopBar,
offset: const Offset(0, -4),
blurRadius: 16,
spreadRadius: 0,
)],
);
}

ComposeBoxTheme._({
required this.boxShadow,
});

/// The [ComposeBoxTheme] from the context's active theme.
///
/// The [ThemeData] must include [ComposeBoxTheme] in [ThemeData.extensions].
static ComposeBoxTheme of(BuildContext context) {
final theme = Theme.of(context);
final extension = theme.extension<ComposeBoxTheme>();
assert(extension != null);
return extension!;
}

final List<BoxShadow>? boxShadow;

@override
ComposeBoxTheme copyWith({
List<BoxShadow>? boxShadow,
}) {
return ComposeBoxTheme._(
boxShadow: boxShadow ?? this.boxShadow,
);
}

@override
ComposeBoxTheme lerp(ComposeBoxTheme other, double t) {
if (identical(this, other)) {
return this;
}
return ComposeBoxTheme._(
boxShadow: BoxShadow.lerpList(boxShadow, other.boxShadow, t)!,
);
}
}

const double _composeButtonSize = 44;

/// A [TextEditingController] for use in the compose box.
Expand Down Expand Up @@ -1051,7 +1108,9 @@ class _ComposeBoxContainer extends StatelessWidget {
// the message list itself
return Container(width: double.infinity,
decoration: BoxDecoration(
border: Border(top: BorderSide(color: designVariables.borderBar))),
border: Border(top: BorderSide(color: designVariables.borderBar)),
boxShadow: ComposeBoxTheme.of(context).boxShadow,
),
// TODO(#720) try a Stack for the overlaid linear progress indicator
child: Material(
color: designVariables.composeBoxBg,
Expand Down
5 changes: 4 additions & 1 deletion lib/widgets/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';

import '../api/model/model.dart';
import 'content.dart';
import 'compose_box.dart';
import 'emoji_reaction.dart';
import 'message_list.dart';
import 'channel_colors.dart';
Expand Down Expand Up @@ -32,6 +33,7 @@ ThemeData zulipThemeData(BuildContext context) {
designVariables,
EmojiReactionTheme.light(),
MessageListTheme.light(),
ComposeBoxTheme.light(context),
];
}
case Brightness.dark: {
Expand All @@ -41,6 +43,7 @@ ThemeData zulipThemeData(BuildContext context) {
designVariables,
EmojiReactionTheme.dark(),
MessageListTheme.dark(),
ComposeBoxTheme.dark(context),
];
}
}
Expand Down Expand Up @@ -177,7 +180,7 @@ class DesignVariables extends ThemeExtension<DesignVariables> {
bgMenuButtonActive: Colors.black.withValues(alpha: 0.2),
bgMenuButtonSelected: Colors.black.withValues(alpha: 0.25),
bgTopBar: const Color(0xff242424),
borderBar: Colors.black.withValues(alpha: 0.5),
borderBar: const Color(0xffffffff).withValues(alpha: 0.1),
borderMenuButtonSelected: Colors.white.withValues(alpha: 0.1),
btnLabelAttLowIntDanger: const Color(0xffff8b7c),
btnLabelAttMediumIntDanger: const Color(0xffff8b7c),
Expand Down