Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added dynamic theme handling for search icons in records tab #311

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading