ente/lib/theme/text_style.dart

204 lines
5.5 KiB
Dart
Raw Normal View History

2022-09-22 09:02:52 +00:00
import 'package:flutter/material.dart';
2022-09-23 09:04:15 +00:00
import 'package:photos/theme/colors.dart';
2022-09-22 09:02:52 +00:00
2022-09-23 09:04:15 +00:00
const FontWeight _regularWeight = FontWeight.w500;
const FontWeight _boldWeight = FontWeight.w600;
const String _fontFamily = 'Inter';
2022-09-22 09:02:52 +00:00
const TextStyle brandStyleSmall = TextStyle(
fontWeight: FontWeight.bold,
fontFamily: 'Montserrat',
fontSize: 21,
);
const TextStyle brandStyleMedium = TextStyle(
fontWeight: FontWeight.bold,
fontFamily: 'Montserrat',
fontSize: 24,
);
const TextStyle h1 = TextStyle(
fontSize: 48,
height: 48 / 28,
2022-09-23 09:04:15 +00:00
fontWeight: _regularWeight,
fontFamily: _fontFamily,
);
const TextStyle h2 = TextStyle(
fontSize: 32,
height: 39 / 32.0,
2022-09-23 09:04:15 +00:00
fontWeight: _regularWeight,
fontFamily: _fontFamily,
);
const TextStyle h3 = TextStyle(
fontSize: 24,
height: 29 / 24.0,
2022-09-23 09:04:15 +00:00
fontWeight: _regularWeight,
fontFamily: _fontFamily,
);
const TextStyle large = TextStyle(
fontSize: 18,
height: 22 / 18.0,
2022-09-23 09:04:15 +00:00
fontWeight: _regularWeight,
fontFamily: _fontFamily,
);
const TextStyle body = TextStyle(
fontSize: 16,
2022-10-28 07:49:55 +00:00
height: 20 / 16.0,
2022-09-23 09:04:15 +00:00
fontWeight: _regularWeight,
fontFamily: _fontFamily,
);
const TextStyle small = TextStyle(
fontSize: 14,
height: 17 / 14.0,
2022-09-23 09:04:15 +00:00
fontWeight: _regularWeight,
fontFamily: _fontFamily,
);
const TextStyle mini = TextStyle(
fontSize: 12,
height: 15 / 12.0,
2022-09-23 09:04:15 +00:00
fontWeight: _regularWeight,
fontFamily: _fontFamily,
);
const TextStyle tiny = TextStyle(
fontSize: 10,
height: 12 / 10.0,
2022-09-23 09:04:15 +00:00
fontWeight: _regularWeight,
fontFamily: _fontFamily,
);
2022-09-23 09:04:15 +00:00
class EnteTextTheme {
final TextStyle h1;
final TextStyle h1Bold;
final TextStyle h2;
final TextStyle h2Bold;
final TextStyle h3;
final TextStyle h3Bold;
final TextStyle large;
final TextStyle largeBold;
final TextStyle body;
final TextStyle bodyBold;
final TextStyle small;
final TextStyle smallBold;
final TextStyle mini;
final TextStyle miniBold;
final TextStyle tiny;
final TextStyle tinyBold;
final TextStyle brandSmall;
final TextStyle brandMedium;
// textMuted variants
final TextStyle h1Muted;
final TextStyle h2Muted;
final TextStyle h3Muted;
final TextStyle largeMuted;
final TextStyle bodyMuted;
final TextStyle smallMuted;
final TextStyle miniMuted;
2023-06-13 14:43:52 +00:00
final TextStyle miniBoldMuted;
final TextStyle tinyMuted;
// textFaint variants
final TextStyle h1Faint;
final TextStyle h2Faint;
final TextStyle h3Faint;
final TextStyle largeFaint;
final TextStyle bodyFaint;
final TextStyle smallFaint;
final TextStyle miniFaint;
final TextStyle tinyFaint;
2022-09-23 09:04:15 +00:00
const EnteTextTheme({
required this.h1,
required this.h1Bold,
required this.h2,
required this.h2Bold,
required this.h3,
required this.h3Bold,
required this.large,
required this.largeBold,
required this.body,
required this.bodyBold,
required this.small,
required this.smallBold,
required this.mini,
required this.miniBold,
required this.tiny,
required this.tinyBold,
required this.brandSmall,
required this.brandMedium,
required this.h1Muted,
required this.h2Muted,
required this.h3Muted,
required this.largeMuted,
required this.bodyMuted,
required this.smallMuted,
required this.miniMuted,
2023-06-13 14:43:52 +00:00
required this.miniBoldMuted,
required this.tinyMuted,
required this.h1Faint,
required this.h2Faint,
required this.h3Faint,
required this.largeFaint,
required this.bodyFaint,
required this.smallFaint,
required this.miniFaint,
required this.tinyFaint,
});
}
EnteTextTheme lightTextTheme = _buildEnteTextStyle(
textBaseLight,
textMutedLight,
textFaintLight,
);
EnteTextTheme darkTextTheme = _buildEnteTextStyle(
textBaseDark,
textMutedDark,
textFaintDark,
);
EnteTextTheme _buildEnteTextStyle(
Color color,
Color textMuted,
Color textFaint,
) {
2022-09-23 09:04:15 +00:00
return EnteTextTheme(
h1: h1.copyWith(color: color),
2022-09-23 09:04:15 +00:00
h1Bold: h1.copyWith(color: color, fontWeight: _boldWeight),
h2: h2.copyWith(color: color),
2022-09-23 09:04:15 +00:00
h2Bold: h2.copyWith(color: color, fontWeight: _boldWeight),
h3: h3.copyWith(color: color),
2022-09-23 09:04:15 +00:00
h3Bold: h3.copyWith(color: color, fontWeight: _boldWeight),
large: large.copyWith(color: color),
2022-09-23 09:04:15 +00:00
largeBold: large.copyWith(color: color, fontWeight: _boldWeight),
body: body.copyWith(color: color),
2022-09-23 09:04:15 +00:00
bodyBold: body.copyWith(color: color, fontWeight: _boldWeight),
small: small.copyWith(color: color),
2022-09-23 09:04:15 +00:00
smallBold: small.copyWith(color: color, fontWeight: _boldWeight),
mini: mini.copyWith(color: color),
2022-09-23 09:04:15 +00:00
miniBold: mini.copyWith(color: color, fontWeight: _boldWeight),
tiny: tiny.copyWith(color: color),
2022-09-23 09:04:15 +00:00
tinyBold: tiny.copyWith(color: color, fontWeight: _boldWeight),
brandSmall: brandStyleSmall.copyWith(color: color),
brandMedium: brandStyleMedium.copyWith(color: color),
h1Muted: h1.copyWith(color: textMuted),
h2Muted: h2.copyWith(color: textMuted),
h3Muted: h3.copyWith(color: textMuted),
largeMuted: large.copyWith(color: textMuted),
bodyMuted: body.copyWith(color: textMuted),
smallMuted: small.copyWith(color: textMuted),
miniMuted: mini.copyWith(color: textMuted),
2023-06-13 14:43:52 +00:00
miniBoldMuted: mini.copyWith(color: textMuted, fontWeight: _boldWeight),
tinyMuted: tiny.copyWith(color: textMuted),
h1Faint: h1.copyWith(color: textFaint),
h2Faint: h2.copyWith(color: textFaint),
h3Faint: h3.copyWith(color: textFaint),
largeFaint: large.copyWith(color: textFaint),
bodyFaint: body.copyWith(color: textFaint),
smallFaint: small.copyWith(color: textFaint),
miniFaint: mini.copyWith(color: textFaint),
tinyFaint: tiny.copyWith(color: textFaint),
);
}