Hibok
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

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