mirror of https://github.com/flutter/pinball.git
chore: reference the app text styles from theme context (#264)
parent
650ecaf10c
commit
8fddce60a8
@ -1,2 +0,0 @@
|
||||
export 'app_colors.dart';
|
||||
export 'app_text_style.dart';
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,16 @@
|
||||
/// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
/// *****************************************************
|
||||
/// FlutterGen
|
||||
/// *****************************************************
|
||||
|
||||
// ignore_for_file: directives_ordering,unnecessary_import
|
||||
|
||||
class FontFamily {
|
||||
FontFamily._();
|
||||
|
||||
/// Font family: PixeloidMono
|
||||
static const String pixeloidMono = 'PixeloidMono';
|
||||
|
||||
/// Font family: PixeloidSans
|
||||
static const String pixeloidSans = 'PixeloidSans';
|
||||
}
|
@ -1,17 +1,11 @@
|
||||
// ignore_for_file: public_member_api_docs
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
abstract class AppColors {
|
||||
abstract class PinballColors {
|
||||
static const Color white = Color(0xFFFFFFFF);
|
||||
|
||||
static const Color darkBlue = Color(0xFF0C32A4);
|
||||
|
||||
static const Color yellow = Color(0xFFFFEE02);
|
||||
|
||||
static const Color orange = Color(0xFFE5AB05);
|
||||
|
||||
static const Color blue = Color(0xFF4B94F6);
|
||||
|
||||
static const Color transparent = Color(0x00000000);
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:pinball_ui/pinball_ui.dart';
|
||||
|
||||
/// Pinball theme
|
||||
class PinballTheme {
|
||||
/// Standard [ThemeData] for Pinball UI
|
||||
static ThemeData get standard {
|
||||
return ThemeData(
|
||||
textTheme: _textTheme,
|
||||
);
|
||||
}
|
||||
|
||||
static TextTheme get _textTheme {
|
||||
return const TextTheme(
|
||||
headline1: PinballTextStyle.headline1,
|
||||
headline2: PinballTextStyle.headline2,
|
||||
headline3: PinballTextStyle.headline3,
|
||||
headline4: PinballTextStyle.headline4,
|
||||
subtitle1: PinballTextStyle.subtitle1,
|
||||
subtitle2: PinballTextStyle.subtitle2,
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
export 'pinball_colors.dart';
|
||||
export 'pinball_text_style.dart';
|
||||
export 'pinball_theme.dart';
|
@ -0,0 +1,31 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pinball_ui/pinball_ui.dart';
|
||||
|
||||
void main() {
|
||||
group('PinballColors', () {
|
||||
test('white is 0xFFFFFFFF', () {
|
||||
expect(PinballColors.white, const Color(0xFFFFFFFF));
|
||||
});
|
||||
|
||||
test('darkBlue is 0xFF0C32A4', () {
|
||||
expect(PinballColors.darkBlue, const Color(0xFF0C32A4));
|
||||
});
|
||||
|
||||
test('yellow is 0xFFFFEE02', () {
|
||||
expect(PinballColors.yellow, const Color(0xFFFFEE02));
|
||||
});
|
||||
|
||||
test('orange is 0xFFE5AB05', () {
|
||||
expect(PinballColors.orange, const Color(0xFFE5AB05));
|
||||
});
|
||||
|
||||
test('blue is 0xFF4B94F6', () {
|
||||
expect(PinballColors.blue, const Color(0xFF4B94F6));
|
||||
});
|
||||
|
||||
test('transparent is 0x00000000', () {
|
||||
expect(PinballColors.transparent, const Color(0x00000000));
|
||||
});
|
||||
});
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pinball_ui/pinball_ui.dart';
|
||||
|
||||
void main() {
|
||||
group('PinballTextStyle', () {
|
||||
test('headline1 has fontSize 28 and white color', () {
|
||||
const style = PinballTextStyle.headline1;
|
||||
expect(style.fontSize, 28);
|
||||
expect(style.color, PinballColors.white);
|
||||
});
|
||||
|
||||
test('headline2 has fontSize 24', () {
|
||||
const style = PinballTextStyle.headline2;
|
||||
expect(style.fontSize, 24);
|
||||
});
|
||||
|
||||
test('headline3 has fontSize 20 and white color', () {
|
||||
const style = PinballTextStyle.headline3;
|
||||
expect(style.fontSize, 20);
|
||||
expect(style.color, PinballColors.white);
|
||||
});
|
||||
|
||||
test('headline4 has fontSize 16 and white color', () {
|
||||
const style = PinballTextStyle.headline4;
|
||||
expect(style.fontSize, 16);
|
||||
expect(style.color, PinballColors.white);
|
||||
});
|
||||
|
||||
test('subtitle1 has fontSize 10 and yellow color', () {
|
||||
const style = PinballTextStyle.subtitle1;
|
||||
expect(style.fontSize, 10);
|
||||
expect(style.color, PinballColors.yellow);
|
||||
});
|
||||
|
||||
test('subtitle2 has fontSize 16 and white color', () {
|
||||
const style = PinballTextStyle.subtitle2;
|
||||
expect(style.fontSize, 16);
|
||||
expect(style.color, PinballColors.white);
|
||||
});
|
||||
});
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pinball_ui/pinball_ui.dart';
|
||||
|
||||
void main() {
|
||||
group('PinballTheme', () {
|
||||
group('standard', () {
|
||||
test('headline1 matches PinballTextStyle#headline1', () {
|
||||
expect(
|
||||
PinballTheme.standard.textTheme.headline1!.fontSize,
|
||||
PinballTextStyle.headline1.fontSize,
|
||||
);
|
||||
expect(
|
||||
PinballTheme.standard.textTheme.headline1!.color,
|
||||
PinballTextStyle.headline1.color,
|
||||
);
|
||||
expect(
|
||||
PinballTheme.standard.textTheme.headline1!.fontFamily,
|
||||
PinballTextStyle.headline1.fontFamily,
|
||||
);
|
||||
});
|
||||
|
||||
test('headline2 matches PinballTextStyle#headline2', () {
|
||||
expect(
|
||||
PinballTheme.standard.textTheme.headline2!.fontSize,
|
||||
PinballTextStyle.headline2.fontSize,
|
||||
);
|
||||
expect(
|
||||
PinballTheme.standard.textTheme.headline2!.fontFamily,
|
||||
PinballTextStyle.headline2.fontFamily,
|
||||
);
|
||||
expect(
|
||||
PinballTheme.standard.textTheme.headline2!.fontWeight,
|
||||
PinballTextStyle.headline2.fontWeight,
|
||||
);
|
||||
});
|
||||
|
||||
test('headline3 matches PinballTextStyle#headline3', () {
|
||||
expect(
|
||||
PinballTheme.standard.textTheme.headline3!.fontSize,
|
||||
PinballTextStyle.headline3.fontSize,
|
||||
);
|
||||
expect(
|
||||
PinballTheme.standard.textTheme.headline3!.color,
|
||||
PinballTextStyle.headline3.color,
|
||||
);
|
||||
expect(
|
||||
PinballTheme.standard.textTheme.headline3!.fontFamily,
|
||||
PinballTextStyle.headline3.fontFamily,
|
||||
);
|
||||
});
|
||||
|
||||
test('headline4 matches PinballTextStyle#headline4', () {
|
||||
expect(
|
||||
PinballTheme.standard.textTheme.headline4!.fontSize,
|
||||
PinballTextStyle.headline4.fontSize,
|
||||
);
|
||||
expect(
|
||||
PinballTheme.standard.textTheme.headline4!.color,
|
||||
PinballTextStyle.headline4.color,
|
||||
);
|
||||
expect(
|
||||
PinballTheme.standard.textTheme.headline4!.fontFamily,
|
||||
PinballTextStyle.headline4.fontFamily,
|
||||
);
|
||||
});
|
||||
|
||||
test('subtitle1 matches PinballTextStyle#subtitle1', () {
|
||||
expect(
|
||||
PinballTheme.standard.textTheme.subtitle1!.fontSize,
|
||||
PinballTextStyle.subtitle1.fontSize,
|
||||
);
|
||||
expect(
|
||||
PinballTheme.standard.textTheme.subtitle1!.color,
|
||||
PinballTextStyle.subtitle1.color,
|
||||
);
|
||||
expect(
|
||||
PinballTheme.standard.textTheme.subtitle1!.fontFamily,
|
||||
PinballTextStyle.subtitle1.fontFamily,
|
||||
);
|
||||
});
|
||||
|
||||
test('subtitle2 matches PinballTextStyle#subtitle2', () {
|
||||
expect(
|
||||
PinballTheme.standard.textTheme.subtitle2!.fontSize,
|
||||
PinballTextStyle.subtitle2.fontSize,
|
||||
);
|
||||
expect(
|
||||
PinballTheme.standard.textTheme.subtitle2!.color,
|
||||
PinballTextStyle.subtitle2.color,
|
||||
);
|
||||
expect(
|
||||
PinballTheme.standard.textTheme.subtitle2!.fontFamily,
|
||||
PinballTextStyle.subtitle2.fontFamily,
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Reference in new issue