mobile_theme_data.dart 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. // ThemeData in mobile
  2. import 'package:flutter/material.dart';
  3. ThemeData getMobileThemeData() {
  4. const mobileColorTheme = ColorScheme(
  5. brightness: Brightness.light,
  6. primary: Color(0xFF2DA2F6), //primary 100
  7. onPrimary: Colors.white,
  8. // TODO(yijing): add color later
  9. secondary: Colors.white,
  10. onSecondary: Colors.white,
  11. error: Color(0xffFB006D),
  12. onError: Color(0xffFB006D),
  13. background: Colors.white,
  14. onBackground: Color(0xff2F3030), // title text
  15. outline: Color(0xffBDC0C5), //caption
  16. //Snack bar
  17. surface: Colors.white,
  18. onSurface: Color(0xff2F3030), // title text
  19. );
  20. return ThemeData(
  21. // color
  22. primaryColor: mobileColorTheme.primary, //primary 100
  23. primaryColorLight: const Color(0xFF57B5F8), //primary 80
  24. dividerColor: mobileColorTheme.outline, //caption
  25. scaffoldBackgroundColor: mobileColorTheme.background,
  26. appBarTheme: AppBarTheme(
  27. foregroundColor: mobileColorTheme.onBackground,
  28. backgroundColor: mobileColorTheme.background,
  29. elevation: 0,
  30. centerTitle: false,
  31. titleTextStyle: TextStyle(
  32. fontFamily: 'Poppins',
  33. color: mobileColorTheme.onBackground,
  34. fontSize: 18,
  35. fontWeight: FontWeight.w600,
  36. letterSpacing: 0.05,
  37. ),
  38. ),
  39. // button
  40. elevatedButtonTheme: ElevatedButtonThemeData(
  41. style: ButtonStyle(
  42. elevation: MaterialStateProperty.all(0),
  43. shadowColor: MaterialStateProperty.all(null),
  44. backgroundColor: MaterialStateProperty.resolveWith<Color>(
  45. (Set<MaterialState> states) {
  46. if (states.contains(MaterialState.disabled)) {
  47. return const Color(0xFF57B5F8);
  48. }
  49. return mobileColorTheme.primary;
  50. },
  51. ),
  52. foregroundColor: MaterialStateProperty.all(Colors.white),
  53. ),
  54. ),
  55. outlinedButtonTheme: OutlinedButtonThemeData(
  56. style: ButtonStyle(
  57. foregroundColor: MaterialStateProperty.all(
  58. mobileColorTheme.onBackground,
  59. ),
  60. backgroundColor: MaterialStateProperty.all(Colors.white),
  61. shape: MaterialStateProperty.all(
  62. RoundedRectangleBorder(
  63. borderRadius: BorderRadius.circular(6),
  64. ),
  65. ),
  66. side: MaterialStateProperty.all(
  67. BorderSide(
  68. color: mobileColorTheme.outline,
  69. width: 0.5,
  70. ),
  71. ),
  72. padding: MaterialStateProperty.all(
  73. const EdgeInsets.symmetric(horizontal: 16),
  74. ),
  75. // splash color
  76. overlayColor: MaterialStateProperty.all(
  77. Colors.grey[100],
  78. ),
  79. ),
  80. ),
  81. // text
  82. fontFamily: 'Poppins',
  83. textTheme: const TextTheme(
  84. displayLarge: TextStyle(
  85. color: Color(0xFF57B5F8),
  86. fontSize: 32,
  87. fontWeight: FontWeight.w700,
  88. height: 1.20,
  89. letterSpacing: 0.16,
  90. ),
  91. displayMedium: TextStyle(
  92. color: Color(0xff2F3030),
  93. fontSize: 32,
  94. fontWeight: FontWeight.w600,
  95. height: 1.20,
  96. letterSpacing: 0.16,
  97. ),
  98. // H1 Semi 26
  99. displaySmall: TextStyle(
  100. color: Color(0xFF2F3030),
  101. fontSize: 26,
  102. fontWeight: FontWeight.w600,
  103. height: 1.10,
  104. letterSpacing: 0.13,
  105. ),
  106. // body2 14 Regular
  107. bodyMedium: TextStyle(
  108. color: Color(0xFFC5C7CB),
  109. fontSize: 14,
  110. fontWeight: FontWeight.w400,
  111. height: 1.20,
  112. letterSpacing: 0.07,
  113. ),
  114. // blue text button
  115. labelMedium: TextStyle(
  116. color: Color(0xFF2DA2F6),
  117. fontSize: 14,
  118. fontWeight: FontWeight.w500,
  119. height: 1.20,
  120. ),
  121. ),
  122. inputDecorationTheme: InputDecorationTheme(
  123. focusedBorder: const OutlineInputBorder(
  124. borderSide: BorderSide(
  125. width: 2,
  126. color: Color(0xFF2DA2F6), //primary 100
  127. ),
  128. borderRadius: BorderRadius.all(Radius.circular(6)),
  129. ),
  130. focusedErrorBorder: OutlineInputBorder(
  131. borderSide: BorderSide(color: mobileColorTheme.error),
  132. borderRadius: const BorderRadius.all(Radius.circular(6)),
  133. ),
  134. errorBorder: OutlineInputBorder(
  135. borderSide: BorderSide(color: mobileColorTheme.error),
  136. borderRadius: const BorderRadius.all(Radius.circular(6)),
  137. ),
  138. enabledBorder: const OutlineInputBorder(
  139. borderSide: BorderSide(
  140. color: Color(0xffBDC0C5), //caption
  141. ),
  142. borderRadius: BorderRadius.all(Radius.circular(6)),
  143. ),
  144. ),
  145. colorScheme: mobileColorTheme,
  146. );
  147. }