refactor: enhance search field styling in ChatsDrawer
- Wrapped the TextField in a Material widget to improve styling and ensure proper background handling. - Added TextDecoration.none to various text styles to remove underlines, enhancing visual consistency. - Updated the search field's input decoration for better alignment with the app's theme and design standards.
This commit is contained in:
@@ -178,63 +178,66 @@ class _ChatsDrawerState extends ConsumerState<ChatsDrawer> {
|
|||||||
|
|
||||||
Widget _buildSearchField(BuildContext context) {
|
Widget _buildSearchField(BuildContext context) {
|
||||||
final theme = context.conduitTheme;
|
final theme = context.conduitTheme;
|
||||||
return TextField(
|
return Material(
|
||||||
controller: _searchController,
|
color: Colors.transparent,
|
||||||
focusNode: _searchFocusNode,
|
child: TextField(
|
||||||
onChanged: (_) => _onSearchChanged(),
|
controller: _searchController,
|
||||||
style: AppTypography.standard.copyWith(color: theme.inputText),
|
focusNode: _searchFocusNode,
|
||||||
decoration: InputDecoration(
|
onChanged: (_) => _onSearchChanged(),
|
||||||
isDense: true,
|
style: AppTypography.standard.copyWith(color: theme.inputText),
|
||||||
hintText: AppLocalizations.of(context)!.searchConversations,
|
decoration: InputDecoration(
|
||||||
hintStyle: AppTypography.standard.copyWith(
|
isDense: true,
|
||||||
color: theme.inputPlaceholder,
|
hintText: AppLocalizations.of(context)!.searchConversations,
|
||||||
),
|
hintStyle: AppTypography.standard.copyWith(
|
||||||
prefixIcon: Icon(
|
color: theme.inputPlaceholder,
|
||||||
Platform.isIOS ? CupertinoIcons.search : Icons.search,
|
),
|
||||||
color: theme.iconSecondary,
|
prefixIcon: Icon(
|
||||||
size: IconSize.input,
|
Platform.isIOS ? CupertinoIcons.search : Icons.search,
|
||||||
),
|
color: theme.iconSecondary,
|
||||||
prefixIconConstraints: const BoxConstraints(
|
size: IconSize.input,
|
||||||
minWidth: TouchTarget.minimum,
|
),
|
||||||
minHeight: TouchTarget.minimum,
|
prefixIconConstraints: const BoxConstraints(
|
||||||
),
|
minWidth: TouchTarget.minimum,
|
||||||
suffixIcon: _query.isNotEmpty
|
minHeight: TouchTarget.minimum,
|
||||||
? IconButton(
|
),
|
||||||
onPressed: () {
|
suffixIcon: _query.isNotEmpty
|
||||||
_searchController.clear();
|
? IconButton(
|
||||||
setState(() => _query = '');
|
onPressed: () {
|
||||||
_searchFocusNode.unfocus();
|
_searchController.clear();
|
||||||
},
|
setState(() => _query = '');
|
||||||
icon: Icon(
|
_searchFocusNode.unfocus();
|
||||||
Platform.isIOS
|
},
|
||||||
? CupertinoIcons.clear_circled_solid
|
icon: Icon(
|
||||||
: Icons.clear,
|
Platform.isIOS
|
||||||
color: theme.iconSecondary,
|
? CupertinoIcons.clear_circled_solid
|
||||||
size: IconSize.input,
|
: Icons.clear,
|
||||||
),
|
color: theme.iconSecondary,
|
||||||
)
|
size: IconSize.input,
|
||||||
: null,
|
),
|
||||||
suffixIconConstraints: const BoxConstraints(
|
)
|
||||||
minWidth: TouchTarget.minimum,
|
: null,
|
||||||
minHeight: TouchTarget.minimum,
|
suffixIconConstraints: const BoxConstraints(
|
||||||
),
|
minWidth: TouchTarget.minimum,
|
||||||
filled: true,
|
minHeight: TouchTarget.minimum,
|
||||||
fillColor: theme.inputBackground,
|
),
|
||||||
border: OutlineInputBorder(
|
filled: true,
|
||||||
borderRadius: BorderRadius.circular(AppBorderRadius.md),
|
fillColor: theme.inputBackground,
|
||||||
borderSide: BorderSide.none,
|
border: OutlineInputBorder(
|
||||||
),
|
borderRadius: BorderRadius.circular(AppBorderRadius.md),
|
||||||
enabledBorder: OutlineInputBorder(
|
borderSide: BorderSide.none,
|
||||||
borderRadius: BorderRadius.circular(AppBorderRadius.md),
|
),
|
||||||
borderSide: BorderSide(color: theme.inputBorder, width: 1),
|
enabledBorder: OutlineInputBorder(
|
||||||
),
|
borderRadius: BorderRadius.circular(AppBorderRadius.md),
|
||||||
focusedBorder: OutlineInputBorder(
|
borderSide: BorderSide(color: theme.inputBorder, width: 1),
|
||||||
borderRadius: BorderRadius.circular(AppBorderRadius.md),
|
),
|
||||||
borderSide: BorderSide(color: theme.buttonPrimary, width: 1),
|
focusedBorder: OutlineInputBorder(
|
||||||
),
|
borderRadius: BorderRadius.circular(AppBorderRadius.md),
|
||||||
contentPadding: const EdgeInsets.symmetric(
|
borderSide: BorderSide(color: theme.buttonPrimary, width: 1),
|
||||||
horizontal: Spacing.md,
|
),
|
||||||
vertical: Spacing.xs,
|
contentPadding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: Spacing.md,
|
||||||
|
vertical: Spacing.xs,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -687,6 +690,7 @@ class _ChatsDrawerState extends ConsumerState<ChatsDrawer> {
|
|||||||
style: AppTypography.labelStyle.copyWith(
|
style: AppTypography.labelStyle.copyWith(
|
||||||
color: theme.textSecondary,
|
color: theme.textSecondary,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
|
decoration: TextDecoration.none,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: Spacing.xs),
|
const SizedBox(width: Spacing.xs),
|
||||||
@@ -702,7 +706,10 @@ class _ChatsDrawerState extends ConsumerState<ChatsDrawer> {
|
|||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
'$count',
|
'$count',
|
||||||
style: AppTypography.tiny.copyWith(color: theme.textSecondary),
|
style: AppTypography.tiny.copyWith(
|
||||||
|
color: theme.textSecondary,
|
||||||
|
decoration: TextDecoration.none,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -716,7 +723,10 @@ class _ChatsDrawerState extends ConsumerState<ChatsDrawer> {
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
AppLocalizations.of(context)!.folders,
|
AppLocalizations.of(context)!.folders,
|
||||||
style: AppTypography.labelStyle.copyWith(color: theme.textSecondary),
|
style: AppTypography.labelStyle.copyWith(
|
||||||
|
color: theme.textSecondary,
|
||||||
|
decoration: TextDecoration.none,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
IconButton(
|
IconButton(
|
||||||
@@ -1489,6 +1499,7 @@ class _ChatsDrawerState extends ConsumerState<ChatsDrawer> {
|
|||||||
style: AppTypography.bodySmallStyle.copyWith(
|
style: AppTypography.bodySmallStyle.copyWith(
|
||||||
color: theme.textPrimary,
|
color: theme.textPrimary,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
|
decoration: TextDecoration.none,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user