Hibok
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

376 linhas
11 KiB

  1. import 'package:chat/generated/i18n.dart';
  2. import 'package:chat/utils/date_utils.dart';
  3. import 'package:flutter/material.dart';
  4. class AppColors {
  5. static const BackgroundColor = Color(0xFFeeeeee);
  6. static const RefreshBgColor = Color(0xFFF4F4F4);
  7. static const AppBarColor = 0xff303030;
  8. static const TabIconNormal = 0xff999999;
  9. static const TabIconActive = 0xff46c11b;
  10. static const AppBarPopupMenuColor = 0xffffffff;
  11. static const TitleColor = Color(0xff353535);
  12. static const ConversationItemBgColor = 0xffffffff;
  13. static const DescTextColor = 0xff9e9e9e;
  14. static const DividerColor = Color(0xffd9d9d9);
  15. static const NewAppbarBgColor = Colors.white;
  16. static const NewAppbarTextColor = Colors.black;
  17. static const ChatItemBgColor = Color(0xffF75F92);
  18. static const NotifyDotBgColor = 0xffff3e3e;
  19. static const NotifyDotText = 0xffffffff;
  20. static const ConversationMuteIconColor = 0xffd8d8d8;
  21. static const DeviceInfoItemBgColor = 0xfff5f5f5;
  22. static const DeviceInfoItemTextColor = 0xff606062;
  23. static const DeviceInfoItemIconColor = 0xff606062;
  24. static const ContactGroupTitleBgColor = 0xffebebeb;
  25. static const ContactGroupTitleColor = 0xff888888;
  26. static const IndexLetterBoxBgColor = Colors.black45;
  27. }
  28. class AppStyles {
  29. static const TitleStyle = TextStyle(
  30. fontSize: 14.0,
  31. color: AppColors.TitleColor,
  32. );
  33. static const DescStyle = TextStyle(
  34. fontSize: 12.0,
  35. color: Constants.GreyTextColor,
  36. );
  37. static const UnreadMsgCountDotStyle = TextStyle(
  38. fontSize: 11.0,
  39. color: Color(AppColors.NotifyDotText),
  40. );
  41. static const DeviceInfoItemTextStyle = TextStyle(
  42. fontSize: 13.0,
  43. color: Color(AppColors.DeviceInfoItemTextColor),
  44. );
  45. static const GroupTitleItemTextStyle =
  46. TextStyle(color: Color(AppColors.ContactGroupTitleColor), fontSize: 14.0);
  47. static const IndexLetterBoxTextStyle = TextStyle(
  48. fontSize: 64.0,
  49. color: Colors.white,
  50. );
  51. }
  52. class ComId {
  53. static const int Heart = 0;
  54. static const int Login = 1;
  55. static const int Chat = 2;
  56. static const int PushMsg = 100;
  57. }
  58. enum ChatState {
  59. connecting, //连接中
  60. connected, //连接成功
  61. connectFailed, //连接失败
  62. logining, //登录中
  63. logined, //登录成功
  64. loginFailed //登录失败
  65. }
  66. //语言类别
  67. class LanguageType {
  68. static const int English = 0; //英语
  69. static const int Vietnamese = 1; //越南语
  70. static const int TraditionalChinese = 2; //繁体中文
  71. static const int SimplifiedChinese = 3; //简体中文
  72. static const int Korean = 4; //韩语
  73. static const int Japanese = 5; //日语
  74. }
  75. //群管理界面类别
  76. class GroupOperatingPageType {
  77. static const int AddMember = 0; //增加新的成员
  78. static const int DeleteMember = 1; //删除新的成员
  79. static const int SelectGroupOwner = 2; //选择群主
  80. static const int CreateGroup = 3; //创建群组
  81. }
  82. //消息发送界面类别
  83. class SendMessagePageType {
  84. static const int AddFriends = 0; //添加朋友
  85. static const int ChangeGroupName = 1; //修改群名字
  86. static const int ChangeGroupNickName = 2; //修改群昵称
  87. }
  88. //全局搜索类别
  89. class GlobalSearchPageType {
  90. static const int SearchMyFriends = 0; //查找我的好友成员
  91. static const int SearchGroup = 1; //查找群
  92. static const int SearchNewFriends = 2; //查找新的好友
  93. }
  94. const String googleMapApiKey = 'AIzaSyAb9JNtW0BEZ_qLeDg87ZhvxSmZply-7hU';
  95. class Constants {
  96. ///ture 应用商店版本 false线下渠道
  97. static const bool isStoreVersion = false;
  98. ///在pubspec.yaml中修改版本号
  99. static String versionName = '1.0.0';
  100. static bool isSandbox = false;
  101. static String packageName = 'com.cyhd.henhoandroid';
  102. static const IconFontFamily = "iconFont";
  103. static const ConversationAvatarSize = 48.0;
  104. static const DividerWidth = 0.5;
  105. static const UnReadMsgNotifyDotSize = 22.0;
  106. static const ConversationMuteIcon = 18.0;
  107. static const ContactAvatarSize = 36.0;
  108. static const IndexBarWidth = 24.0;
  109. static const IndexLetterBoxSize = 114.0;
  110. static const IndexLetterBoxRadius = 4.0;
  111. static const FullWidthIconButtonIconSize = 24.0;
  112. static const ProfileHeaderIconSize = 60.0;
  113. static const AppId = 'wx02328a8853f058ad';
  114. static const Secret = '9d401b6a8bfe7b2fe63b3bf5c040b2f2';
  115. static const CloseLoaindTime = 250;
  116. static const VipColor = const Color(0xFFFA9F00);
  117. //背景色
  118. static const LightGreyBackgroundColor = const Color(0xfffafafa);
  119. static const GreyBackgroundColor = const Color(0xFFF0F0F0);
  120. static const PurpleBackgroundColor = const Color(0xFFEC4163);
  121. static const LightBlueBackgroundColor = const Color(0xFFEDF6FE);
  122. //字体颜色
  123. static const GreyTextColor = const Color(0xFF848486);
  124. static const BlackTextColor = const Color(0xFF1B201F);
  125. static const RedTextColor = const Color(0xFFFD959F);
  126. static const YellowTextColor = const Color(0xFFCDBD75);
  127. static const BlueTextColor = const Color(0xFF008AFF);
  128. static const LightBlueTextColor = const Color(0xFF88A3BC);
  129. static const LightGreyTextColor = const Color(0xFFB0B0B0);
  130. static const OpacityBlueTextColor = const Color(0xFFB7DEFF);
  131. static const PinkTextColor = const Color(0xFFEB71BD);
  132. //图标颜色
  133. static const BlueIconColor = const Color(0xFF86B3D9);
  134. static const LightBlueIconColor = const Color(0xFFB6DDFF);
  135. static const MainTitleStyle = TextStyle(
  136. fontSize: 20.0,
  137. color: Constants.BlackTextColor,
  138. fontWeight: FontWeight.w500);
  139. //分割线颜色
  140. static const DividerLineColor = const Color(0xFFE8E8E8);
  141. static const GreyBorderSide =
  142. BorderSide(color: const Color(0xFFF3F3F3), width: 1);
  143. //按钮颜色
  144. static const ConfrimButtonColor = const Color(0xFF3875E9);
  145. static const CancleButtonColor = Colors.grey;
  146. static const LightBlueButtonColor = const Color(0xFF6EBCFF);
  147. //按钮
  148. static const ConfirmBUttonBoxDecoration = BoxDecoration(
  149. color: Constants.ConfrimButtonColor,
  150. borderRadius: BorderRadius.all(Radius.circular(LittleButtonRadius)));
  151. static const BottomIconGreyColor = const Color(0xffa0a0a0);
  152. static const LittleButtonRadius = 5.0;
  153. static const BigButtonRadius = 8.0;
  154. //tabbar样式
  155. static const SelectTabBarTextStyle = TextStyle(fontSize: 14);
  156. static const UnselectTabBarTextStyle = TextStyle(fontSize: 14);
  157. static const AppBarActionTextStyle =
  158. TextStyle(color: BlueTextColor, fontSize: 14.9);
  159. static const double ShaderButtonHeight = 49.15;
  160. static const double ShaderButtonFontSize = 18;
  161. static const TextFieldIconSize = 20.0;
  162. //图片
  163. static const DefaultHeadImgUrl = 'assets/images/default_nor_avatar.png';
  164. //类别颜色
  165. static const Category1Color = const Color(0xFF3D9BE2);
  166. static const Category2Color = const Color(0xFF934DDA);
  167. static const Category3Color = const Color(0xFF5B6AEB);
  168. static const Category4Color = const Color(0xFFE66C84);
  169. static const Category5Color = const Color(0xFFD4915E);
  170. static const Category6Color = const Color(0xFF3AB364);
  171. static const Category7Color = const Color(0xFF59B1FA);
  172. static const Category8Color = const Color(0xFF676666);
  173. //系统消息渐变
  174. static const RadioGradient = LinearGradient(
  175. begin: Alignment.topCenter,
  176. end: Alignment.bottomCenter,
  177. colors: <Color>[
  178. const Color(0xFF58B7F5),
  179. const Color(0xFF1874C9),
  180. ]);
  181. static const MoneyGradient = LinearGradient(
  182. begin: Alignment.topCenter,
  183. end: Alignment.bottomCenter,
  184. colors: <Color>[
  185. const Color(0xFF6171F1),
  186. const Color(0xFF3441C1),
  187. ]);
  188. static const ApplyGradient = LinearGradient(
  189. begin: Alignment.topCenter,
  190. end: Alignment.bottomCenter,
  191. colors: <Color>[
  192. const Color(0xFFED7990),
  193. const Color(0xFFC22444),
  194. ]);
  195. static const EvaGradient = LinearGradient(
  196. begin: Alignment.topCenter,
  197. end: Alignment.bottomCenter,
  198. colors: <Color>[
  199. const Color(0xFF1BC79F),
  200. const Color(0xFF078D75),
  201. ]);
  202. static const ParkGradient = LinearGradient(
  203. begin: Alignment.topCenter,
  204. end: Alignment.bottomCenter,
  205. colors: <Color>[
  206. const Color(0xFFFBC535),
  207. const Color(0xFFE67430),
  208. ]);
  209. //本地存储key
  210. static const KeyboardHeight = 'KeyboardHeight';
  211. static const AutoLoginKey = 'autoLoginKey';
  212. static const Language = 'language';
  213. static const LocalUserId = 'localUserId';
  214. static const ApplyCount = 'applyCount';
  215. static const EvaluateCount = 'evaluateCount';
  216. static const ParkCount = 'parkCount';
  217. static const CastCount = 'castCount';
  218. static const WalletCount = 'walletCount';
  219. static const IOS_IAP_Receipt = 'iosIAPReceipt';
  220. static const SOUND_PLAY_MODE = 'isSoundReceiver'; //false外放-ture声筒
  221. static const ContactNum = 'ConstantNum'; //本地存储通讯录数量
  222. static const NewFriendsList = 'NewFriendsList'; //本地缓存的新朋友列表
  223. static const Splash_OPENED = 'splashOpened_13'; //是否加载过引导页
  224. static const LocalUsrInfo = 'LocalUsrInfo'; //本地用户数据
  225. //定位获取太慢,缓存经纬度
  226. static const Latitude = 'Latitude';
  227. static const Longitude = 'Longitude';
  228. /// currentGoodsId+'@'+receipt+'@'+purchaseToken
  229. static final vipIcon = Image.asset(
  230. 'assets/images/VIP.png',
  231. height: 11.5,
  232. );
  233. static final svipIcon = Padding(
  234. padding: EdgeInsets.only(bottom: 5.5),
  235. child: Image.asset(
  236. 'assets/images/svip.png',
  237. height: 14,
  238. ),
  239. );
  240. static const ConversationAvatarDefaultIocn = Icon(
  241. IconData(
  242. 0xe642,
  243. fontFamily: IconFontFamily,
  244. ),
  245. size: ConversationAvatarSize,
  246. );
  247. static const ContactAvatarDefaultIocn = Icon(
  248. IconData(
  249. 0xe642,
  250. fontFamily: IconFontFamily,
  251. ),
  252. size: ContactAvatarSize,
  253. );
  254. static const ProfileAvatarDefaultIocn = Icon(
  255. IconData(
  256. 0xe642,
  257. fontFamily: IconFontFamily,
  258. ),
  259. size: ProfileHeaderIconSize,
  260. );
  261. static const Agore_appId = '7564ab9804b6455ba337ff39aad2779b';
  262. //一些公共函数
  263. static getShowTime(int msgTime, BuildContext context) {
  264. var showTime;
  265. DateTime now = DateTime.now();
  266. DateTime time = DateTime.fromMillisecondsSinceEpoch(msgTime);
  267. if (now.year != time.year) {
  268. showTime = DateUtils().getFormartData(timeSamp: msgTime, format: 'yyyy');
  269. } else {
  270. if (now.month != time.month) {
  271. showTime =
  272. DateUtils().getFormartData(timeSamp: msgTime, format: 'MM/dd');
  273. } else {
  274. int days = now.day - time.day;
  275. if (days != 0) {
  276. showTime =
  277. I18n.of(context).day_ago.replaceFirst('/s1', days.toString());
  278. } else {
  279. showTime =
  280. DateUtils().getFormartData(timeSamp: msgTime, format: 'HH:mm');
  281. }
  282. }
  283. }
  284. return showTime;
  285. }
  286. }
  287. const INDEX_BAR_WORDS = [
  288. "↑",
  289. "#",
  290. "A",
  291. "B",
  292. "C",
  293. "D",
  294. "E",
  295. "F",
  296. "G",
  297. "H",
  298. "I",
  299. "J",
  300. "K",
  301. "L",
  302. "M",
  303. "N",
  304. "O",
  305. "P",
  306. "Q",
  307. "R",
  308. "S",
  309. "T",
  310. "U",
  311. "V",
  312. "W",
  313. "X",
  314. "Y",
  315. "Z",
  316. " "
  317. ];
  318. const double MARGIN_VERTICAL = 10.0;
  319. const double GROUP_TITLE_HEIGHT = 24.0;