From 15e1f3763052b174277e772a9445ab8d3e31cad4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Pedersen?= Date: Mon, 23 Sep 2024 21:52:24 +0200 Subject: [PATCH] Added dynamic theme handling for search icons in records tab --- lib/core/search_delegate.dart | 7 +++++-- lib/widgets/records.dart | 7 ++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/core/search_delegate.dart b/lib/core/search_delegate.dart index c479f95..b22c57e 100644 --- a/lib/core/search_delegate.dart +++ b/lib/core/search_delegate.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'theme.dart'; class ExerciseSearchDelegate extends SearchDelegate { final List> records; @@ -13,9 +14,10 @@ class ExerciseSearchDelegate extends SearchDelegate { @override List buildActions(BuildContext context) { + final ThemeData theme = Theme.of(context); return [ IconButton( - icon: Icon(Icons.clear), + icon: Icon(Icons.clear, color: theme.iconTheme.color), onPressed: () { query = ''; }, @@ -25,8 +27,9 @@ class ExerciseSearchDelegate extends SearchDelegate { @override Widget buildLeading(BuildContext context) { + final ThemeData theme = Theme.of(context); return IconButton( - icon: Icon(Icons.arrow_back), + icon: Icon(Icons.arrow_back, color: theme.iconTheme.color), onPressed: () { close(context, null); }, diff --git a/lib/widgets/records.dart b/lib/widgets/records.dart index 24ab490..afbebdb 100644 --- a/lib/widgets/records.dart +++ b/lib/widgets/records.dart @@ -133,6 +133,7 @@ class _RecordsTabState extends State { final isDarkMode = Theme.of(context).brightness == Brightness.dark; final arrowColor = isDarkMode ? Colors.purple : null; final textColor = isDarkMode ? Colors.white : Colors.black; + final ThemeData theme = Theme.of(context); return Scaffold( appBar: AppBar( @@ -151,14 +152,14 @@ class _RecordsTabState extends State { : Text('Records'), leading: _isSearching ? IconButton( - icon: Icon(Icons.arrow_back), + icon: Icon(Icons.arrow_back, color: theme.iconTheme.color), onPressed: _stopSearch, ) : null, actions: _isSearching ? [ IconButton( - icon: Icon(Icons.clear), + icon: Icon(Icons.clear, color: theme.iconTheme.color), onPressed: () { _searchController.clear(); _filterRecords(''); @@ -167,7 +168,7 @@ class _RecordsTabState extends State { ] : [ IconButton( - icon: Icon(Icons.search), + icon: Icon(Icons.search, color: theme.iconTheme.color), onPressed: _startSearch, ), ],