mobile_theme_data.dart 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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: Colors.white,
  26. // button
  27. elevatedButtonTheme: ElevatedButtonThemeData(
  28. style: ButtonStyle(
  29. elevation: MaterialStateProperty.all(0),
  30. shadowColor: MaterialStateProperty.all(null),
  31. backgroundColor: MaterialStateProperty.resolveWith<Color>(
  32. (Set<MaterialState> states) {
  33. if (states.contains(MaterialState.disabled)) {
  34. return const Color(0xFF57B5F8);
  35. }
  36. return mobileColorTheme.primary;
  37. },
  38. ),
  39. foregroundColor: MaterialStateProperty.all(Colors.white),
  40. ),
  41. ),
  42. outlinedButtonTheme: OutlinedButtonThemeData(
  43. style: ButtonStyle(
  44. foregroundColor: MaterialStateProperty.all(
  45. mobileColorTheme.onBackground,
  46. ),
  47. backgroundColor: MaterialStateProperty.all(Colors.white),
  48. shape: MaterialStateProperty.all(
  49. RoundedRectangleBorder(
  50. borderRadius: BorderRadius.circular(6),
  51. ),
  52. ),
  53. side: MaterialStateProperty.all(
  54. BorderSide(
  55. color: mobileColorTheme.outline,
  56. width: 0.5,
  57. ),
  58. ),
  59. padding: MaterialStateProperty.all(
  60. const EdgeInsets.symmetric(horizontal: 16),
  61. ),
  62. // splash color
  63. overlayColor: MaterialStateProperty.all(
  64. Colors.grey[100],
  65. ),
  66. ),
  67. ),
  68. // text
  69. fontFamily: 'Poppins',
  70. textTheme: const TextTheme(
  71. displayLarge: TextStyle(
  72. color: Color(0xFF57B5F8),
  73. fontSize: 32,
  74. fontFamily: 'Poppins',
  75. fontWeight: FontWeight.w700,
  76. height: 1.20,
  77. letterSpacing: 0.16,
  78. ),
  79. displayMedium: TextStyle(
  80. color: Color(0xff2F3030),
  81. fontSize: 32,
  82. fontWeight: FontWeight.w600,
  83. height: 1.20,
  84. letterSpacing: 0.16,
  85. ),
  86. // H1 Semi 26
  87. displaySmall: TextStyle(
  88. color: Color(0xFF2F3030),
  89. fontSize: 26,
  90. fontWeight: FontWeight.w600,
  91. height: 1.10,
  92. letterSpacing: 0.13,
  93. ),
  94. // body2 14 Regular
  95. bodyMedium: TextStyle(
  96. color: Color(0xFFC5C7CB),
  97. fontSize: 14,
  98. fontWeight: FontWeight.w400,
  99. height: 1.20,
  100. letterSpacing: 0.07,
  101. ),
  102. // blue text button
  103. labelMedium: TextStyle(
  104. color: Color(0xFF2DA2F6),
  105. fontSize: 14,
  106. fontWeight: FontWeight.w500,
  107. height: 1.20,
  108. ),
  109. ),
  110. inputDecorationTheme: InputDecorationTheme(
  111. focusedBorder: const OutlineInputBorder(
  112. borderSide: BorderSide(
  113. width: 2,
  114. color: Color(0xFF2DA2F6), //primary 100
  115. ),
  116. borderRadius: BorderRadius.all(Radius.circular(6)),
  117. ),
  118. focusedErrorBorder: OutlineInputBorder(
  119. borderSide: BorderSide(color: mobileColorTheme.error),
  120. borderRadius: const BorderRadius.all(Radius.circular(6)),
  121. ),
  122. errorBorder: OutlineInputBorder(
  123. borderSide: BorderSide(color: mobileColorTheme.error),
  124. borderRadius: const BorderRadius.all(Radius.circular(6)),
  125. ),
  126. enabledBorder: const OutlineInputBorder(
  127. borderSide: BorderSide(
  128. color: Color(0xffBDC0C5), //caption
  129. ),
  130. borderRadius: BorderRadius.all(Radius.circular(6)),
  131. ),
  132. ),
  133. colorScheme: mobileColorTheme,
  134. );
  135. }