这是CaiYouHui前端,一个关于flutter的安卓app,前端使用flutter实现

profile_about_screen.dart 25KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715
  1. import 'package:flutter/material.dart';
  2. import 'package:url_launcher/url_launcher.dart';
  3. import 'package:package_info_plus/package_info_plus.dart';
  4. class AboutUsScreen extends StatefulWidget {
  5. const AboutUsScreen({super.key});
  6. @override
  7. State<AboutUsScreen> createState() => _AboutUsScreenState();
  8. }
  9. class _AboutUsScreenState extends State<AboutUsScreen> {
  10. PackageInfo _packageInfo = PackageInfo(
  11. appName: '未知',
  12. packageName: '未知',
  13. version: '未知',
  14. buildNumber: '未知',
  15. buildSignature: '未知',
  16. );
  17. bool _isLoading = false;
  18. @override
  19. void initState() {
  20. super.initState();
  21. // _initPackageInfo();
  22. }
  23. Future<void> _initPackageInfo() async {
  24. final info = await PackageInfo.fromPlatform();
  25. setState(() {
  26. _packageInfo = info;
  27. _isLoading = false;
  28. });
  29. }
  30. Future<void> _launchURL(String url) async {
  31. final Uri uri = Uri.parse(url);
  32. if (await canLaunchUrl(uri)) {
  33. await launchUrl(uri);
  34. } else {
  35. ScaffoldMessenger.of(context).showSnackBar(
  36. const SnackBar(
  37. content: Text('无法打开链接'),
  38. backgroundColor: Colors.red,
  39. ),
  40. );
  41. }
  42. }
  43. void _showVersionInfo() {
  44. showDialog(
  45. context: context,
  46. builder: (context) => AlertDialog(
  47. title: const Text('版本信息'),
  48. content: Column(
  49. mainAxisSize: MainAxisSize.min,
  50. crossAxisAlignment: CrossAxisAlignment.start,
  51. children: [
  52. _buildInfoItem('应用名称', _packageInfo.appName),
  53. _buildInfoItem('版本号', _packageInfo.version),
  54. _buildInfoItem('构建号', _packageInfo.buildNumber),
  55. _buildInfoItem('包名', _packageInfo.packageName),
  56. ],
  57. ),
  58. actions: [
  59. TextButton(
  60. onPressed: () => Navigator.of(context).pop(),
  61. child: const Text('确定'),
  62. ),
  63. ],
  64. ),
  65. );
  66. }
  67. Widget _buildInfoItem(String label, String value) {
  68. return Padding(
  69. padding: const EdgeInsets.symmetric(vertical: 6),
  70. child: Row(
  71. crossAxisAlignment: CrossAxisAlignment.start,
  72. children: [
  73. SizedBox(
  74. width: 80,
  75. child: Text(
  76. '$label:',
  77. style: const TextStyle(
  78. fontWeight: FontWeight.bold,
  79. color: Colors.grey,
  80. ),
  81. ),
  82. ),
  83. Expanded(
  84. child: Text(
  85. value,
  86. style: const TextStyle(color: Colors.black87),
  87. ),
  88. ),
  89. ],
  90. ),
  91. );
  92. }
  93. @override
  94. Widget build(BuildContext context) {
  95. return Scaffold(
  96. appBar: AppBar(
  97. title: const Text('关于我们'),
  98. centerTitle: true,
  99. ),
  100. body: _isLoading
  101. ? const Center(child: CircularProgressIndicator())
  102. : SingleChildScrollView(
  103. child: Column(
  104. children: [
  105. // 应用Logo和名称区域
  106. Container(
  107. padding: const EdgeInsets.symmetric(vertical: 40),
  108. decoration: BoxDecoration(
  109. gradient: LinearGradient(
  110. begin: Alignment.topCenter,
  111. end: Alignment.bottomCenter,
  112. colors: [
  113. Colors.red[50]!,
  114. Colors.orange[50]!,
  115. ],
  116. ),
  117. ),
  118. child: Column(
  119. children: [
  120. // 应用Logo
  121. Container(
  122. width: 120,
  123. height: 120,
  124. decoration: BoxDecoration(
  125. color: Colors.white,
  126. borderRadius: BorderRadius.circular(30),
  127. boxShadow: [
  128. BoxShadow(
  129. color: Colors.red.withOpacity(0.2),
  130. blurRadius: 20,
  131. offset: const Offset(0, 10),
  132. ),
  133. ],
  134. ),
  135. child: const Icon(
  136. Icons.emoji_events,
  137. size: 60,
  138. color: Colors.red,
  139. ),
  140. ),
  141. const SizedBox(height: 20),
  142. // 应用名称
  143. const Text(
  144. '中了么',
  145. style: TextStyle(
  146. fontSize: 32,
  147. fontWeight: FontWeight.bold,
  148. color: Colors.red,
  149. ),
  150. ),
  151. const SizedBox(height: 8),
  152. // 宣传语
  153. const Text(
  154. '专业彩票资讯,开启幸运之门',
  155. style: TextStyle(
  156. fontSize: 16,
  157. color: Colors.orange,
  158. fontStyle: FontStyle.italic,
  159. ),
  160. ),
  161. const SizedBox(height: 16),
  162. // 版本信息
  163. GestureDetector(
  164. onTap: _showVersionInfo,
  165. child: Container(
  166. padding: const EdgeInsets.symmetric(
  167. horizontal: 16,
  168. vertical: 6,
  169. ),
  170. decoration: BoxDecoration(
  171. color: Colors.white.withOpacity(0.8),
  172. borderRadius: BorderRadius.circular(20),
  173. ),
  174. child: Text(
  175. '版本 ${_packageInfo.version}',
  176. style: const TextStyle(
  177. color: Colors.red,
  178. fontWeight: FontWeight.w500,
  179. ),
  180. ),
  181. ),
  182. ),
  183. ],
  184. ),
  185. ),
  186. // 应用介绍卡片
  187. _buildSectionCard(
  188. title: '应用介绍',
  189. icon: Icons.info_outline,
  190. color: Colors.blue,
  191. child: const Column(
  192. crossAxisAlignment: CrossAxisAlignment.start,
  193. children: [
  194. Text(
  195. '「中了么」是一款专业的彩票资讯服务平台,致力于为用户提供全面、及时、准确的彩票信息。我们不是彩票销售平台,而是您获取彩票资讯、分析数据和社区交流的得力助手。',
  196. style: TextStyle(
  197. height: 1.6,
  198. color: Colors.black87,
  199. ),
  200. ),
  201. SizedBox(height: 12),
  202. Row(
  203. children: [
  204. Icon(Icons.check_circle, color: Colors.green, size: 16),
  205. SizedBox(width: 8),
  206. Expanded(child: Text('合法合规:严格遵守国家法律法规')),
  207. ],
  208. ),
  209. SizedBox(height: 6),
  210. Row(
  211. children: [
  212. Icon(Icons.check_circle, color: Colors.green, size: 16),
  213. SizedBox(width: 8),
  214. Expanded(child: Text('信息透明:所有数据公开可查')),
  215. ],
  216. ),
  217. SizedBox(height: 6),
  218. Row(
  219. children: [
  220. Icon(Icons.check_circle, color: Colors.green, size: 16),
  221. SizedBox(width: 8),
  222. Expanded(child: Text('理性推荐:倡导健康购彩理念')),
  223. ],
  224. ),
  225. ],
  226. ),
  227. ),
  228. // 核心功能
  229. _buildSectionCard(
  230. title: '核心功能',
  231. icon: Icons.stars,
  232. color: Colors.amber,
  233. child: Column(
  234. children: [
  235. _buildFeatureItem(
  236. icon: Icons.notifications_active,
  237. title: '开奖通知',
  238. description: '第一时间推送最新开奖结果',
  239. color: Colors.red,
  240. ),
  241. _buildFeatureItem(
  242. icon: Icons.analytics,
  243. title: '数据统计',
  244. description: '历史数据深度分析和趋势预测',
  245. color: Colors.blue,
  246. ),
  247. _buildFeatureItem(
  248. icon: Icons.article,
  249. title: '资讯快报',
  250. description: '行业动态和玩法技巧专业解读',
  251. color: Colors.green,
  252. ),
  253. _buildFeatureItem(
  254. icon: Icons.people,
  255. title: '彩民社区',
  256. description: '与千万彩民交流经验心得',
  257. color: Colors.purple,
  258. ),
  259. _buildFeatureItem(
  260. icon: Icons.security,
  261. title: '风险提示',
  262. description: '购彩风险提示和理性建议',
  263. color: Colors.orange,
  264. ),
  265. ],
  266. ),
  267. ),
  268. // 开发团队
  269. _buildSectionCard(
  270. title: '开发团队',
  271. icon: Icons.group,
  272. color: Colors.purple,
  273. child: Column(
  274. children: [
  275. _buildTeamMember(
  276. name: '技术团队',
  277. description: '来自一线互联网公司的技术专家,拥有丰富的移动开发经验',
  278. avatarColor: Colors.blue,
  279. ),
  280. _buildTeamMember(
  281. name: '数据分析团队',
  282. description: '统计学和数据分析专业人士,提供精准的数据支持',
  283. avatarColor: Colors.green,
  284. ),
  285. _buildTeamMember(
  286. name: '内容团队',
  287. description: '资深彩票行业编辑,确保资讯的专业性和时效性',
  288. avatarColor: Colors.orange,
  289. ),
  290. _buildTeamMember(
  291. name: '风控团队',
  292. description: '法律和风控专家,确保平台合规运营',
  293. avatarColor: Colors.red,
  294. ),
  295. ],
  296. ),
  297. ),
  298. // 联系我们
  299. _buildSectionCard(
  300. title: '联系我们',
  301. icon: Icons.contact_support,
  302. color: Colors.teal,
  303. child: Column(
  304. children: [
  305. _buildContactItem(
  306. icon: Icons.email,
  307. label: '商务合作',
  308. value: 'business@zhongleme.com',
  309. onTap: () => _launchURL('mailto:business@zhongleme.com'),
  310. ),
  311. _buildContactItem(
  312. icon: Icons.email,
  313. label: '用户反馈',
  314. value: 'feedback@zhongleme.com',
  315. onTap: () => _launchURL('mailto:feedback@zhongleme.com'),
  316. ),
  317. _buildContactItem(
  318. icon: Icons.phone,
  319. label: '客服热线',
  320. value: '400-888-8888',
  321. onTap: () => _launchURL('tel:4008888888'),
  322. ),
  323. _buildContactItem(
  324. icon: Icons.language,
  325. label: '官方网站',
  326. value: 'https://www.zhongleme.com',
  327. onTap: () => _launchURL('https://www.zhongleme.com'),
  328. ),
  329. const SizedBox(height: 16),
  330. const Text(
  331. '工作时间:周一至周五 9:00-18:00',
  332. style: TextStyle(
  333. color: Colors.grey,
  334. fontSize: 13,
  335. ),
  336. ),
  337. ],
  338. ),
  339. ),
  340. // 法律声明
  341. _buildSectionCard(
  342. title: '法律声明',
  343. icon: Icons.gavel,
  344. color: Colors.grey,
  345. child: const Column(
  346. crossAxisAlignment: CrossAxisAlignment.start,
  347. children: [
  348. Text(
  349. '1. 本应用提供的所有资讯仅供参考,不构成任何投注建议。',
  350. style: TextStyle(fontSize: 13, color: Colors.grey),
  351. ),
  352. SizedBox(height: 6),
  353. Text(
  354. '2. 彩票有风险,请理性购彩。未满18周岁不得购买彩票。',
  355. style: TextStyle(fontSize: 13, color: Colors.grey),
  356. ),
  357. SizedBox(height: 6),
  358. Text(
  359. '3. 我们严格遵守《互联网信息服务管理办法》等相关法律法规。',
  360. style: TextStyle(fontSize: 13, color: Colors.grey),
  361. ),
  362. SizedBox(height: 6),
  363. Text(
  364. '4. 用户在使用过程中应遵守当地法律法规,对自己的行为负责。',
  365. style: TextStyle(fontSize: 13, color: Colors.grey),
  366. ),
  367. SizedBox(height: 12),
  368. Center(
  369. child: Text(
  370. '© 2023 中了么 版权所有',
  371. style: TextStyle(
  372. fontSize: 12,
  373. color: Colors.grey,
  374. fontWeight: FontWeight.bold,
  375. ),
  376. ),
  377. ),
  378. ],
  379. ),
  380. ),
  381. // 社交平台
  382. Container(
  383. padding: const EdgeInsets.all(20),
  384. child: Column(
  385. children: [
  386. const Text(
  387. '关注我们',
  388. style: TextStyle(
  389. fontSize: 18,
  390. fontWeight: FontWeight.bold,
  391. ),
  392. ),
  393. const SizedBox(height: 16),
  394. Row(
  395. mainAxisAlignment: MainAxisAlignment.center,
  396. children: [
  397. _buildSocialButton(
  398. icon: Icons.wechat,
  399. label: '微信',
  400. onTap: () => _showWechatQRCode(context),
  401. ),
  402. _buildSocialButton(
  403. icon: Icons.camera_alt,
  404. label: '微博',
  405. onTap: () => _launchURL('https://weibo.com/zhongleme'),
  406. ),
  407. _buildSocialButton(
  408. icon: Icons.videocam,
  409. label: '抖音',
  410. onTap: () => _launchURL('https://www.douyin.com/zhongleme'),
  411. ),
  412. ],
  413. ),
  414. ],
  415. ),
  416. ),
  417. const SizedBox(height: 40),
  418. ],
  419. ),
  420. ),
  421. );
  422. }
  423. Widget _buildSectionCard({
  424. required String title,
  425. required IconData icon,
  426. required Color color,
  427. required Widget child,
  428. }) {
  429. return Container(
  430. margin: const EdgeInsets.fromLTRB(16, 8, 16, 8),
  431. padding: const EdgeInsets.all(20),
  432. decoration: BoxDecoration(
  433. color: Colors.white,
  434. borderRadius: BorderRadius.circular(16),
  435. boxShadow: [
  436. BoxShadow(
  437. color: Colors.grey.withOpacity(0.1),
  438. blurRadius: 10,
  439. offset: const Offset(0, 5),
  440. ),
  441. ],
  442. ),
  443. child: Column(
  444. crossAxisAlignment: CrossAxisAlignment.start,
  445. children: [
  446. Row(
  447. children: [
  448. Container(
  449. padding: const EdgeInsets.all(8),
  450. decoration: BoxDecoration(
  451. color: color.withOpacity(0.1),
  452. borderRadius: BorderRadius.circular(10),
  453. ),
  454. child: Icon(icon, color: color, size: 24),
  455. ),
  456. const SizedBox(width: 12),
  457. Text(
  458. title,
  459. style: TextStyle(
  460. fontSize: 20,
  461. fontWeight: FontWeight.bold,
  462. color: color,
  463. ),
  464. ),
  465. ],
  466. ),
  467. const SizedBox(height: 16),
  468. child,
  469. ],
  470. ),
  471. );
  472. }
  473. Widget _buildFeatureItem({
  474. required IconData icon,
  475. required String title,
  476. required String description,
  477. required Color color,
  478. }) {
  479. return Container(
  480. margin: const EdgeInsets.only(bottom: 12),
  481. child: Row(
  482. crossAxisAlignment: CrossAxisAlignment.start,
  483. children: [
  484. Container(
  485. width: 40,
  486. height: 40,
  487. decoration: BoxDecoration(
  488. color: color.withOpacity(0.1),
  489. borderRadius: BorderRadius.circular(10),
  490. ),
  491. child: Icon(icon, color: color, size: 22),
  492. ),
  493. const SizedBox(width: 12),
  494. Expanded(
  495. child: Column(
  496. crossAxisAlignment: CrossAxisAlignment.start,
  497. children: [
  498. Text(
  499. title,
  500. style: const TextStyle(
  501. fontWeight: FontWeight.bold,
  502. fontSize: 16,
  503. ),
  504. ),
  505. const SizedBox(height: 4),
  506. Text(
  507. description,
  508. style: TextStyle(
  509. color: Colors.grey[700],
  510. fontSize: 14,
  511. ),
  512. ),
  513. ],
  514. ),
  515. ),
  516. ],
  517. ),
  518. );
  519. }
  520. Widget _buildTeamMember({
  521. required String name,
  522. required String description,
  523. required Color avatarColor,
  524. }) {
  525. return Container(
  526. margin: const EdgeInsets.only(bottom: 12),
  527. child: Row(
  528. crossAxisAlignment: CrossAxisAlignment.start,
  529. children: [
  530. CircleAvatar(
  531. backgroundColor: avatarColor.withOpacity(0.1),
  532. radius: 20,
  533. child: Icon(
  534. Icons.person,
  535. color: avatarColor,
  536. size: 20,
  537. ),
  538. ),
  539. const SizedBox(width: 12),
  540. Expanded(
  541. child: Column(
  542. crossAxisAlignment: CrossAxisAlignment.start,
  543. children: [
  544. Text(
  545. name,
  546. style: const TextStyle(
  547. fontWeight: FontWeight.bold,
  548. fontSize: 16,
  549. ),
  550. ),
  551. const SizedBox(height: 4),
  552. Text(
  553. description,
  554. style: TextStyle(
  555. color: Colors.grey[700],
  556. fontSize: 14,
  557. ),
  558. ),
  559. ],
  560. ),
  561. ),
  562. ],
  563. ),
  564. );
  565. }
  566. Widget _buildContactItem({
  567. required IconData icon,
  568. required String label,
  569. required String value,
  570. required VoidCallback onTap,
  571. }) {
  572. return GestureDetector(
  573. onTap: onTap,
  574. child: Container(
  575. margin: const EdgeInsets.only(bottom: 12),
  576. child: Row(
  577. children: [
  578. Container(
  579. width: 40,
  580. height: 40,
  581. decoration: BoxDecoration(
  582. color: Colors.blue.withOpacity(0.1),
  583. borderRadius: BorderRadius.circular(10),
  584. ),
  585. child: Icon(icon, color: Colors.blue, size: 22),
  586. ),
  587. const SizedBox(width: 12),
  588. Expanded(
  589. child: Column(
  590. crossAxisAlignment: CrossAxisAlignment.start,
  591. children: [
  592. Text(
  593. label,
  594. style: const TextStyle(
  595. fontSize: 14,
  596. color: Colors.grey,
  597. ),
  598. ),
  599. Text(
  600. value,
  601. style: const TextStyle(
  602. fontWeight: FontWeight.w500,
  603. fontSize: 16,
  604. ),
  605. ),
  606. ],
  607. ),
  608. ),
  609. const Icon(Icons.chevron_right, color: Colors.grey),
  610. ],
  611. ),
  612. ),
  613. );
  614. }
  615. Widget _buildSocialButton({
  616. required IconData icon,
  617. required String label,
  618. required VoidCallback onTap,
  619. }) {
  620. return GestureDetector(
  621. onTap: onTap,
  622. child: Container(
  623. margin: const EdgeInsets.symmetric(horizontal: 12),
  624. child: Column(
  625. children: [
  626. Container(
  627. width: 60,
  628. height: 60,
  629. decoration: BoxDecoration(
  630. color: Colors.red.withOpacity(0.1),
  631. borderRadius: BorderRadius.circular(30),
  632. ),
  633. child: Icon(icon, color: Colors.red, size: 30),
  634. ),
  635. const SizedBox(height: 8),
  636. Text(label, style: const TextStyle(fontSize: 14)),
  637. ],
  638. ),
  639. ),
  640. );
  641. }
  642. void _showWechatQRCode(BuildContext context) {
  643. showDialog(
  644. context: context,
  645. builder: (context) => Dialog(
  646. shape: RoundedRectangleBorder(
  647. borderRadius: BorderRadius.circular(20),
  648. ),
  649. child: Container(
  650. padding: const EdgeInsets.all(24),
  651. child: Column(
  652. mainAxisSize: MainAxisSize.min,
  653. children: [
  654. const Text(
  655. '关注微信公众号',
  656. style: TextStyle(
  657. fontSize: 18,
  658. fontWeight: FontWeight.bold,
  659. ),
  660. ),
  661. const SizedBox(height: 16),
  662. Container(
  663. width: 200,
  664. height: 200,
  665. decoration: BoxDecoration(
  666. color: Colors.white,
  667. borderRadius: BorderRadius.circular(10),
  668. border: Border.all(color: Colors.grey[300]!),
  669. ),
  670. child: const Icon(
  671. Icons.qr_code_scanner,
  672. size: 100,
  673. color: Colors.grey,
  674. ),
  675. ),
  676. const SizedBox(height: 16),
  677. const Text(
  678. '扫描二维码关注「中了么」公众号',
  679. textAlign: TextAlign.center,
  680. style: TextStyle(color: Colors.grey),
  681. ),
  682. const SizedBox(height: 20),
  683. TextButton(
  684. onPressed: () => Navigator.of(context).pop(),
  685. child: const Text('关闭'),
  686. ),
  687. ],
  688. ),
  689. ),
  690. ),
  691. );
  692. }
  693. }