Hibok
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 
 

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