forked from gskinnerTeam/flutter-folio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstyles.dart
110 lines (96 loc) · 4.74 KB
/
styles.dart
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
/// //////////////////////////////////////////////////////////////
/// Styles - Contains the design system for the entire app.
/// Includes paddings, text styles, timings etc. Does not include colors, check [AppTheme] file for that.
/// Used for all animations in the app
class Times {
static const Duration fastest = const Duration(milliseconds: 150);
static const fast = const Duration(milliseconds: 250);
static const medium = const Duration(milliseconds: 350);
static const slow = const Duration(milliseconds: 700);
static const slower = const Duration(milliseconds: 1000);
}
class Sizes {
static double hitScale = 1;
static double get hit => 40 * hitScale;
}
class IconSizes {
static const double scale = 1;
static const double med = 24;
}
class Insets {
static double scale = 1;
static double offsetScale = 1;
// Regular paddings
static double get xs => 4 * scale;
static double get sm => 8 * scale;
static double get med => 12 * scale;
static double get lg => 16 * scale;
static double get xl => 32 * scale;
// Offset, used for the edge of the window, or to separate large sections in the app
static double get offset => 40 * offsetScale;
}
class Corners {
static const double sm = 3;
static const BorderRadius smBorder = const BorderRadius.all(smRadius);
static const Radius smRadius = const Radius.circular(sm);
static const double med = 5;
static const BorderRadius medBorder = const BorderRadius.all(medRadius);
static const Radius medRadius = const Radius.circular(med);
static const double lg = 8;
static const BorderRadius lgBorder = const BorderRadius.all(lgRadius);
static const Radius lgRadius = const Radius.circular(lg);
}
class Strokes {
static const double thin = 1;
static const double thick = 4;
}
class Shadows {
static List<BoxShadow> get universal => [
BoxShadow(color: Color(0xff333333).withOpacity(.15), spreadRadius: 0, blurRadius: 10),
];
static List<BoxShadow> get small => [
BoxShadow(color: Color(0xff333333).withOpacity(.15), spreadRadius: 0, blurRadius: 3, offset: Offset(0, 1)),
];
}
/// Font Sizes
/// You can use these directly if you need, but usually there should be a predefined style in TextStyles.
class FontSizes {
/// Provides the ability to nudge the app-wide font scale in either direction
static double get scale => 1;
static double get s10 => 10 * scale;
static double get s11 => 11 * scale;
static double get s12 => 12 * scale;
static double get s14 => 14 * scale;
static double get s16 => 16 * scale;
static double get s24 => 24 * scale;
static double get s48 => 48 * scale;
}
/// Fonts - A list of Font Families, this is uses by the TextStyles class to create concrete styles.
class Fonts {
static const String raleway = "Raleway";
static const String fraunces = "Fraunces";
}
/// TextStyles - All the core text styles for the app should be declared here.
/// Don't try and create every variant in existence here, just the high level ones.
/// More specific variants can be created on the fly using `style.copyWith()`
/// `newStyle = TextStyles.body1.copyWith(lineHeight: 2, color: Colors.red)`
class TextStyles {
/// Declare a base style for each Family
static const TextStyle raleway = const TextStyle(fontFamily: Fonts.raleway, fontWeight: FontWeight.w400, height: 1);
static const TextStyle fraunces = const TextStyle(fontFamily: Fonts.fraunces, fontWeight: FontWeight.w400, height: 1);
static TextStyle get h1 =>
fraunces.copyWith(fontWeight: FontWeight.w600, fontSize: FontSizes.s48, letterSpacing: -1, height: 1.17);
static TextStyle get h2 => h1.copyWith(fontSize: FontSizes.s24, letterSpacing: -.5, height: 1.16);
static TextStyle get h3 => h1.copyWith(fontSize: FontSizes.s14, letterSpacing: -.05, height: 1.29);
static TextStyle get title1 => raleway.copyWith(fontWeight: FontWeight.bold, fontSize: FontSizes.s16, height: 1.31);
static TextStyle get title2 => title1.copyWith(fontWeight: FontWeight.w500, fontSize: FontSizes.s14, height: 1.36);
static TextStyle get body1 => raleway.copyWith(fontWeight: FontWeight.normal, fontSize: FontSizes.s14, height: 1.71);
static TextStyle get body2 => body1.copyWith(fontSize: FontSizes.s12, height: 1.5, letterSpacing: .2);
static TextStyle get body3 => body1.copyWith(fontSize: FontSizes.s12, height: 1.5, fontWeight: FontWeight.bold);
static TextStyle get callout1 =>
raleway.copyWith(fontWeight: FontWeight.w800, fontSize: FontSizes.s12, height: 1.17, letterSpacing: .5);
static TextStyle get callout2 => callout1.copyWith(fontSize: FontSizes.s10, height: 1, letterSpacing: .25);
static TextStyle get caption => raleway.copyWith(fontWeight: FontWeight.w500, fontSize: FontSizes.s11, height: 1.36);
}