54 lines
2.2 KiB
Dart
54 lines
2.2 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
import 'package:please_pay_me/theme/tokens.dart';
|
|
|
|
/// Inter is the closest cross-platform stand-in for SF Pro, so the catalog
|
|
/// looks the same on Windows/web as it does on device.
|
|
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(),
|
|
);
|
|
}
|
|
|
|
/// Android system bars. Dark uses transparent black so the 3-button / gesture
|
|
/// bar does not get a gray contrast scrim over the tab bar.
|
|
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,
|
|
);
|
|
}
|