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