mirror of https://github.com/flutter/samples.git
Gallery — Shrine: Update Letter Spacing (#187)
Add details for the Shrine study in the Gallery app: Use correct letter spacing from the spec.pull/192/head
parent
d4968124c9
commit
821f63861b
@ -0,0 +1,105 @@
|
|||||||
|
// Copyright 2019 The Flutter team. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:gallery/studies/shrine/colors.dart';
|
||||||
|
import 'package:gallery/studies/shrine/supplemental/cut_corners_border.dart';
|
||||||
|
|
||||||
|
const defaultLetterSpacing = 0.03;
|
||||||
|
const mediumLetterSpacing = 0.04;
|
||||||
|
const largeLetterSpacing = 1.0;
|
||||||
|
|
||||||
|
final ThemeData shrineTheme = _buildShrineTheme();
|
||||||
|
|
||||||
|
IconThemeData _customIconTheme(IconThemeData original) {
|
||||||
|
return original.copyWith(color: shrineBrown900);
|
||||||
|
}
|
||||||
|
|
||||||
|
ThemeData _buildShrineTheme() {
|
||||||
|
final ThemeData base = ThemeData.light();
|
||||||
|
return base.copyWith(
|
||||||
|
colorScheme: _shrineColorScheme,
|
||||||
|
accentColor: shrineBrown900,
|
||||||
|
primaryColor: shrinePink100,
|
||||||
|
buttonColor: shrinePink100,
|
||||||
|
scaffoldBackgroundColor: shrineBackgroundWhite,
|
||||||
|
cardColor: shrineBackgroundWhite,
|
||||||
|
textSelectionColor: shrinePink100,
|
||||||
|
errorColor: shrineErrorRed,
|
||||||
|
buttonTheme: const ButtonThemeData(
|
||||||
|
colorScheme: _shrineColorScheme,
|
||||||
|
textTheme: ButtonTextTheme.normal,
|
||||||
|
),
|
||||||
|
primaryIconTheme: _customIconTheme(base.iconTheme),
|
||||||
|
inputDecorationTheme: const InputDecorationTheme(
|
||||||
|
border: CutCornersBorder(
|
||||||
|
borderSide: BorderSide(color: shrineBrown900, width: 0.5),
|
||||||
|
),
|
||||||
|
contentPadding: EdgeInsets.symmetric(vertical: 20, horizontal: 16),
|
||||||
|
),
|
||||||
|
textTheme: _buildShrineTextTheme(base.textTheme),
|
||||||
|
primaryTextTheme: _buildShrineTextTheme(base.primaryTextTheme),
|
||||||
|
accentTextTheme: _buildShrineTextTheme(base.accentTextTheme),
|
||||||
|
iconTheme: _customIconTheme(base.iconTheme),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
TextTheme _buildShrineTextTheme(TextTheme base) {
|
||||||
|
return base
|
||||||
|
.copyWith(
|
||||||
|
headline: base.headline.copyWith(
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
letterSpacing: defaultLetterSpacing,
|
||||||
|
),
|
||||||
|
title: base.title.copyWith(
|
||||||
|
fontSize: 18,
|
||||||
|
letterSpacing: defaultLetterSpacing,
|
||||||
|
),
|
||||||
|
caption: base.caption.copyWith(
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
fontSize: 14,
|
||||||
|
letterSpacing: defaultLetterSpacing,
|
||||||
|
),
|
||||||
|
body2: base.body2.copyWith(
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
fontSize: 16,
|
||||||
|
letterSpacing: defaultLetterSpacing,
|
||||||
|
),
|
||||||
|
body1: base.body1.copyWith(
|
||||||
|
letterSpacing: defaultLetterSpacing,
|
||||||
|
),
|
||||||
|
subhead: base.subhead.copyWith(
|
||||||
|
letterSpacing: defaultLetterSpacing,
|
||||||
|
),
|
||||||
|
display1: base.display1.copyWith(
|
||||||
|
letterSpacing: defaultLetterSpacing,
|
||||||
|
),
|
||||||
|
button: base.button.copyWith(
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
fontSize: 14,
|
||||||
|
letterSpacing: defaultLetterSpacing,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.apply(
|
||||||
|
fontFamily: 'Rubik',
|
||||||
|
displayColor: shrineBrown900,
|
||||||
|
bodyColor: shrineBrown900,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ColorScheme _shrineColorScheme = ColorScheme(
|
||||||
|
primary: shrinePink100,
|
||||||
|
primaryVariant: shrineBrown900,
|
||||||
|
secondary: shrinePink50,
|
||||||
|
secondaryVariant: shrineBrown900,
|
||||||
|
surface: shrineSurfaceWhite,
|
||||||
|
background: shrineBackgroundWhite,
|
||||||
|
error: shrineErrorRed,
|
||||||
|
onPrimary: shrineBrown900,
|
||||||
|
onSecondary: shrineBrown900,
|
||||||
|
onSurface: shrineBrown900,
|
||||||
|
onBackground: shrineBrown900,
|
||||||
|
onError: shrineSurfaceWhite,
|
||||||
|
brightness: Brightness.light,
|
||||||
|
);
|
Loading…
Reference in new issue