From 6ec920e17ea71427a63765bbb1078aa3c3944bfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Pedersen?= Date: Mon, 23 Sep 2024 21:54:09 +0200 Subject: [PATCH] Added dynamic theme handling for search icons in records tab (#311) * Added dynamic theme handling for search icons in records tab * Bump v0.8.6+42 --- lib/core/search_delegate.dart | 7 +++++-- lib/widgets/records.dart | 7 ++++--- pubspec.yaml | 2 +- 3 files changed, 10 insertions(+), 6 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, ), ], diff --git a/pubspec.yaml b/pubspec.yaml index 541db0a..2cf71f4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 0.8.5+41 +version: 0.8.6+42 environment: sdk: '>=3.4.3 <4.0.0'