Skip to content

An open-source cross-platform alternative to AirDrop

feat: improve general theming

Tien Do Nam8955a6ae1767
diff --git a/lib/pages/tabs/settings_tab.dart b/lib/pages/tabs/settings_tab.dart
index ce9fc7dc..d8465e0a 100644
--- a/lib/pages/tabs/settings_tab.dart
+++ b/lib/pages/tabs/settings_tab.dart
@@ -495,19 +495,31 @@ class _BooleanEntry extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ final theme = Theme.of(context);
return _SettingsEntry(
label: label,
- child: Row(
+ child: Stack(
children: [
- const SizedBox(width: 35),
- Text(
- value ? t.general.on : t.general.off,
- style: const TextStyle(fontSize: 16),
+ Container(
+ width: double.infinity,
+ height: 50,
+ decoration: BoxDecoration(
+ color: theme.inputDecorationTheme.fillColor,
+ borderRadius: theme.inputDecorationTheme.borderRadius,
+ ),
),
- const SizedBox(width: 10),
- Switch(
- value: value,
- onChanged: onChanged,
+ Positioned.fill(
+ child: Center(
+ child: Switch(
+ value: value,
+ onChanged: onChanged,
+ activeTrackColor: Colors.white,
+ activeColor: theme.brightness == Brightness.light ? theme.colorScheme.onSurface.withOpacity(0.8) : theme.inputDecorationTheme.fillColor,
+ trackOutlineColor: const MaterialStatePropertyAll<Color?>(Colors.grey),
+ inactiveThumbColor: theme.colorScheme.onSurface.withOpacity(0.8),
+ inactiveTrackColor: theme.inputDecorationTheme.fillColor,
+ ),
+ ),
),
],
),
diff --git a/lib/theme.dart b/lib/theme.dart
index bff9d255..90bdc8e6 100644
--- a/lib/theme.dart
+++ b/lib/theme.dart
@@ -6,16 +6,9 @@ import 'package:localsend_app/util/native/platform_check.dart';
final _borderRadius = BorderRadius.circular(5);
ThemeData getTheme(Brightness brightness, ColorScheme? colorScheme) {
- colorScheme ??= ColorScheme.fromSwatch(
- primarySwatch: Colors.teal,
+ colorScheme ??= ColorScheme.fromSeed(
+ seedColor: Colors.teal,
brightness: brightness,
- backgroundColor: brightness == Brightness.light ? Colors.white : Colors.grey.shade900,
- ).copyWith(
- // overrides for LocalSend theme
- onError: Colors.white,
- secondaryContainer:
- 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,
);
final lightInputBorder = OutlineInputBorder(