@@ -6,21 +6,24 @@ import 'package:flutter/material.dart';
6
6
import 'color_x.dart' ;
7
7
import 'theme_data_x.dart' ;
8
8
9
+ bool get _isMobile =>
10
+ ! kIsWeb && (Platform .isAndroid || Platform .isIOS || Platform .isFuchsia);
11
+
9
12
typedef ThemePair = ({ThemeData lightTheme, ThemeData darkTheme});
10
13
11
14
const _lightBase = Colors .white;
12
15
final _darkBase = Colors .black.scale (lightness: 0.09 );
13
16
final _darkMenuBase = Colors .black.scale (lightness: 0.07 );
14
17
const _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 ;
18
21
final _kButtonRadius = _kButtonHeight / 2 ;
19
22
const _kMenuRadius = 8.0 ;
20
23
const _kInputDecorationRadius = 6.0 ;
21
24
const _kDesktopIconSize = 20.0 ;
22
25
const _kMobileIconSize = 24.0 ;
23
- final _iconSize = isMobile ? _kMobileIconSize : _kDesktopIconSize;
26
+ final _iconSize = _isMobile ? _kMobileIconSize : _kDesktopIconSize;
24
27
25
28
ThemePair phoenixTheme ({
26
29
required Color color,
@@ -246,7 +249,7 @@ SliderThemeData _sliderTheme(ColorScheme colorScheme) {
246
249
247
250
InputDecorationTheme _inputDecorationTheme (ColorScheme colorScheme) {
248
251
return InputDecorationTheme (
249
- isDense: isDesktop ? true : false ,
252
+ isDense: _isMobile ? false : true ,
250
253
filled: true ,
251
254
fillColor: colorScheme.surface
252
255
.scale (lightness: colorScheme.isLight ? - 0.07 : 0.03 ),
@@ -445,8 +448,9 @@ IconButtonThemeData _iconButtonTheme({
445
448
return IconButtonThemeData (
446
449
style: IconButton .styleFrom (
447
450
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
450
454
? VisualDensity .compact
451
455
: null ,
452
456
).copyWith (
@@ -514,9 +518,3 @@ SnackBarThemeData _snackBarThemeData(ColorScheme colorScheme) {
514
518
),
515
519
);
516
520
}
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