Skip to content

Commit

Permalink
Merge pull request #522 from bannzai/refactor/color/to_const
Browse files Browse the repository at this point in the history
Color,Font に const つける
  • Loading branch information
bannzai committed Feb 27, 2022
2 parents e575596 + 85b1a25 commit 264508a
Show file tree
Hide file tree
Showing 68 changed files with 168 additions and 168 deletions.
2 changes: 1 addition & 1 deletion lib/components/atoms/button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:pilll/components/atoms/font.dart';
import 'package:flutter/material.dart';

abstract class ButtonTextStyle {
static final TextStyle main = TextStyle(
static final TextStyle main = const TextStyle(
fontFamily: FontFamily.japanese,
fontWeight: FontWeight.w700,
fontSize: FontSize.sLarge,
Expand Down
6 changes: 3 additions & 3 deletions lib/components/atoms/buttons.dart
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class SmallAppOutlinedButton extends StatelessWidget {
child: Center(
child: Text(
text,
style: TextStyle(
style: const TextStyle(
color: TextColor.main,
fontSize: 12,
fontFamily: FontFamily.japanese,
Expand Down Expand Up @@ -224,7 +224,7 @@ class AppOutlinedButton extends StatelessWidget {
child: Center(
child: Text(
text,
style: TextStyle(
style: const TextStyle(
color: TextColor.main,
fontSize: 16,
fontFamily: FontFamily.japanese,
Expand Down Expand Up @@ -271,7 +271,7 @@ class AlertButton extends StatelessWidget {
return TextButton(
child: Text(
text,
style: TextStyle(
style: const TextStyle(
fontFamily: FontFamily.japanese,
fontWeight: FontWeight.w600,
fontSize: FontSize.normal,
Expand Down
74 changes: 37 additions & 37 deletions lib/components/atoms/font.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,142 +3,142 @@ import 'package:flutter/material.dart';
class FontFamily {
static String get standarad => japanese;

static final String number = "Avenir Next";
static final String japanese = "Noto Sans CJK JP";
static final String roboto = "Roboto";
static const String number = "Avenir Next";
static const String japanese = "Noto Sans CJK JP";
static const String roboto = "Roboto";
}

class FontSize {
static final double xHuge = 40;
static final double huge = 34;
static final double xBig = 24;
static final double big = 22;
static final double sBig = 20;
static final double large = 17;
static final double sLarge = 16;
static final double normal = 14;
static final double small = 12;
static final double sSmall = 10;
static const double xHuge = 40;
static const double huge = 34;
static const double xBig = 24;
static const double big = 22;
static const double sBig = 20;
static const double large = 17;
static const double sLarge = 16;
static const double normal = 14;
static const double small = 12;
static const double sSmall = 10;
}

class FontType {
static final TextStyle xHugeNumber = TextStyle(
static const TextStyle xHugeNumber = TextStyle(
fontFamily: FontFamily.number,
fontWeight: FontWeight.w500,
fontSize: FontSize.xHuge,
);
static final TextStyle largeNumber = TextStyle(
static const TextStyle largeNumber = TextStyle(
fontFamily: FontFamily.japanese,
fontWeight: FontWeight.w500,
fontSize: FontSize.huge,
);
static final TextStyle title = TextStyle(
static const TextStyle title = TextStyle(
fontFamily: FontFamily.japanese,
fontWeight: FontWeight.w600,
fontSize: FontSize.large,
);
static final TextStyle subTitle = TextStyle(
static const TextStyle subTitle = TextStyle(
fontFamily: FontFamily.japanese,
fontWeight: FontWeight.w600,
fontSize: FontSize.sLarge,
);
static final TextStyle xBigTitle = TextStyle(
static const TextStyle xBigTitle = TextStyle(
fontFamily: FontFamily.number,
fontWeight: FontWeight.w500,
fontSize: FontSize.xBig,
);
static final TextStyle xBigNumber = TextStyle(
static const TextStyle xBigNumber = TextStyle(
fontFamily: FontFamily.number,
fontWeight: FontWeight.w600,
fontSize: FontSize.xBig,
);
static final TextStyle sBigTitle = TextStyle(
static const TextStyle sBigTitle = TextStyle(
fontFamily: FontFamily.japanese,
fontWeight: FontWeight.w500,
fontSize: FontSize.sBig,
);
static final TextStyle cardHeader = TextStyle(
static const TextStyle cardHeader = TextStyle(
fontFamily: FontFamily.number,
fontWeight: FontWeight.w600,
fontSize: FontSize.big,
);
static final TextStyle thinTitle = TextStyle(
static const TextStyle thinTitle = TextStyle(
fontFamily: FontFamily.japanese,
fontWeight: FontWeight.w300,
fontSize: FontSize.sLarge,
);
static final TextStyle done = TextStyle(
static const TextStyle done = TextStyle(
fontFamily: FontFamily.japanese,
fontWeight: FontWeight.w600,
fontSize: FontSize.sLarge,
);
static final TextStyle close = TextStyle(
static const TextStyle close = TextStyle(
fontFamily: FontFamily.japanese,
fontWeight: FontWeight.w600,
fontSize: FontSize.normal,
);
static final TextStyle componentTitle = TextStyle(
static const TextStyle componentTitle = TextStyle(
fontFamily: FontFamily.japanese,
fontWeight: FontWeight.w300,
fontSize: FontSize.sLarge,
);
static final TextStyle gridElement = TextStyle(
static const TextStyle gridElement = TextStyle(
fontFamily: FontFamily.number,
fontWeight: FontWeight.w600,
fontSize: FontSize.sLarge,
);

static final TextStyle helpRow = TextStyle(
static const TextStyle helpRow = TextStyle(
fontFamily: FontFamily.roboto,
fontWeight: FontWeight.w400,
fontSize: FontSize.normal,
);
static final TextStyle listRow = TextStyle(
static const TextStyle listRow = TextStyle(
fontFamily: FontFamily.roboto,
fontWeight: FontWeight.w300,
fontSize: FontSize.sLarge,
);
static final TextStyle assisting = TextStyle(
static const TextStyle assisting = TextStyle(
fontFamily: FontFamily.japanese,
fontWeight: FontWeight.w300,
fontSize: FontSize.normal,
);
static final TextStyle assistingBold = TextStyle(
static const TextStyle assistingBold = TextStyle(
fontFamily: FontFamily.japanese,
fontWeight: FontWeight.w600,
fontSize: FontSize.normal,
);
static final TextStyle inputNumber = TextStyle(
static const TextStyle inputNumber = TextStyle(
fontFamily: FontFamily.japanese,
fontWeight: FontWeight.w700,
fontSize: FontSize.sLarge,
);
static final TextStyle description = TextStyle(
static const TextStyle description = TextStyle(
fontFamily: FontFamily.japanese,
fontWeight: FontWeight.w400,
fontSize: FontSize.small,
);
static final TextStyle descriptionBold = TextStyle(
static const TextStyle descriptionBold = TextStyle(
fontFamily: FontFamily.japanese,
fontWeight: FontWeight.w700,
fontSize: FontSize.small,
);
static final TextStyle smallTitle = TextStyle(
static const TextStyle smallTitle = TextStyle(
fontFamily: FontFamily.number,
fontWeight: FontWeight.w500,
fontSize: FontSize.small,
);
static final TextStyle sSmallTitle = TextStyle(
static const TextStyle sSmallTitle = TextStyle(
fontFamily: FontFamily.japanese,
fontWeight: FontWeight.w600,
fontSize: FontSize.sSmall,
);
static final TextStyle sSmallNumber = TextStyle(
static const TextStyle sSmallNumber = TextStyle(
fontFamily: FontFamily.number,
fontWeight: FontWeight.w600,
fontSize: FontSize.sSmall,
);
static final TextStyle sSmallSentence = TextStyle(
static const TextStyle sSmallSentence = TextStyle(
fontFamily: FontFamily.japanese,
fontWeight: FontWeight.w300,
fontSize: FontSize.sSmall,
Expand Down
40 changes: 20 additions & 20 deletions lib/components/atoms/text_color.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,30 @@ import 'package:flutter/material.dart';

class TextColor {
static Color get standard => black;
static final Color black = Colors.black;
static final Color white = Colors.white;
static const Color black = Colors.black;
static const Color white = Colors.white;
static final Color darkGray = const Color(0xFF000000).withAlpha(153);
static final Color gray = const Color(0xFF7E7E7E);
static final Color lightGray = const Color(0xFFB1B1B1);
static final Color lightGray2 = const Color(0xFF666666);
static final Color noshime = const Color(0xFF3D4662);
static final Color primary = PilllColors.primary;
static final Color main = const Color(0xFF29304D);
static final Color link = primary;
static final Color danger = PilllColors.red;
static const Color gray = const Color(0xFF7E7E7E);
static const Color lightGray = const Color(0xFFB1B1B1);
static const Color lightGray2 = const Color(0xFF666666);
static const Color noshime = const Color(0xFF3D4662);
static const Color primary = PilllColors.primary;
static const Color main = const Color(0xFF29304D);
static const Color link = primary;
static const Color danger = PilllColors.red;
}

class TextColorStyle {
static TextStyle get standard => black;
static final TextStyle black = TextStyle(color: TextColor.black);
static final TextStyle white = TextStyle(color: TextColor.white);
static const TextStyle black = TextStyle(color: TextColor.black);
static const TextStyle white = TextStyle(color: TextColor.white);
static final TextStyle darkGray = TextStyle(color: TextColor.darkGray);
static final TextStyle gray = TextStyle(color: TextColor.gray);
static final TextStyle lightGray = TextStyle(color: TextColor.lightGray);
static final TextStyle lightGray2 = TextStyle(color: TextColor.lightGray2);
static final TextStyle noshime = TextStyle(color: TextColor.noshime);
static final TextStyle primary = TextStyle(color: TextColor.primary);
static final TextStyle main = TextStyle(color: TextColor.main);
static final TextStyle link = TextStyle(color: TextColor.link);
static final TextStyle danger = TextStyle(color: TextColor.danger);
static const TextStyle gray = TextStyle(color: TextColor.gray);
static const TextStyle lightGray = TextStyle(color: TextColor.lightGray);
static const TextStyle lightGray2 = TextStyle(color: TextColor.lightGray2);
static const TextStyle noshime = TextStyle(color: TextColor.noshime);
static const TextStyle primary = TextStyle(color: TextColor.primary);
static const TextStyle main = TextStyle(color: TextColor.main);
static const TextStyle link = TextStyle(color: TextColor.link);
static const TextStyle danger = TextStyle(color: TextColor.danger);
}
6 changes: 3 additions & 3 deletions lib/components/molecules/counter_unit_layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class CounterUnitLayout extends StatelessWidget {
children: [
Text(
title,
style: TextStyle(
style: const TextStyle(
color: TextColor.main,
fontFamily: FontFamily.japanese,
fontSize: 12,
Expand All @@ -33,7 +33,7 @@ class CounterUnitLayout extends StatelessWidget {
children: [
Text(
number,
style: TextStyle(
style: const TextStyle(
color: TextColor.main,
fontFamily: FontFamily.number,
fontSize: 24,
Expand All @@ -42,7 +42,7 @@ class CounterUnitLayout extends StatelessWidget {
),
Text(
unit,
style: TextStyle(
style: const TextStyle(
color: TextColor.main,
fontFamily: FontFamily.japanese,
fontSize: 12,
Expand Down
2 changes: 1 addition & 1 deletion lib/components/molecules/premium_badge.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class PremiumBadge extends StatelessWidget {
color: PilllColors.gold,
borderRadius: BorderRadius.circular(41),
),
child: Text("Premium",
child: const Text("Premium",
style: TextStyle(
color: TextColor.white,
fontFamily: FontFamily.number,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class SettingMenstruationPageTemplate extends StatelessWidget {
),
title: Text(
this.title,
style: TextStyle(color: TextColor.black),
style: const TextStyle(color: TextColor.black),
),
backgroundColor: PilllColors.white,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class PillSheetGroupSelectPillSheetTypePage extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start,
children: [
const SizedBox(width: 16),
Text(
const Text(
"ピルの種類を選択",
style: TextStyle(
color: TextColor.main,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ class PillSheetTypeAddButton extends StatelessWidget {
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
const Icon(
Icons.add,
color: TextColor.noshime,
size: 20,
),
const SizedBox(width: 4),
Text(
const Text(
"ピルシートを追加",
style: TextStyle(
color: TextColor.main,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Day extends StatelessWidget {
width: 28,
child: Text(
"$_day",
style: TextStyle(
style: const TextStyle(
color: TextColor.main,
fontFamily: FontFamily.number,
fontSize: 23,
Expand All @@ -34,7 +34,7 @@ class Day extends StatelessWidget {
const SizedBox(width: 4),
Text(
"(${_weekday.weekdayString()})",
style: TextStyle(
style: const TextStyle(
color: TextColor.main,
fontFamily: FontFamily.japanese,
fontSize: 12,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class EffectivePillNumber extends StatelessWidget {
Widget build(BuildContext context) {
return Text(
"$effectivePillNumber",
style: TextStyle(
style: const TextStyle(
color: TextColor.main,
fontFamily: FontFamily.japanese,
fontSize: 12,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Time extends StatelessWidget {
Widget build(BuildContext context) {
return Text(
time,
style: TextStyle(
style: const TextStyle(
decoration: TextDecoration.underline,
letterSpacing: 1.5,
color: TextColor.main,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PillSheetModifiedHistoryMonthlyHeader extends StatelessWidget {
Widget build(BuildContext context) {
return Text(
DateTimeFormatter.jaMonth(dateTimeOfMonth),
style: TextStyle(
style: const TextStyle(
color: TextColor.main,
fontFamily: FontFamily.japanese,
fontSize: 12,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class PillSheetModifiedHistoryAutomaticallyRecordedLastTakenDateAction
effectiveNumbersOrHyphen: EffectivePillNumber(
effectivePillNumber:
PillSheetModifiedHistoryDateEffectivePillNumber.autoTaken(value)),
detail: Text(
detail: const Text(
"-",
style: TextStyle(
color: TextColor.main,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class PillSheetModifiedHistoryBeganRestDuration extends StatelessWidget {
effectiveNumbersOrHyphen: EffectivePillNumber(
effectivePillNumber:
PillSheetModifiedHistoryDateEffectivePillNumber.hyphen()),
detail: Text(
detail: const Text(
"休薬開始",
style: TextStyle(
color: TextColor.main,
Expand Down
Loading

0 comments on commit 264508a

Please sign in to comment.