@@ -6,21 +6,24 @@ import 'package:flutter/material.dart';
66import 'color_x.dart' ;
77import 'theme_data_x.dart' ;
88
9+ bool get _isMobile =>
10+ ! kIsWeb && (Platform .isAndroid || Platform .isIOS || Platform .isFuchsia);
11+
912typedef ThemePair = ({ThemeData lightTheme, ThemeData darkTheme});
1013
1114const _lightBase = Colors .white;
1215final _darkBase = Colors .black.scale (lightness: 0.09 );
1316final _darkMenuBase = Colors .black.scale (lightness: 0.07 );
1417const _kContainerRadius = 10.0 ;
15- const kDesktopButtonHeight = 42.0 ;
16- const kMobileButtonHeight = 48.0 ;
17- final _kButtonHeight = isDesktop ? kDesktopButtonHeight : kMobileButtonHeight ;
18+ const _kDesktopButtonHeight = 42.0 ;
19+ const _kMobileButtonHeight = 48.0 ;
20+ final _kButtonHeight = _isMobile ? _kMobileButtonHeight : _kDesktopButtonHeight ;
1821final _kButtonRadius = _kButtonHeight / 2 ;
1922const _kMenuRadius = 8.0 ;
2023const _kInputDecorationRadius = 6.0 ;
2124const _kDesktopIconSize = 20.0 ;
2225const _kMobileIconSize = 24.0 ;
23- final _iconSize = isMobile ? _kMobileIconSize : _kDesktopIconSize;
26+ final _iconSize = _isMobile ? _kMobileIconSize : _kDesktopIconSize;
2427
2528ThemePair phoenixTheme ({
2629 required Color color,
@@ -246,7 +249,7 @@ SliderThemeData _sliderTheme(ColorScheme colorScheme) {
246249
247250InputDecorationTheme _inputDecorationTheme (ColorScheme colorScheme) {
248251 return InputDecorationTheme (
249- isDense: isDesktop ? true : false ,
252+ isDense: _isMobile ? false : true ,
250253 filled: true ,
251254 fillColor: colorScheme.surface
252255 .scale (lightness: colorScheme.isLight ? - 0.07 : 0.03 ),
@@ -445,8 +448,9 @@ IconButtonThemeData _iconButtonTheme({
445448 return IconButtonThemeData (
446449 style: IconButton .styleFrom (
447450 minimumSize: buttonSize,
448- padding: buttonSize.height < kMobileButtonHeight ? EdgeInsets .zero : null ,
449- visualDensity: buttonSize.height < kMobileButtonHeight
451+ padding:
452+ buttonSize.height < _kMobileButtonHeight ? EdgeInsets .zero : null ,
453+ visualDensity: buttonSize.height < _kMobileButtonHeight
450454 ? VisualDensity .compact
451455 : null ,
452456 ).copyWith (
@@ -514,9 +518,3 @@ SnackBarThemeData _snackBarThemeData(ColorScheme colorScheme) {
514518 ),
515519 );
516520}
517-
518- bool get isMobile =>
519- ! kIsWeb && (Platform .isAndroid || Platform .isIOS || Platform .isFuchsia);
520-
521- bool get isDesktop =>
522- ! kIsWeb && (Platform .isLinux || Platform .isMacOS || Platform .isWindows);
0 commit comments