forked from cwtch.im/cwtch-ui
Themeing Updates including Nicer Code Formatting
This commit is contained in:
parent
0d1e7bb5a0
commit
a4ab2ec060
|
@ -19,7 +19,7 @@ class TextMessage extends Message {
|
|||
return ChangeNotifierProvider.value(
|
||||
value: this.metadata,
|
||||
builder: (bcontext, child) {
|
||||
return Text(this.content);
|
||||
return SelectableText(this.content);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ OpaqueThemeType GetMidnightTheme(String mode) {
|
|||
|
||||
class MidnightDark extends CwtchDark {
|
||||
static final Color background = Color(0xFF1B1B1B);
|
||||
static final Color backgroundAlt = Color(0xFF494949);
|
||||
static final Color header = Color(0xFF1B1B1B);
|
||||
static final Color userBubble = Color(0xFF373737);
|
||||
static final Color peerBubble = Color(0xFF494949);
|
||||
|
@ -41,6 +42,7 @@ class MidnightDark extends CwtchDark {
|
|||
get messageFromOtherTextColor => font; //whiteishPurple;
|
||||
get textfieldBackgroundColor => peerBubble;
|
||||
get textfieldBorderColor => userBubble;
|
||||
get backgroundHilightElementColor => backgroundAlt;
|
||||
}
|
||||
|
||||
class MidnightLight extends CwtchLight {
|
||||
|
|
|
@ -128,8 +128,8 @@ ThemeData mkThemeData(Settings opaque) {
|
|||
primaryIconTheme: IconThemeData(
|
||||
color: opaque.current().mainTextColor,
|
||||
),
|
||||
primaryColor: opaque.current().backgroundMainColor,
|
||||
canvasColor: opaque.current().backgroundPaneColor,
|
||||
primaryColor: opaque.current().mainTextColor,
|
||||
canvasColor: opaque.current().backgroundMainColor,
|
||||
backgroundColor: opaque.current().backgroundMainColor,
|
||||
highlightColor: opaque.current().hilightElementColor,
|
||||
iconTheme: IconThemeData(
|
||||
|
@ -154,6 +154,7 @@ ThemeData mkThemeData(Settings opaque) {
|
|||
actionsIconTheme: IconThemeData(
|
||||
color: opaque.current().mainTextColor,
|
||||
)),
|
||||
|
||||
//bottomNavigationBarTheme: BottomNavigationBarThemeData(type: BottomNavigationBarType.fixed, backgroundColor: opaque.current().backgroundHilightElementColor), // Can't determine current use
|
||||
textButtonTheme: TextButtonThemeData(
|
||||
style: ButtonStyle(
|
||||
|
@ -181,7 +182,10 @@ ThemeData mkThemeData(Settings opaque) {
|
|||
),
|
||||
),
|
||||
scrollbarTheme: ScrollbarThemeData(isAlwaysShown: false, thumbColor: MaterialStateProperty.all(opaque.current().scrollbarDefaultColor)),
|
||||
tabBarTheme: TabBarTheme(indicator: UnderlineTabIndicator(borderSide: BorderSide(color: opaque.current().defaultButtonActiveColor))),
|
||||
tabBarTheme: TabBarTheme(
|
||||
labelColor: opaque.current().mainTextColor,
|
||||
unselectedLabelColor: opaque.current().mainTextColor,
|
||||
indicator: UnderlineTabIndicator(borderSide: BorderSide(color: opaque.current().defaultButtonActiveColor))),
|
||||
dialogTheme: DialogTheme(
|
||||
backgroundColor: opaque.current().backgroundPaneColor,
|
||||
titleTextStyle: TextStyle(color: opaque.current().mainTextColor),
|
||||
|
@ -207,8 +211,14 @@ ThemeData mkThemeData(Settings opaque) {
|
|||
thumbColor: MaterialStateProperty.all(opaque.current().mainTextColor),
|
||||
trackColor: MaterialStateProperty.all(opaque.current().dropShadowColor),
|
||||
),
|
||||
// the only way to change the text Selection Context Menu Color ?!
|
||||
brightness: opaque.current().mode == mode_dark ? Brightness.dark : Brightness.light,
|
||||
floatingActionButtonTheme: FloatingActionButtonThemeData(
|
||||
backgroundColor: opaque.current().defaultButtonColor, hoverColor: opaque.current().defaultButtonActiveColor, enableFeedback: true, splashColor: opaque.current().defaultButtonActiveColor),
|
||||
foregroundColor: opaque.current().mainTextColor,
|
||||
backgroundColor: opaque.current().defaultButtonColor,
|
||||
hoverColor: opaque.current().defaultButtonActiveColor,
|
||||
enableFeedback: true,
|
||||
splashColor: opaque.current().defaultButtonActiveColor),
|
||||
textSelectionTheme: TextSelectionThemeData(
|
||||
cursorColor: opaque.current().defaultButtonActiveColor, selectionColor: opaque.current().defaultButtonActiveColor, selectionHandleColor: opaque.current().defaultButtonActiveColor),
|
||||
);
|
||||
|
|
|
@ -171,6 +171,9 @@ class SelectableLinkify extends StatelessWidget {
|
|||
|
||||
// TextSpan
|
||||
|
||||
/// Style for code text
|
||||
final TextStyle? codeStyle;
|
||||
|
||||
/// Style for non-link text
|
||||
final TextStyle? style;
|
||||
|
||||
|
@ -255,6 +258,7 @@ class SelectableLinkify extends StatelessWidget {
|
|||
this.linkStyle,
|
||||
// RichText
|
||||
this.textAlign,
|
||||
this.codeStyle,
|
||||
this.textDirection,
|
||||
this.minLines,
|
||||
this.maxLines,
|
||||
|
@ -291,6 +295,7 @@ class SelectableLinkify extends StatelessWidget {
|
|||
buildTextSpan(
|
||||
elements,
|
||||
style: Theme.of(context).textTheme.bodyText2?.merge(style),
|
||||
codeStyle: Theme.of(context).textTheme.bodyText2?.merge(codeStyle),
|
||||
onOpen: onOpen,
|
||||
linkStyle: Theme.of(context)
|
||||
.textTheme
|
||||
|
@ -347,6 +352,7 @@ TextSpan buildTextSpan(
|
|||
List<LinkifyElement> elements, {
|
||||
TextStyle? style,
|
||||
TextStyle? linkStyle,
|
||||
TextStyle? codeStyle,
|
||||
LinkCallback? onOpen,
|
||||
bool useMouseRegion = false,
|
||||
}) {
|
||||
|
@ -404,7 +410,7 @@ TextSpan buildTextSpan(
|
|||
text: element.text.replaceAll("\`", ""),
|
||||
// monospace fonts at the same size as regular text makes them appear
|
||||
// slightly larger, so we compensate by making them slightly smaller...
|
||||
style: style?.copyWith(fontFamily: "RobotoMono", fontSize: style.fontSize! - 1.0),
|
||||
style: codeStyle?.copyWith(fontFamily: "RobotoMono", fontSize: codeStyle.fontSize! - 1.5),
|
||||
semanticsLabel: element.text);
|
||||
} else {
|
||||
return TextSpan(
|
||||
|
|
|
@ -40,7 +40,7 @@ class _ContactRowState extends State<ContactRow> {
|
|||
return Card(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
color: Provider.of<AppState>(context).selectedConversation == contact.identifier ? Provider.of<Settings>(context).theme.backgroundHilightElementColor : null,
|
||||
borderOnForeground: false,
|
||||
borderOnForeground: true,
|
||||
margin: EdgeInsets.all(0.0),
|
||||
child: InkWell(
|
||||
child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||
|
|
|
@ -63,9 +63,11 @@ class MessageBubbleState extends State<MessageBubble> {
|
|||
style: TextStyle(
|
||||
color: fromMe ? Provider.of<Settings>(context).theme.messageFromMeTextColor : Provider.of<Settings>(context).theme.messageFromOtherTextColor,
|
||||
),
|
||||
linkStyle: TextStyle(
|
||||
color: Provider.of<Settings>(context).current().mainTextColor,
|
||||
),
|
||||
linkStyle: TextStyle(color: fromMe ? Provider.of<Settings>(context).theme.messageFromMeTextColor : Provider.of<Settings>(context).theme.messageFromOtherTextColor),
|
||||
codeStyle: TextStyle(
|
||||
// note: these colors are flipped
|
||||
color: fromMe ? Provider.of<Settings>(context).theme.messageFromOtherTextColor : Provider.of<Settings>(context).theme.messageFromMeTextColor,
|
||||
backgroundColor: fromMe ? Provider.of<Settings>(context).theme.messageFromOtherBackgroundColor : Provider.of<Settings>(context).theme.messageFromMeBackgroundColor),
|
||||
textAlign: TextAlign.left,
|
||||
textWidthBasis: TextWidthBasis.longestLine,
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue