blob: d952d79d8a0e5894ae3f69e17324726c8eb48466 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
import 'package:flutter/material.dart';
class LayoutSizeHelper {
Size _size;
double _ratio;
LayoutSizeHelper(context)
: _size = MediaQuery.of(context).size,
//_ratio = MediaQuery.of(context).devicePixelRatio;
_ratio = 9 / 16;
update(context) {
_size = MediaQuery.of(context).size;
_ratio = MediaQuery.of(context).devicePixelRatio;
}
get defaultIconSize {
if (_size.height <= 480 || _size.width <= 600) {
return 64.0 * _ratio;
} else if (_size.height <= 900 || _size.width <= 840) {
return 96.0 * _ratio;
} else {
return 128.0 * _ratio;
}
}
get defaultButtonHeight {
return defaultIconSize;
}
get defaultButtonWidth {
return defaultButtonHeight * 3.0;
}
get defaultPadding {
return defaultIconSize / 8.0;
}
get defaultBorder {
return defaultIconSize / 16;
}
get baseFontSize {
return (defaultIconSize / 3.0).floor().toDouble();
}
get largeIconSize {
return 1.5 * defaultIconSize;
}
get largePadding {
return largeIconSize / 4.0;
}
}
|