mirror of
https://github.com/localsend/localsend.git
synced 2026-08-07 07:14:52 +00:00
feat: improve desktop padding style
This commit is contained in:
@@ -10,9 +10,6 @@ import 'package:yaru/yaru.dart' as yaru;
|
||||
|
||||
final _borderRadius = BorderRadius.circular(5);
|
||||
|
||||
/// On desktop, we need to add additional padding to achieve the same visual appearance as on mobile
|
||||
double get desktopPaddingFix => checkPlatformIsDesktop() ? 8 : 0;
|
||||
|
||||
ThemeData getTheme(ColorMode colorMode, Brightness brightness, DynamicColors? dynamicColors) {
|
||||
if (colorMode == ColorMode.yaru) {
|
||||
return _getYaruTheme(brightness);
|
||||
@@ -55,6 +52,8 @@ ThemeData getTheme(ColorMode colorMode, Brightness brightness, DynamicColors? dy
|
||||
return ThemeData(
|
||||
colorScheme: colorScheme,
|
||||
useMaterial3: true,
|
||||
// same density on all platforms so desktop matches mobile (defaults to compact on desktop)
|
||||
visualDensity: VisualDensity.standard,
|
||||
navigationBarTheme: colorScheme.brightness == Brightness.dark
|
||||
? NavigationBarThemeData(
|
||||
iconTheme: WidgetStateProperty.all(const IconThemeData(color: Colors.white)),
|
||||
@@ -71,12 +70,12 @@ ThemeData getTheme(ColorMode colorMode, Brightness brightness, DynamicColors? dy
|
||||
elevatedButtonTheme: ElevatedButtonThemeData(
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor: colorScheme.brightness == Brightness.dark ? Colors.white : null,
|
||||
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8 + desktopPaddingFix),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
),
|
||||
),
|
||||
textButtonTheme: TextButtonThemeData(
|
||||
style: TextButton.styleFrom(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8 + desktopPaddingFix),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
),
|
||||
),
|
||||
fontFamily: fontFamily,
|
||||
@@ -176,6 +175,8 @@ ThemeData _getYaruTheme(Brightness brightness) {
|
||||
InputDecorationThemeData;
|
||||
|
||||
return baseTheme.copyWith(
|
||||
// same density on all platforms so desktop matches mobile (defaults to compact on desktop)
|
||||
visualDensity: VisualDensity.standard,
|
||||
navigationBarTheme: colorScheme.brightness == Brightness.dark
|
||||
? NavigationBarThemeData(
|
||||
iconTheme: WidgetStateProperty.all(const IconThemeData(color: Colors.white)),
|
||||
@@ -192,12 +193,12 @@ ThemeData _getYaruTheme(Brightness brightness) {
|
||||
elevatedButtonTheme: ElevatedButtonThemeData(
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor: colorScheme.brightness == Brightness.dark ? Colors.white : null,
|
||||
padding: checkPlatformIsDesktop() ? const EdgeInsets.all(16) : const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
),
|
||||
),
|
||||
textButtonTheme: TextButtonThemeData(
|
||||
style: TextButton.styleFrom(
|
||||
padding: checkPlatformIsDesktop() ? const EdgeInsets.all(16) : const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -33,7 +33,7 @@ class BigButton extends StatelessWidget {
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
padding: EdgeInsets.only(left: 2, right: 2, top: 10 + desktopPaddingFix, bottom: 8 + desktopPaddingFix),
|
||||
padding: const EdgeInsets.only(left: 2, right: 2, top: 10, bottom: 8),
|
||||
),
|
||||
onPressed: onTap,
|
||||
child: Column(
|
||||
|
||||
Reference in New Issue
Block a user