Skip to content

An open-source cross-platform alternative to AirDrop

feat: optimize color for light mode

Tien Do Namc63da302c309
diff --git a/lib/pages/receive_history_page.dart b/lib/pages/receive_history_page.dart
index 53f44e10..1b3935e8 100644
--- a/lib/pages/receive_history_page.dart
+++ b/lib/pages/receive_history_page.dart
@@ -4,6 +4,7 @@ import 'package:localsend_app/gen/strings.g.dart';
import 'package:localsend_app/model/receive_history_entry.dart';
import 'package:localsend_app/provider/receive_history_provider.dart';
import 'package:localsend_app/provider/settings_provider.dart';
+import 'package:localsend_app/theme.dart';
import 'package:localsend_app/util/file_size_helper.dart';
import 'package:localsend_app/util/native/get_destination_directory.dart';
import 'package:localsend_app/util/native/open_file.dart';
@@ -65,8 +66,8 @@ class ReceiveHistoryPage extends ConsumerWidget {
const SizedBox(width: 15),
ElevatedButton.icon(
style: ElevatedButton.styleFrom(
- backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
- foregroundColor: Theme.of(context).colorScheme.onSecondaryContainer,
+ backgroundColor: Theme.of(context).colorScheme.secondaryContainerIfDark,
+ foregroundColor: Theme.of(context).colorScheme.onSecondaryContainerIfDark,
),
onPressed: checkPlatform([TargetPlatform.iOS])
? null
@@ -80,8 +81,8 @@ class ReceiveHistoryPage extends ConsumerWidget {
const SizedBox(width: 20),
ElevatedButton.icon(
style: ElevatedButton.styleFrom(
- backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
- foregroundColor: Theme.of(context).colorScheme.onSecondaryContainer,
+ backgroundColor: Theme.of(context).colorScheme.secondaryContainerIfDark,
+ foregroundColor: Theme.of(context).colorScheme.onSecondaryContainerIfDark,
),
onPressed: entries.isEmpty ? null : () async => ref.read(receiveHistoryProvider.notifier).removeAll(),
icon: const Icon(Icons.delete),
diff --git a/lib/theme.dart b/lib/theme.dart
index 57378a73..bff9d255 100644
--- a/lib/theme.dart
+++ b/lib/theme.dart
@@ -111,6 +111,14 @@ extension ColorSchemeExt on ColorScheme {
Color get warning {
return Colors.orange;
}
+
+ Color? get secondaryContainerIfDark {
+ return brightness == Brightness.dark ? secondaryContainer : null;
+ }
+
+ Color? get onSecondaryContainerIfDark {
+ return brightness == Brightness.dark ? onSecondaryContainer : null;
+ }
}
extension InputDecorationThemeExt on InputDecorationTheme {
diff --git a/lib/widget/big_button.dart b/lib/widget/big_button.dart
index b66a7ded..256ce5b5 100644
--- a/lib/widget/big_button.dart
+++ b/lib/widget/big_button.dart
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
+import 'package:localsend_app/theme.dart';
class BigButton extends StatelessWidget {
final IconData icon;
@@ -24,8 +25,8 @@ class BigButton extends StatelessWidget {
),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
- backgroundColor: filled ? colorScheme.primary : colorScheme.secondaryContainer,
- foregroundColor: filled ? colorScheme.onPrimary : colorScheme.onSecondaryContainer,
+ backgroundColor: filled ? colorScheme.primary : colorScheme.secondaryContainerIfDark,
+ foregroundColor: filled ? colorScheme.onPrimary : colorScheme.onSecondaryContainerIfDark,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
diff --git a/lib/widget/list_tile/custom_list_tile.dart b/lib/widget/list_tile/custom_list_tile.dart
index ca6fe3ce..8a5d3bb6 100644
--- a/lib/widget/list_tile/custom_list_tile.dart
+++ b/lib/widget/list_tile/custom_list_tile.dart
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
+import 'package:localsend_app/theme.dart';
class CustomListTile extends StatelessWidget {
final Widget? icon;
@@ -24,7 +25,7 @@ class CustomListTile extends StatelessWidget {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
- color: Theme.of(context).colorScheme.secondaryContainer,
+ color: Theme.of(context).colorScheme.secondaryContainerIfDark,
child: InkWell(
onTap: onTap,
borderRadius: BorderRadius.circular(10),