Merge pull request 'theme fixes and new fields: messageSelectionColor, portraitOnlineAwayColor, portraitOnlineBusyColor, textfieldSelectionColor, menuBackgroundColor' (#812) from themeBits into trunk
continuous-integration/drone/push Build was killed Details

Reviewed-on: #812
Reviewed-by: Sarah Jamie Lewis <sarah@openprivacy.ca>
This commit is contained in:
Dan Ballard 2024-02-07 17:55:34 +00:00
commit 8d1d9ded5e
11 changed files with 206 additions and 118 deletions

View File

@ -43,6 +43,7 @@ themes:
messageFromMeTextColor: font # whiteishPurple messageFromMeTextColor: font # whiteishPurple
messageFromOtherBackgroundColor: peerBubble # deepPurple messageFromOtherBackgroundColor: peerBubble # deepPurple
messageFromOtherTextColor: font # whiteishPurple messageFromOtherTextColor: font # whiteishPurple
messageSelectionColor: accent
portraitBackgroundColor: deepPurple portraitBackgroundColor: deepPurple
portraitBlockedBorderColor: lightGrey portraitBlockedBorderColor: lightGrey
portraitBlockedTextColor: lightGrey portraitBlockedTextColor: lightGrey
@ -50,6 +51,8 @@ themes:
portraitContactBadgeTextColor: whiteishPurple portraitContactBadgeTextColor: whiteishPurple
portraitOfflineBorderColor: purple portraitOfflineBorderColor: purple
portraitOnlineBorderColor: whiteishPurple portraitOnlineBorderColor: whiteishPurple
portraitOnlineAwayColor: 0xFFFFF59D
portraitOnlineBusyColor: 0xFFEF9A9A
portraitProfileBadgeColor: hotPink portraitProfileBadgeColor: hotPink
portraitProfileBadgeTextColor: whiteishPurple portraitProfileBadgeTextColor: whiteishPurple
scrollbarDefaultColor: purple scrollbarDefaultColor: purple
@ -59,8 +62,10 @@ themes:
textfieldBorderColor: deepPurple textfieldBorderColor: deepPurple
textfieldErrorColor: hotPink textfieldErrorColor: hotPink
textfieldHintColor: mainTextColor textfieldHintColor: mainTextColor
textfieldSelectionColor: accent
toolbarIconColor: settings # whiteishPurple toolbarIconColor: settings # whiteishPurple
topbarColor: header # darkGreyPurple topbarColor: header # darkGreyPurple
menuBackgroundColor: accent;
snackbarBackgroundColor: accent snackbarBackgroundColor: accent
snackbarTextColor: whiteishPurple snackbarTextColor: whiteishPurple
chatImageColor: purple chatImageColor: purple
@ -87,6 +92,7 @@ themes:
messageFromMeTextColor: font # mainTextColor messageFromMeTextColor: font # mainTextColor
messageFromOtherBackgroundColor: peerBubble # purple messageFromOtherBackgroundColor: peerBubble # purple
messageFromOtherTextColor: font # darkPurple messageFromOtherTextColor: font # darkPurple
messageSelectionColor: 0x80FF80
portraitBackgroundColor: softPurple portraitBackgroundColor: softPurple
portraitBlockedBorderColor: softGrey portraitBlockedBorderColor: softGrey
portraitBlockedTextColor: softGrey portraitBlockedTextColor: softGrey
@ -94,6 +100,8 @@ themes:
portraitContactBadgeTextColor: whitePurple portraitContactBadgeTextColor: whitePurple
portraitOfflineBorderColor: greyPurple portraitOfflineBorderColor: greyPurple
portraitOnlineBorderColor: greyPurple portraitOnlineBorderColor: greyPurple
portraitOnlineAwayColor: 0xFFFFF59D
portraitOnlineBusyColor: 0xFFEF9A9A
portraitProfileBadgeColor: accent portraitProfileBadgeColor: accent
portraitProfileBadgeTextColor: whitePurple portraitProfileBadgeTextColor: whitePurple
scrollbarDefaultColor: accent scrollbarDefaultColor: accent
@ -103,6 +111,10 @@ themes:
textfieldBorderColor: purple textfieldBorderColor: purple
textfieldErrorColor: hotPink textfieldErrorColor: hotPink
textfieldHintColor: font textfieldHintColor: font
textfieldSelectionColor: accent
toolbarIconColor: settings # darkPurple toolbarIconColor: settings # darkPurple
topbarColor: header # softPurple topbarColor: header # softPurple
menuBackgroundColor: accent;
snackbarBackgroundColor: accent
snackbarTextColor: whitePurple
chatImageColor: purple chatImageColor: purple

View File

@ -63,6 +63,7 @@ class CwtchDark extends OpaqueThemeType {
get messageFromMeTextColor => font; //whiteishPurple; get messageFromMeTextColor => font; //whiteishPurple;
get messageFromOtherBackgroundColor => peerBubble; //deepPurple; get messageFromOtherBackgroundColor => peerBubble; //deepPurple;
get messageFromOtherTextColor => font; //whiteishPurple; get messageFromOtherTextColor => font; //whiteishPurple;
get messageSelectionColor => accent;
get portraitBackgroundColor => deepPurple; get portraitBackgroundColor => deepPurple;
get portraitBlockedBorderColor => lightGrey; get portraitBlockedBorderColor => lightGrey;
get portraitBlockedTextColor => lightGrey; get portraitBlockedTextColor => lightGrey;
@ -70,6 +71,8 @@ class CwtchDark extends OpaqueThemeType {
get portraitContactBadgeTextColor => whiteishPurple; get portraitContactBadgeTextColor => whiteishPurple;
get portraitOfflineBorderColor => purple; get portraitOfflineBorderColor => purple;
get portraitOnlineBorderColor => whiteishPurple; get portraitOnlineBorderColor => whiteishPurple;
get portraitOnlineAwayColor => Color(0xFFFFF59D);
get portraitOnlineBusyColor => Color(0xFFEF9A9A);
get portraitProfileBadgeColor => hotPink; get portraitProfileBadgeColor => hotPink;
get portraitProfileBadgeTextColor => whiteishPurple; get portraitProfileBadgeTextColor => whiteishPurple;
get scrollbarDefaultColor => purple; get scrollbarDefaultColor => purple;
@ -79,8 +82,11 @@ class CwtchDark extends OpaqueThemeType {
get textfieldBorderColor => deepPurple; get textfieldBorderColor => deepPurple;
get textfieldErrorColor => hotPink; get textfieldErrorColor => hotPink;
get textfieldHintColor => mainTextColor; get textfieldHintColor => mainTextColor;
get textfieldSelectionColor => accent;
get toolbarIconColor => settings; //whiteishPurple; get toolbarIconColor => settings; //whiteishPurple;
get topbarColor => header; //darkGreyPurple; get topbarColor => header; //darkGreyPurple;
get menuBackgroundColor => accent;
get menuTextColor => darkGreyPurple;
get snackbarBackgroundColor => accent; get snackbarBackgroundColor => accent;
get snackbarTextColor => whitePurple; get snackbarTextColor => whitePurple;
get chatImageColor => purple; get chatImageColor => purple;
@ -111,6 +117,7 @@ class CwtchLight extends OpaqueThemeType {
get messageFromMeTextColor => font; //mainTextColor; get messageFromMeTextColor => font; //mainTextColor;
get messageFromOtherBackgroundColor => peerBubble; //purple; get messageFromOtherBackgroundColor => peerBubble; //purple;
get messageFromOtherTextColor => font; //darkPurple; get messageFromOtherTextColor => font; //darkPurple;
get messageSelectionColor => accent;
get portraitBackgroundColor => softPurple; get portraitBackgroundColor => softPurple;
get portraitBlockedBorderColor => softGrey; get portraitBlockedBorderColor => softGrey;
get portraitBlockedTextColor => softGrey; get portraitBlockedTextColor => softGrey;
@ -118,6 +125,8 @@ class CwtchLight extends OpaqueThemeType {
get portraitContactBadgeTextColor => whitePurple; get portraitContactBadgeTextColor => whitePurple;
get portraitOfflineBorderColor => greyPurple; get portraitOfflineBorderColor => greyPurple;
get portraitOnlineBorderColor => greyPurple; get portraitOnlineBorderColor => greyPurple;
get portraitOnlineAwayColor => Color(0xFFFFF59D);
get portraitOnlineBusyColor => Color(0xFFEF9A9A);
get portraitProfileBadgeColor => accent; get portraitProfileBadgeColor => accent;
get portraitProfileBadgeTextColor => whitePurple; get portraitProfileBadgeTextColor => whitePurple;
get scrollbarDefaultColor => accent; get scrollbarDefaultColor => accent;
@ -127,8 +136,11 @@ class CwtchLight extends OpaqueThemeType {
get textfieldBorderColor => purple; get textfieldBorderColor => purple;
get textfieldErrorColor => hotPink; get textfieldErrorColor => hotPink;
get textfieldHintColor => font; get textfieldHintColor => font;
get textfieldSelectionColor => accent;
get toolbarIconColor => settings; //darkPurple; get toolbarIconColor => settings; //darkPurple;
get topbarColor => header; //softPurple; get topbarColor => header; //softPurple;
get menuBackgroundColor => accent;
get menuTextColor => whitePurple;
get snackbarBackgroundColor => accent; get snackbarBackgroundColor => accent;
get snackbarTextColor => whitePurple; get snackbarTextColor => whitePurple;
get chatImageColor => purple; get chatImageColor => purple;

View File

@ -99,6 +99,7 @@ abstract class OpaqueThemeType {
get textfieldBorderColor => red; get textfieldBorderColor => red;
get textfieldHintColor => red; get textfieldHintColor => red;
get textfieldErrorColor => red; get textfieldErrorColor => red;
get textfieldSelectionColor => red;
get scrollbarDefaultColor => red; get scrollbarDefaultColor => red;
get portraitBackgroundColor => red; get portraitBackgroundColor => red;
get portraitOnlineBorderColor => red; get portraitOnlineBorderColor => red;
@ -123,6 +124,9 @@ abstract class OpaqueThemeType {
get messageFromMeTextColor => red; get messageFromMeTextColor => red;
get messageFromOtherBackgroundColor => red; get messageFromOtherBackgroundColor => red;
get messageFromOtherTextColor => red; get messageFromOtherTextColor => red;
get messageSelectionColor => red;
get menuBackgroundColor => red;
get snackbarBackgroundColor => red; get snackbarBackgroundColor => red;
get snackbarTextColor => red; get snackbarTextColor => red;
@ -142,11 +146,33 @@ abstract class OpaqueThemeType {
} }
} }
// Borrowed from Stackoverflow
MaterialColor getMaterialColor(Color color) {
final int red = color.red;
final int green = color.green;
final int blue = color.blue;
final Map<int, Color> shades = {
50: Color.fromRGBO(red, green, blue, .1),
100: Color.fromRGBO(red, green, blue, .2),
200: Color.fromRGBO(red, green, blue, .3),
300: Color.fromRGBO(red, green, blue, .4),
400: Color.fromRGBO(red, green, blue, .5),
500: Color.fromRGBO(red, green, blue, .6),
600: Color.fromRGBO(red, green, blue, .7),
700: Color.fromRGBO(red, green, blue, .8),
800: Color.fromRGBO(red, green, blue, .9),
900: Color.fromRGBO(red, green, blue, 1),
};
return MaterialColor(color.value, shades);
}
ThemeData mkThemeData(Settings opaque) { ThemeData mkThemeData(Settings opaque) {
return ThemeData( return ThemeData(
hoverColor: opaque.current().backgroundHilightElementColor.withOpacity(0.5), hoverColor: opaque.current().backgroundHilightElementColor.withOpacity(0.5),
visualDensity: VisualDensity.adaptivePlatformDensity, visualDensity: VisualDensity.adaptivePlatformDensity,
primarySwatch: Colors.red, primarySwatch: getMaterialColor(opaque.current().topbarColor),
primaryIconTheme: IconThemeData( primaryIconTheme: IconThemeData(
color: opaque.current().mainTextColor, color: opaque.current().mainTextColor,
), ),
@ -249,7 +275,7 @@ ThemeData mkThemeData(Settings opaque) {
enableFeedback: true, enableFeedback: true,
splashColor: opaque.current().defaultButtonActiveColor), splashColor: opaque.current().defaultButtonActiveColor),
textSelectionTheme: TextSelectionThemeData( textSelectionTheme: TextSelectionThemeData(
cursorColor: opaque.current().defaultButtonActiveColor, selectionColor: opaque.current().defaultButtonActiveColor, selectionHandleColor: opaque.current().defaultButtonActiveColor), cursorColor: opaque.current().textfieldSelectionColor, selectionColor: opaque.current().textfieldSelectionColor, selectionHandleColor: opaque.current().textfieldSelectionColor),
popupMenuTheme: PopupMenuThemeData( popupMenuTheme: PopupMenuThemeData(
color: opaque.current().backgroundPaneColor.withOpacity(0.9), color: opaque.current().backgroundPaneColor.withOpacity(0.9),
), ),

View File

@ -175,6 +175,7 @@ class YmlTheme extends OpaqueThemeType {
get textfieldBorderColor => getColor("textfieldBorderColor") ?? fallbackTheme.textfieldBorderColor; get textfieldBorderColor => getColor("textfieldBorderColor") ?? fallbackTheme.textfieldBorderColor;
get textfieldHintColor => getColor("textfieldHintColor") ?? fallbackTheme.textfieldHintColor; get textfieldHintColor => getColor("textfieldHintColor") ?? fallbackTheme.textfieldHintColor;
get textfieldErrorColor => getColor("textfieldErrorColor") ?? fallbackTheme.textfieldErrorColor; get textfieldErrorColor => getColor("textfieldErrorColor") ?? fallbackTheme.textfieldErrorColor;
get textfieldSelectionColor => getColor("textfieldSelectionColor") ?? fallbackTheme.textfieldSelectionColor;
get scrollbarDefaultColor => getColor("scrollbarDefaultColor") ?? fallbackTheme.scrollbarDefaultColor; get scrollbarDefaultColor => getColor("scrollbarDefaultColor") ?? fallbackTheme.scrollbarDefaultColor;
get portraitBackgroundColor => getColor("portraitBackgroundColor") ?? fallbackTheme.portraitBackgroundColor; get portraitBackgroundColor => getColor("portraitBackgroundColor") ?? fallbackTheme.portraitBackgroundColor;
get portraitOnlineBorderColor => getColor("portraitOnlineBorderColor") ?? fallbackTheme.portraitOnlineBorderColor; get portraitOnlineBorderColor => getColor("portraitOnlineBorderColor") ?? fallbackTheme.portraitOnlineBorderColor;
@ -185,8 +186,8 @@ class YmlTheme extends OpaqueThemeType {
get portraitContactBadgeTextColor => getColor("portraitContactBadgeTextColor") ?? fallbackTheme.portraitContactBadgeTextColor; get portraitContactBadgeTextColor => getColor("portraitContactBadgeTextColor") ?? fallbackTheme.portraitContactBadgeTextColor;
get portraitProfileBadgeColor => getColor("portraitProfileBadgeColor") ?? fallbackTheme.portraitProfileBadgeColor; get portraitProfileBadgeColor => getColor("portraitProfileBadgeColor") ?? fallbackTheme.portraitProfileBadgeColor;
get portraitProfileBadgeTextColor => getColor("portraitProfileBadgeTextColor") ?? fallbackTheme.portraitProfileBadgeTextColor; get portraitProfileBadgeTextColor => getColor("portraitProfileBadgeTextColor") ?? fallbackTheme.portraitProfileBadgeTextColor;
get portraitOnlineAwayColor => Color(0xFFFFF59D) ?? fallbackTheme.portraitOnlineAwayColor; get portraitOnlineAwayColor => getColor("portraitOnlineAwayColor") ?? fallbackTheme.portraitOnlineAwayColor;
get portraitOnlineBusyColor => Color(0xFFEF9A9A) ?? fallbackTheme.portraitOnlineBusyColor; get portraitOnlineBusyColor => getColor("portraitOnlineBusyColor") ?? fallbackTheme.portraitOnlineBusyColor;
get dropShadowColor => getColor("dropShadowColor") ?? fallbackTheme.dropShadowColor; get dropShadowColor => getColor("dropShadowColor") ?? fallbackTheme.dropShadowColor;
get toolbarIconColor => getColor("toolbarIconColor") ?? fallbackTheme.toolbarIconColor; get toolbarIconColor => getColor("toolbarIconColor") ?? fallbackTheme.toolbarIconColor;
get chatReactionIconColor => getColor("chatReactionIconColor") ?? fallbackTheme.chatReactionIconColor; get chatReactionIconColor => getColor("chatReactionIconColor") ?? fallbackTheme.chatReactionIconColor;
@ -194,6 +195,8 @@ class YmlTheme extends OpaqueThemeType {
get messageFromMeTextColor => getColor("messageFromMeTextColor") ?? fallbackTheme.messageFromMeTextColor; get messageFromMeTextColor => getColor("messageFromMeTextColor") ?? fallbackTheme.messageFromMeTextColor;
get messageFromOtherBackgroundColor => getColor("messageFromOtherBackgroundColor") ?? fallbackTheme.messageFromOtherBackgroundColor; get messageFromOtherBackgroundColor => getColor("messageFromOtherBackgroundColor") ?? fallbackTheme.messageFromOtherBackgroundColor;
get messageFromOtherTextColor => getColor("messageFromOtherTextColor") ?? fallbackTheme.messageFromOtherTextColor; get messageFromOtherTextColor => getColor("messageFromOtherTextColor") ?? fallbackTheme.messageFromOtherTextColor;
get messageSelectionColor => getColor("messageSelectionColor") ?? fallbackTheme.messageSelectionColor;
get menuBackgroundColor => getColor("menuBackgroundColor") ?? fallbackTheme.menuBackgroundColor;
get snackbarBackgroundColor => getColor("snackbarBackgroundColor") ?? fallbackTheme.snackbarBackgroundColor; get snackbarBackgroundColor => getColor("snackbarBackgroundColor") ?? fallbackTheme.snackbarBackgroundColor;
get snackbarTextColor => getColor("snackbarTextColor") ?? fallbackTheme.snackbarTextColor; get snackbarTextColor => getColor("snackbarTextColor") ?? fallbackTheme.snackbarTextColor;

View File

@ -516,7 +516,9 @@ class _MessageViewState extends State<MessageView> {
height: 164 + ((Provider.of<ContactInfoState>(context).messageDraft.messageText.split("\n").length - 1) * 16), height: 164 + ((Provider.of<ContactInfoState>(context).messageDraft.messageText.split("\n").length - 1) * 16),
child: Column( child: Column(
children: [ children: [
Row(mainAxisAlignment: MainAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: [preview]), Container(
decoration: BoxDecoration(color: Provider.of<Settings>(context).theme.defaultButtonActiveColor),
child: Row(mainAxisAlignment: MainAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: [preview])),
Container( Container(
decoration: BoxDecoration(border: Border(top: BorderSide(color: Provider.of<Settings>(context).theme.defaultButtonActiveColor))), decoration: BoxDecoration(border: Border(top: BorderSide(color: Provider.of<Settings>(context).theme.defaultButtonActiveColor))),
child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [wdgMessage])), child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [wdgMessage])),

View File

@ -49,44 +49,51 @@ class _CwtchButtonTextFieldState extends State<CwtchButtonTextField> {
return Container( return Container(
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(), decoration: BoxDecoration(),
child: TextFormField( // Horrifying Hack: Flutter doesn't give us direct control over system menus but instead picks BG color from TextButtonThemeData ¯\_(ツ)_/¯
key: widget.testKey, child: Theme(
controller: widget.controller, data: Theme.of(context).copyWith(
readOnly: widget.readonly, textButtonTheme: TextButtonThemeData(
showCursor: !widget.readonly, style: ButtonStyle(backgroundColor: MaterialStateProperty.all(Provider.of<Settings>(context).theme.menuBackgroundColor)),
focusNode: _focusNode,
enableIMEPersonalizedLearning: false,
onChanged: widget.onChanged,
maxLines: 1,
style: widget.textStyle == null ? TextStyle(overflow: TextOverflow.clip) : widget.textStyle,
decoration: InputDecoration(
labelText: widget.labelText,
labelStyle: TextStyle(color: theme.current().mainTextColor, backgroundColor: theme.current().textfieldBackgroundColor),
suffixIcon: IconButton(
onPressed: widget.onPressed,
icon: widget.icon,
splashRadius: Material.defaultSplashRadius / 2,
padding: EdgeInsets.fromLTRB(0.0, 4.0, 2.0, 2.0),
tooltip: widget.tooltip,
enableFeedback: true,
color: theme.current().mainTextColor,
highlightColor: theme.current().defaultButtonColor,
focusColor: theme.current().defaultButtonActiveColor,
splashColor: theme.current().defaultButtonActiveColor,
), ),
floatingLabelBehavior: FloatingLabelBehavior.never, ),
filled: true, child: TextFormField(
fillColor: theme.current().textfieldBackgroundColor, key: widget.testKey,
focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(6.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor, width: 1.0)), controller: widget.controller,
focusedErrorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(6.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor, width: 1.0)), readOnly: widget.readonly,
errorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(6.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor, width: 1.0)), showCursor: !widget.readonly,
errorStyle: TextStyle( focusNode: _focusNode,
color: theme.current().textfieldErrorColor, enableIMEPersonalizedLearning: false,
fontWeight: FontWeight.bold, onChanged: widget.onChanged,
), maxLines: 1,
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), style: widget.textStyle == null ? TextStyle(overflow: TextOverflow.clip) : widget.textStyle,
enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(6.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor, width: 1.0))), decoration: InputDecoration(
)); labelText: widget.labelText,
labelStyle: TextStyle(color: theme.current().mainTextColor, backgroundColor: theme.current().textfieldBackgroundColor),
suffixIcon: IconButton(
onPressed: widget.onPressed,
icon: widget.icon,
splashRadius: Material.defaultSplashRadius / 2,
padding: EdgeInsets.fromLTRB(0.0, 4.0, 2.0, 2.0),
tooltip: widget.tooltip,
enableFeedback: true,
color: theme.current().mainTextColor,
highlightColor: theme.current().defaultButtonColor,
focusColor: theme.current().defaultButtonActiveColor,
splashColor: theme.current().defaultButtonActiveColor,
),
floatingLabelBehavior: FloatingLabelBehavior.never,
filled: true,
fillColor: theme.current().textfieldBackgroundColor,
focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(6.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor, width: 1.0)),
focusedErrorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(6.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor, width: 1.0)),
errorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(6.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor, width: 1.0)),
errorStyle: TextStyle(
color: theme.current().textfieldErrorColor,
fontWeight: FontWeight.bold,
),
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(6.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor, width: 1.0))),
)));
}); });
} }
} }

View File

@ -71,11 +71,23 @@ class MessageBubbleState extends State<MessageBubble> {
), ),
child: Padding( child: Padding(
padding: EdgeInsets.all(9.0), padding: EdgeInsets.all(9.0),
child: Column( child: Theme(
crossAxisAlignment: fromMe ? CrossAxisAlignment.end : CrossAxisAlignment.start, data: Theme.of(context).copyWith(
mainAxisAlignment: fromMe ? MainAxisAlignment.end : MainAxisAlignment.start, textSelectionTheme: TextSelectionThemeData(
mainAxisSize: MainAxisSize.min, cursorColor: Provider.of<Settings>(context).theme.messageSelectionColor,
children: fromMe ? [wdgMessage, wdgDecorations] : [wdgSender, wdgMessage, wdgDecorations]))))); selectionColor: Provider.of<Settings>(context).theme.messageSelectionColor,
selectionHandleColor: Provider.of<Settings>(context).theme.messageSelectionColor),
// Horrifying Hack: Flutter doesn't give us direct control over system menus but instead picks BG color from TextButtonThemeData ¯\_(ツ)_/¯
textButtonTheme: TextButtonThemeData(
style: ButtonStyle(backgroundColor: MaterialStateProperty.all(Provider.of<Settings>(context).theme.menuBackgroundColor)),
),
),
child: Column(
crossAxisAlignment: fromMe ? CrossAxisAlignment.end : CrossAxisAlignment.start,
mainAxisAlignment: fromMe ? MainAxisAlignment.end : MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: fromMe ? [wdgMessage, wdgDecorations] : [wdgSender, wdgMessage, wdgDecorations]))))));
}); });
} }
} }

View File

@ -38,45 +38,52 @@ class _CwtchPasswordTextFieldState extends State<CwtchPasswordField> {
} }
return Consumer<Settings>(builder: (context, theme, child) { return Consumer<Settings>(builder: (context, theme, child) {
return TextFormField( // Horrifying Hack: Flutter doesn't give us direct control over system menus but instead picks BG color from TextButtonThemeData ¯\_(ツ)_/¯
autofocus: widget.autofocus, return Theme(
controller: widget.controller, data: Theme.of(context).copyWith(
validator: widget.validator, textButtonTheme: TextButtonThemeData(
obscureText: obscureText, style: ButtonStyle(backgroundColor: MaterialStateProperty.all(Provider.of<Settings>(context).theme.menuBackgroundColor)),
obscuringCharacter: '*', ),
enableIMEPersonalizedLearning: false,
autofillHints: widget.autoFillHints,
autovalidateMode: AutovalidateMode.always,
onFieldSubmitted: widget.action,
enableSuggestions: false,
autocorrect: false,
decoration: InputDecoration(
suffixIcon: IconButton(
onPressed: () {
setState(() {
obscureText = !obscureText;
});
},
icon: Icon((obscureText ? CwtchIcons.eye_closed : CwtchIcons.eye_open), semanticLabel: label),
tooltip: label,
color: theme.current().mainTextColor,
highlightColor: theme.current().defaultButtonColor,
focusColor: theme.current().defaultButtonActiveColor,
splashColor: theme.current().defaultButtonActiveColor,
splashRadius: Material.defaultSplashRadius / 2,
), ),
errorStyle: TextStyle( child: TextFormField(
color: theme.current().textfieldErrorColor, autofocus: widget.autofocus,
fontWeight: FontWeight.bold, controller: widget.controller,
), validator: widget.validator,
focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(6.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor, width: 1.0)), obscureText: obscureText,
focusedErrorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(6.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor, width: 1.0)), obscuringCharacter: '*',
errorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(6.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor, width: 1.0)), enableIMEPersonalizedLearning: false,
filled: true, autofillHints: widget.autoFillHints,
fillColor: theme.current().textfieldBackgroundColor, autovalidateMode: AutovalidateMode.always,
enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(6.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor, width: 1.0)), onFieldSubmitted: widget.action,
), enableSuggestions: false,
); autocorrect: false,
decoration: InputDecoration(
suffixIcon: IconButton(
onPressed: () {
setState(() {
obscureText = !obscureText;
});
},
icon: Icon((obscureText ? CwtchIcons.eye_closed : CwtchIcons.eye_open), semanticLabel: label),
tooltip: label,
color: theme.current().mainTextColor,
highlightColor: theme.current().defaultButtonColor,
focusColor: theme.current().defaultButtonActiveColor,
splashColor: theme.current().defaultButtonActiveColor,
splashRadius: Material.defaultSplashRadius / 2,
),
errorStyle: TextStyle(
color: theme.current().textfieldErrorColor,
fontWeight: FontWeight.bold,
),
focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(6.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor, width: 1.0)),
focusedErrorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(6.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor, width: 1.0)),
errorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(6.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor, width: 1.0)),
filled: true,
fillColor: theme.current().textfieldBackgroundColor,
enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(6.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor, width: 1.0)),
),
));
}); });
} }
} }

View File

@ -47,39 +47,46 @@ class _CwtchTextFieldState extends State<CwtchTextField> {
return Container( return Container(
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(), decoration: BoxDecoration(),
child: TextFormField( // Horrifying Hack: Flutter doesn't give us direct control over system menus but instead picks BG color from TextButtonThemeData ¯\_(ツ)_/¯
key: widget.testKey, child: Theme(
controller: widget.controller, data: Theme.of(context).copyWith(
validator: widget.validator, textButtonTheme: TextButtonThemeData(
onChanged: widget.onChanged, style: ButtonStyle(backgroundColor: MaterialStateProperty.all(Provider.of<Settings>(context).theme.menuBackgroundColor)),
autofocus: widget.autofocus, ),
autovalidateMode: AutovalidateMode.onUserInteraction, ),
textAlign: widget.number ? TextAlign.end : TextAlign.start, child: TextFormField(
keyboardType: widget.multiLine key: widget.testKey,
? TextInputType.multiline controller: widget.controller,
: widget.number validator: widget.validator,
? TextInputType.number onChanged: widget.onChanged,
: TextInputType.text, autofocus: widget.autofocus,
inputFormatters: widget.number ? <TextInputFormatter>[FilteringTextInputFormatter.digitsOnly] : null, autovalidateMode: AutovalidateMode.onUserInteraction,
maxLines: widget.multiLine ? null : 1, textAlign: widget.number ? TextAlign.end : TextAlign.start,
scrollController: _scrollController, keyboardType: widget.multiLine
enableIMEPersonalizedLearning: false, ? TextInputType.multiline
focusNode: _focusNode, : widget.number
style: Provider.of<Settings>(context).scaleFonts(defaultTextStyle).copyWith(overflow: TextOverflow.clip), ? TextInputType.number
decoration: InputDecoration( : TextInputType.text,
errorMaxLines: 2, inputFormatters: widget.number ? <TextInputFormatter>[FilteringTextInputFormatter.digitsOnly] : null,
hintText: widget.hintText, maxLines: widget.multiLine ? null : 1,
hintStyle: TextStyle(color: (theme.current().mainTextColor as Color).withOpacity(0.5)), scrollController: _scrollController,
floatingLabelBehavior: FloatingLabelBehavior.never, enableIMEPersonalizedLearning: false,
filled: true, focusNode: _focusNode,
focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(6.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor, width: 1.0)), style: Provider.of<Settings>(context).scaleFonts(defaultTextStyle).copyWith(overflow: TextOverflow.clip),
focusedErrorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(6.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor, width: 1.0)), decoration: InputDecoration(
errorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(6.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor, width: 1.0)), errorMaxLines: 2,
errorStyle: TextStyle(color: theme.current().textfieldErrorColor, fontWeight: FontWeight.bold, overflow: TextOverflow.visible), hintText: widget.hintText,
fillColor: theme.current().textfieldBackgroundColor, hintStyle: TextStyle(color: (theme.current().mainTextColor as Color).withOpacity(0.5)),
contentPadding: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 5.0), floatingLabelBehavior: FloatingLabelBehavior.never,
enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(6.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor, width: 1.0))), filled: true,
)); focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(6.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor, width: 1.0)),
focusedErrorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(6.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor, width: 1.0)),
errorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(6.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor, width: 1.0)),
errorStyle: TextStyle(color: theme.current().textfieldErrorColor, fontWeight: FontWeight.bold, overflow: TextOverflow.visible),
fillColor: theme.current().textfieldBackgroundColor,
contentPadding: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 5.0),
enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(6.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor, width: 1.0))),
)));
}); });
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB