Skip to content

Commit

Permalink
Added dynamic theme handling for search icons in records tab (#311)
Browse files Browse the repository at this point in the history
* Added dynamic theme handling for search icons in records tab

* Bump v0.8.6+42
  • Loading branch information
andreped authored Sep 23, 2024
1 parent d2da557 commit 6ec920e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
7 changes: 5 additions & 2 deletions lib/core/search_delegate.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'theme.dart';

class ExerciseSearchDelegate extends SearchDelegate {
final List<Map<String, dynamic>> records;
Expand All @@ -13,9 +14,10 @@ class ExerciseSearchDelegate extends SearchDelegate {

@override
List<Widget> 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 = '';
},
Expand All @@ -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);
},
Expand Down
7 changes: 4 additions & 3 deletions lib/widgets/records.dart
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ class _RecordsTabState extends State<RecordsTab> {
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(
Expand All @@ -151,14 +152,14 @@ class _RecordsTabState extends State<RecordsTab> {
: 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('');
Expand All @@ -167,7 +168,7 @@ class _RecordsTabState extends State<RecordsTab> {
]
: [
IconButton(
icon: Icon(Icons.search),
icon: Icon(Icons.search, color: theme.iconTheme.color),
onPressed: _startSearch,
),
],
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 6ec920e

Please sign in to comment.