Skip to content

Instantly share code, notes, and snippets.

@scottbaggett
Last active May 6, 2019 22:33
Show Gist options
  • Save scottbaggett/45c4107bb9dbd955c1335b92d825f723 to your computer and use it in GitHub Desktop.
Save scottbaggett/45c4107bb9dbd955c1335b92d825f723 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
final ThemeData indigoTheme = _buildDefaultTheme();
final white = const Color(0xffffffff);
final black = const Color(0xFF000000);
final indigo = const Color(0xFF4957F4);
final brand = const Color(0xFF996D17);
final divider = const Color(0xFFCFCFCF);
final lightGrey = const Color(0xFFCFCFCF);
final grey = const Color(0xFF7F7F7F);
final darkGrey = const Color(0xFF606060);
final darkestGrey = const Color(0xFF404040);
final errorRed = const Color(0xFFE75B52);
final buttonBorderRadius = BorderRadius.circular(36);
final buttonPrimaryFillColor = indigo;
final fontFamily = "Calibre_R";
final baseLineHeight = 1.1;
/* ThemePadding class is a organizational structure that gives developers a simple,
reusable set of values and helpers */
class ThemePadding {
/* Base values can be used alone, but they also are used to construct
the full EdgeInset constants below */
static const increment = 4.0;
static const small = increment * 2;
static const base = increment * 4;
/* Primary insets is used to pad top-level containers */
static const primaryInsets =
EdgeInsets.symmetric(horizontal: base, vertical: small);
/* Horizontal and vertical only EdgeInsets */
static const insetHorizontal = EdgeInsets.symmetric(horizontal: base);
static const insetHorizontalSmall = EdgeInsets.symmetric(horizontal: small);
static const insetVertical = EdgeInsets.symmetric(vertical: base);
static const insetVeticalSmall = EdgeInsets.symmetric(vertical: small);
/* A unified amount of inset is often required inside inner containers. */
static const insetAll = EdgeInsets.all(base);
static const insetAllSmall = EdgeInsets.all(small);
}
/* Just like ThemePadding, ThemeBorder is a loose set of base
* values and helper constants. */
class ThemeBorder {
static const base = 10.0;
static const cardRadius = Radius.circular(base);
}
class ThemeShadow {
static const base = 4.0;
/* Big Card shadows have a larger radius and lighter color than smaller cards */
static const cardBig = BoxShadow(
color: Color(0x20000000),
blurRadius: base * 2,
offset: Offset(0, 1),
);
}
final double listCellHeight = 72;
ThemeData _buildDefaultTheme() {
final ThemeData base = ThemeData(
brightness: Brightness.light,
primaryColor: indigo,
errorColor: errorRed,
accentColor: Colors.indigoAccent,
fontFamily: fontFamily,
inputDecorationTheme: InputDecorationTheme(
filled: true,
fillColor: Color(0xfff8f8f8),
),
textTheme: TextTheme(
display4: TextStyle(
fontSize: 44.0,
color: black,
fontFamily: fontFamily,
letterSpacing: -0.3,
height: baseLineHeight,
fontWeight: FontWeight.w500,
),
display3: TextStyle(
fontSize: 40.0,
color: black,
fontFamily: fontFamily,
letterSpacing: -1,
height: baseLineHeight,
fontWeight: FontWeight.w500,
),
display2: TextStyle(
fontSize: 34.0,
color: black,
height: baseLineHeight,
fontFamily: fontFamily,
fontWeight: FontWeight.w500,
),
display1: TextStyle(
fontSize: 28.0,
color: black,
height: baseLineHeight,
fontFamily: fontFamily,
fontWeight: FontWeight.w500,
),
headline: TextStyle(
fontSize: 20.0,
color: black,
letterSpacing: 0.25,
fontFamily: fontFamily,
height: baseLineHeight,
fontWeight: FontWeight.w500,
),
body1: TextStyle(
fontSize: 16.0,
color: black,
fontFamily: fontFamily,
height: baseLineHeight,
fontWeight: FontWeight.w500,
),
body2: TextStyle(
fontSize: 14.0,
color: black,
fontFamily: fontFamily,
height: baseLineHeight,
fontWeight: FontWeight.w500,
),
caption: TextStyle(
fontSize: 12.0,
color: black,
fontFamily: fontFamily,
height: baseLineHeight,
fontWeight: FontWeight.w500,
),
),
// in `dev` channel
// floatingActionButtonTheme: FloatingActionButtonThemeData(
// elevation: 0,
// highlightElevation: 0,
// disabledElevation: 0,
// ),
appBarTheme: AppBarTheme(
brightness: Brightness.light,
color: Colors.white,
elevation: 0,
iconTheme: IconThemeData(color: Colors.black),
textTheme: TextTheme(
title: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
color: Colors.black,
),
),
),
buttonColor: buttonPrimaryFillColor,
buttonTheme: ButtonThemeData(
buttonColor: buttonPrimaryFillColor,
shape: RoundedRectangleBorder(
borderRadius: buttonBorderRadius,
),
textTheme: ButtonTextTheme.primary,
),
);
return base;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment