Skip to content

Commit

Permalink
Text inputs: change cursor and icon color to onSurface (#229)
Browse files Browse the repository at this point in the history
* Text inputs: change cursor color to onSurface

* Change inputs icon color to onSurface
  • Loading branch information
Feichtmeier committed Nov 28, 2022
1 parent ca522c0 commit 90b7552
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
8 changes: 8 additions & 0 deletions example/lib/view/inputs_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ class InputsView extends StatelessWidget {
const TextField(
autofocus: true,
decoration: InputDecoration(
prefix: Padding(
padding: EdgeInsets.only(right: 5),
child: Icon(
Icons.text_fields,
size: 16,
),
),
prefixIconConstraints: BoxConstraints(minHeight: 100),
hintText: 'Awesome Textfield',
labelText: 'All TextFields have a border in Yaru',
),
Expand Down
21 changes: 12 additions & 9 deletions lib/src/themes/common_themes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,19 @@ AppBarTheme _createDarkAppBarTheme(ColorScheme colorScheme) {
);
}

// TextField
final inputDecorationTheme = InputDecorationTheme(
border:
OutlineInputBorder(borderRadius: BorderRadius.circular(kButtonRadius)),
isDense: true,
);
InputDecorationTheme _createInputDecorationTheme(ColorScheme colorScheme) {
return InputDecorationTheme(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(kButtonRadius),
),
isDense: true,
iconColor: colorScheme.onSurface,
);
}

TextSelectionThemeData _createTextSelectionTheme(ColorScheme colorScheme) {
return TextSelectionThemeData(
cursorColor: colorScheme.primary,
cursorColor: colorScheme.onSurface,
selectionColor: colorScheme.primary.withOpacity(0.40),
);
}
Expand Down Expand Up @@ -293,7 +296,7 @@ ThemeData createYaruLightTheme({
selectedItemColor: colorScheme.primary,
unselectedItemColor: colorScheme.onSurface.withOpacity(0.8),
),
inputDecorationTheme: inputDecorationTheme,
inputDecorationTheme: _createInputDecorationTheme(colorScheme),
toggleButtonsTheme: _createToggleButtonsTheme(colorScheme),
textSelectionTheme: _createTextSelectionTheme(colorScheme),
popupMenuTheme: _createPopupMenuThemeData(colorScheme, Brightness.light),
Expand Down Expand Up @@ -343,7 +346,7 @@ ThemeData createYaruDarkTheme({
selectedItemColor: colorScheme.primary,
unselectedItemColor: Colors.white.withOpacity(0.8),
),
inputDecorationTheme: inputDecorationTheme,
inputDecorationTheme: _createInputDecorationTheme(colorScheme),
toggleButtonsTheme: _createToggleButtonsTheme(colorScheme),
textSelectionTheme: _createTextSelectionTheme(colorScheme),
popupMenuTheme: _createPopupMenuThemeData(colorScheme, Brightness.dark),
Expand Down

0 comments on commit 90b7552

Please sign in to comment.