Skip to content

An open-source cross-platform alternative to AirDrop

feat: optimize colors

Tien Do Nam4e3e85f70c04
diff --git a/lib/pages/receive_history_page.dart b/lib/pages/receive_history_page.dart
index 6be7ef5f..53f44e10 100644
--- a/lib/pages/receive_history_page.dart
+++ b/lib/pages/receive_history_page.dart
@@ -64,6 +64,10 @@ class ReceiveHistoryPage extends ConsumerWidget {
children: [
const SizedBox(width: 15),
ElevatedButton.icon(
+ style: ElevatedButton.styleFrom(
+ backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
+ foregroundColor: Theme.of(context).colorScheme.onSecondaryContainer,
+ ),
onPressed: checkPlatform([TargetPlatform.iOS])
? null
: () async {
@@ -75,6 +79,10 @@ 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,
+ ),
onPressed: entries.isEmpty ? null : () async => ref.read(receiveHistoryProvider.notifier).removeAll(),
icon: const Icon(Icons.delete),
label: Text(t.receiveHistoryPage.deleteHistory),
diff --git a/lib/pages/receive_page.dart b/lib/pages/receive_page.dart
index 6a4f54af..8101532f 100644
--- a/lib/pages/receive_page.dart
+++ b/lib/pages/receive_page.dart
@@ -117,14 +117,16 @@ class _ReceivePageState extends ConsumerState<ReceivePage> {
setState(() => _showFullIp = !_showFullIp);
},
child: DeviceBadge(
- color: Theme.of(context).colorScheme.onSecondaryContainer,
+ backgroundColor: Theme.of(context).colorScheme.onSecondaryContainer,
+ foregroundColor: Theme.of(context).colorScheme.onInverseSurface,
label: _showFullIp ? receiveSession.sender.ip : '#${receiveSession.sender.ip.visualId}',
),
),
if (receiveSession.sender.deviceModel != null) ...[
const SizedBox(width: 10),
DeviceBadge(
- color: Theme.of(context).colorScheme.onSecondaryContainer,
+ backgroundColor: Theme.of(context).colorScheme.onSecondaryContainer,
+ foregroundColor: Theme.of(context).colorScheme.onInverseSurface,
label: receiveSession.sender.deviceModel!,
),
],
diff --git a/lib/pages/tabs/send_tab.dart b/lib/pages/tabs/send_tab.dart
index 29ad73f2..a7144ed7 100644
--- a/lib/pages/tabs/send_tab.dart
+++ b/lib/pages/tabs/send_tab.dart
@@ -274,7 +274,7 @@ class _SendTabState extends ConsumerState<SendTab> {
}),
const SizedBox(height: 10),
Center(
- child: ElevatedButton(
+ child: TextButton(
onPressed: () async {
await context.push(() => const TroubleshootPage());
},
diff --git a/lib/pages/web_send_page.dart b/lib/pages/web_send_page.dart
index ad478b45..baadd7f9 100644
--- a/lib/pages/web_send_page.dart
+++ b/lib/pages/web_send_page.dart
@@ -122,6 +122,7 @@ class _WebSendPageState extends ConsumerState<WebSendPage> {
Text(t.webSharePage.openLink(n: networkState.localIps.length), style: Theme.of(context).textTheme.titleMedium),
const SizedBox(height: 10),
Card(
+ color: Theme.of(context).colorScheme.secondaryContainer,
child: Padding(
padding: const EdgeInsets.all(10),
child: Column(
diff --git a/lib/theme.dart b/lib/theme.dart
index ee36de06..57378a73 100644
--- a/lib/theme.dart
+++ b/lib/theme.dart
@@ -14,7 +14,7 @@ ThemeData getTheme(Brightness brightness, ColorScheme? colorScheme) {
// overrides for LocalSend theme
onError: Colors.white,
secondaryContainer:
- brightness == Brightness.light ? Color.lerp(Colors.teal.shade100, Colors.white, 0.2) : Color.lerp(Colors.teal.shade100, Colors.black, 0.6),
+ brightness == Brightness.light ? Color.lerp(Colors.teal.shade100, Colors.white, 0.5) : Color.lerp(Colors.teal.shade100, Colors.black, 0.6),
onSecondaryContainer: brightness == Brightness.light ? Colors.black : Colors.white,
);
diff --git a/lib/widget/big_button.dart b/lib/widget/big_button.dart
index 9d0d2497..b66a7ded 100644
--- a/lib/widget/big_button.dart
+++ b/lib/widget/big_button.dart
@@ -15,6 +15,7 @@ class BigButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ final colorScheme = Theme.of(context).colorScheme;
return ConstrainedBox(
constraints: const BoxConstraints(
maxWidth: 90,
@@ -23,8 +24,8 @@ class BigButton extends StatelessWidget {
),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
- backgroundColor: filled ? Theme.of(context).colorScheme.primary : null,
- foregroundColor: filled ? Theme.of(context).colorScheme.onPrimary : null,
+ backgroundColor: filled ? colorScheme.primary : colorScheme.secondaryContainer,
+ foregroundColor: filled ? colorScheme.onPrimary : colorScheme.onSecondaryContainer,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
diff --git a/lib/widget/device_bage.dart b/lib/widget/device_bage.dart
index c51f8922..a3ee94e9 100644
--- a/lib/widget/device_bage.dart
+++ b/lib/widget/device_bage.dart
@@ -1,20 +1,25 @@
import 'package:flutter/material.dart';
class DeviceBadge extends StatelessWidget {
- final Color color;
+ final Color backgroundColor;
+ final Color foregroundColor;
final String label;
- const DeviceBadge({required this.color, required this.label});
+ const DeviceBadge({
+ required this.backgroundColor,
+ required this.foregroundColor,
+ required this.label,
+ });
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
- color: color,
+ color: backgroundColor,
borderRadius: BorderRadius.circular(5),
),
- child: Text(label, style: TextStyle(color: Theme.of(context).colorScheme.onInverseSurface)),
+ child: Text(label, style: TextStyle(color: foregroundColor)),
);
}
}
diff --git a/lib/widget/list_tile/custom_list_tile.dart b/lib/widget/list_tile/custom_list_tile.dart
index 891fa1dd..ca6fe3ce 100644
--- a/lib/widget/list_tile/custom_list_tile.dart
+++ b/lib/widget/list_tile/custom_list_tile.dart
@@ -24,6 +24,7 @@ class CustomListTile extends StatelessWidget {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
+ color: Theme.of(context).colorScheme.secondaryContainer,
child: InkWell(
onTap: onTap,
borderRadius: BorderRadius.circular(10),
diff --git a/lib/widget/list_tile/device_list_tile.dart b/lib/widget/list_tile/device_list_tile.dart
index c51766ce..3818278f 100644
--- a/lib/widget/list_tile/device_list_tile.dart
+++ b/lib/widget/list_tile/device_list_tile.dart
@@ -15,6 +15,7 @@ class DeviceListTile extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ final badgeColor = Color.lerp(Theme.of(context).colorScheme.secondaryContainer, Colors.white, 0.3)!;
return CustomListTile(
icon: Icon(device.deviceType.icon, size: 46),
title: Text(device.alias, style: const TextStyle(fontSize: 20)),
@@ -31,12 +32,14 @@ class DeviceListTile extends StatelessWidget {
)
else ...[
DeviceBadge(
- color: Theme.of(context).colorScheme.onSecondaryContainer,
+ backgroundColor: badgeColor,
+ foregroundColor: Theme.of(context).colorScheme.onSecondaryContainer,
label: '#${device.ip.visualId}',
),
if (device.deviceModel != null)
DeviceBadge(
- color: Theme.of(context).colorScheme.onSecondaryContainer,
+ backgroundColor: badgeColor,
+ foregroundColor: Theme.of(context).colorScheme.onSecondaryContainer,
label: device.deviceModel!,
),
],
diff --git a/lib/widget/list_tile/device_placeholder_list_tile.dart b/lib/widget/list_tile/device_placeholder_list_tile.dart
index 44a2b20d..f6bd57ee 100644
--- a/lib/widget/list_tile/device_placeholder_list_tile.dart
+++ b/lib/widget/list_tile/device_placeholder_list_tile.dart
@@ -29,11 +29,13 @@ class DevicePlaceholderListTile extends StatelessWidget {
spacing: 10,
children: [
DeviceBadge(
- color: Theme.of(context).colorScheme.onSecondaryContainer.withOpacity(0.5),
+ backgroundColor: Theme.of(context).colorScheme.onSecondaryContainer.withOpacity(0.5),
+ foregroundColor: Colors.transparent,
label: ' ',
),
DeviceBadge(
- color: Theme.of(context).colorScheme.onSecondaryContainer.withOpacity(0.5),
+ backgroundColor: Theme.of(context).colorScheme.onSecondaryContainer.withOpacity(0.5),
+ foregroundColor: Colors.transparent,
label: ' ',
),
],