first commit
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:sign_checker/theme/tokens.dart';
|
||||
|
||||
TextStyle _sf(TextStyle style, {Color? color}) {
|
||||
return GoogleFonts.inter(textStyle: style, color: color);
|
||||
}
|
||||
|
||||
CupertinoTextThemeData _textTheme() {
|
||||
return CupertinoTextThemeData(
|
||||
primaryColor: AppColors.accent,
|
||||
textStyle: _sf(AppTypography.body, color: AppColors.label),
|
||||
actionTextStyle: _sf(AppTypography.body, color: AppColors.accent),
|
||||
tabLabelTextStyle: _sf(
|
||||
AppTypography.caption2,
|
||||
color: AppColors.secondaryLabel,
|
||||
),
|
||||
navTitleTextStyle: _sf(AppTypography.headline, color: AppColors.label),
|
||||
navLargeTitleTextStyle: _sf(
|
||||
AppTypography.largeTitle,
|
||||
color: AppColors.label,
|
||||
),
|
||||
navActionTextStyle: _sf(AppTypography.body, color: AppColors.accent),
|
||||
);
|
||||
}
|
||||
|
||||
CupertinoThemeData buildLightTheme() => _buildTheme(Brightness.light);
|
||||
|
||||
CupertinoThemeData buildDarkTheme() => _buildTheme(Brightness.dark);
|
||||
|
||||
CupertinoThemeData _buildTheme(Brightness brightness) {
|
||||
return CupertinoThemeData(
|
||||
brightness: brightness,
|
||||
primaryColor: AppColors.accent,
|
||||
primaryContrastingColor: const Color(0xFFFFFFFF),
|
||||
scaffoldBackgroundColor: AppColors.groupedBackground,
|
||||
barBackgroundColor: AppColors.barBackground,
|
||||
applyThemeToAll: true,
|
||||
textTheme: _textTheme(),
|
||||
);
|
||||
}
|
||||
|
||||
SystemUiOverlayStyle systemUiOverlayFor(Brightness brightness) {
|
||||
final dark = brightness == Brightness.dark;
|
||||
return SystemUiOverlayStyle(
|
||||
statusBarColor: const Color(0x00000000),
|
||||
statusBarBrightness: brightness,
|
||||
statusBarIconBrightness: dark ? Brightness.light : Brightness.dark,
|
||||
systemNavigationBarColor: dark
|
||||
? const Color(0x00000000)
|
||||
: const Color(0x00FFFFFF),
|
||||
systemNavigationBarDividerColor: const Color(0x00000000),
|
||||
systemNavigationBarIconBrightness: dark ? Brightness.light : Brightness.dark,
|
||||
systemNavigationBarContrastEnforced: false,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export 'app_theme.dart';
|
||||
export 'tokens.dart';
|
||||
@@ -0,0 +1,181 @@
|
||||
/// Design tokens copied from the Please Pay Me iOS kit.
|
||||
///
|
||||
/// Spacing, type scale and grouped surfaces stay the same. The accent is blue
|
||||
/// so Sign Detector does not inherit that product's green brand.
|
||||
library;
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
abstract final class AppColors {
|
||||
static const accent = CupertinoDynamicColor.withBrightness(
|
||||
color: Color(0xFF0A64D8),
|
||||
darkColor: Color(0xFF4C9DFF),
|
||||
);
|
||||
|
||||
static const accentSoft = CupertinoDynamicColor.withBrightness(
|
||||
color: Color(0xFFE6F0FC),
|
||||
darkColor: Color(0xFF142033),
|
||||
);
|
||||
|
||||
static const systemRed = CupertinoDynamicColor.withBrightness(
|
||||
color: Color(0xFFFF3B30),
|
||||
darkColor: Color(0xFFFF453A),
|
||||
);
|
||||
static const systemOrange = CupertinoDynamicColor.withBrightness(
|
||||
color: Color(0xFFFF9500),
|
||||
darkColor: Color(0xFFFF9F0A),
|
||||
);
|
||||
static const systemGreen = CupertinoDynamicColor.withBrightness(
|
||||
color: Color(0xFF34C759),
|
||||
darkColor: Color(0xFF30D158),
|
||||
);
|
||||
static const systemGray = CupertinoDynamicColor.withBrightness(
|
||||
color: Color(0xFF8E8E93),
|
||||
darkColor: Color(0xFF8E8E93),
|
||||
);
|
||||
static const systemGray3 = CupertinoDynamicColor.withBrightness(
|
||||
color: Color(0xFFC7C7CC),
|
||||
darkColor: Color(0xFF48484A),
|
||||
);
|
||||
static const systemGray5 = CupertinoDynamicColor.withBrightness(
|
||||
color: Color(0xFFE5E5EA),
|
||||
darkColor: Color(0xFF2C2C2E),
|
||||
);
|
||||
static const systemGray6 = CupertinoDynamicColor.withBrightness(
|
||||
color: Color(0xFFF2F2F7),
|
||||
darkColor: Color(0xFF1C1C1E),
|
||||
);
|
||||
|
||||
static const label = CupertinoDynamicColor.withBrightness(
|
||||
color: Color(0xFF000000),
|
||||
darkColor: Color(0xFFFFFFFF),
|
||||
);
|
||||
static const secondaryLabel = CupertinoDynamicColor.withBrightness(
|
||||
color: Color(0x993C3C43),
|
||||
darkColor: Color(0x99EBEBF5),
|
||||
);
|
||||
static const tertiaryLabel = CupertinoDynamicColor.withBrightness(
|
||||
color: Color(0x4D3C3C43),
|
||||
darkColor: Color(0x4DEBEBF5),
|
||||
);
|
||||
|
||||
static const separator = CupertinoDynamicColor.withBrightness(
|
||||
color: Color(0x4A3C3C43),
|
||||
darkColor: Color(0xA6545458),
|
||||
);
|
||||
static const opaqueSeparator = CupertinoDynamicColor.withBrightness(
|
||||
color: Color(0xFFC6C6C8),
|
||||
darkColor: Color(0xFF38383A),
|
||||
);
|
||||
static const groupedBackground = CupertinoDynamicColor.withBrightness(
|
||||
color: Color(0xFFF2F2F7),
|
||||
darkColor: Color(0xFF000000),
|
||||
);
|
||||
static const groupedSurface = CupertinoDynamicColor.withBrightness(
|
||||
color: Color(0xFFFFFFFF),
|
||||
darkColor: Color(0xFF1C1C1E),
|
||||
);
|
||||
static const barBackground = CupertinoDynamicColor.withBrightness(
|
||||
color: Color(0xF0F9F9F9),
|
||||
darkColor: Color(0xF01D1D1D),
|
||||
);
|
||||
|
||||
static Color of(BuildContext context, Color color) =>
|
||||
CupertinoDynamicColor.resolve(color, context);
|
||||
}
|
||||
|
||||
abstract final class AppSpacing {
|
||||
static const double s1 = 4;
|
||||
static const double s2 = 8;
|
||||
static const double s3 = 12;
|
||||
static const double s4 = 16;
|
||||
static const double s5 = 20;
|
||||
static const double s6 = 28;
|
||||
static const double s7 = 40;
|
||||
static const double s8 = 56;
|
||||
static const double gutter = 16;
|
||||
}
|
||||
|
||||
abstract final class AppRadii {
|
||||
static const double sm = 6;
|
||||
static const double md = 10;
|
||||
static const double lg = 12;
|
||||
static const double xl = 16;
|
||||
static const double capsule = 999;
|
||||
}
|
||||
|
||||
abstract final class AppSizes {
|
||||
static const double buttonLarge = 50;
|
||||
static const double buttonMedium = 44;
|
||||
static const double buttonSmall = 34;
|
||||
static const double rowMinHeight = 44;
|
||||
static const double hairline = 0.5;
|
||||
}
|
||||
|
||||
abstract final class AppTypography {
|
||||
static const largeTitle = TextStyle(
|
||||
fontSize: 34,
|
||||
height: 1.2,
|
||||
fontWeight: FontWeight.w700,
|
||||
letterSpacing: 0.37,
|
||||
);
|
||||
static const title1 = TextStyle(
|
||||
fontSize: 28,
|
||||
height: 1.2,
|
||||
fontWeight: FontWeight.w700,
|
||||
letterSpacing: 0.36,
|
||||
);
|
||||
static const title2 = TextStyle(
|
||||
fontSize: 22,
|
||||
height: 1.25,
|
||||
fontWeight: FontWeight.w700,
|
||||
letterSpacing: 0.35,
|
||||
);
|
||||
static const title3 = TextStyle(
|
||||
fontSize: 20,
|
||||
height: 1.25,
|
||||
fontWeight: FontWeight.w600,
|
||||
letterSpacing: 0.38,
|
||||
);
|
||||
static const headline = TextStyle(
|
||||
fontSize: 17,
|
||||
height: 1.3,
|
||||
fontWeight: FontWeight.w600,
|
||||
letterSpacing: -0.41,
|
||||
);
|
||||
static const body = TextStyle(
|
||||
fontSize: 17,
|
||||
height: 1.3,
|
||||
fontWeight: FontWeight.w400,
|
||||
letterSpacing: -0.41,
|
||||
);
|
||||
static const callout = TextStyle(
|
||||
fontSize: 16,
|
||||
height: 1.3,
|
||||
fontWeight: FontWeight.w400,
|
||||
letterSpacing: -0.32,
|
||||
);
|
||||
static const subhead = TextStyle(
|
||||
fontSize: 15,
|
||||
height: 1.3,
|
||||
fontWeight: FontWeight.w400,
|
||||
letterSpacing: -0.24,
|
||||
);
|
||||
static const footnote = TextStyle(
|
||||
fontSize: 13,
|
||||
height: 1.3,
|
||||
fontWeight: FontWeight.w400,
|
||||
letterSpacing: -0.08,
|
||||
);
|
||||
static const caption1 = TextStyle(
|
||||
fontSize: 12,
|
||||
height: 1.3,
|
||||
fontWeight: FontWeight.w400,
|
||||
);
|
||||
static const caption2 = TextStyle(
|
||||
fontSize: 11,
|
||||
height: 1.3,
|
||||
fontWeight: FontWeight.w400,
|
||||
letterSpacing: 0.07,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user