Hibok
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

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