about_page.dart 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. import 'package:flutter/material.dart';
  2. import 'CommonWebPage.dart';
  3. /// Description: 关于页面
  4. /// Time : 08/14/2022 Sunday
  5. /// Author : liuyuqi.gov@msn.cn
  6. class AboutPage extends StatefulWidget {
  7. @override
  8. State<StatefulWidget> createState() {
  9. return AboutPageState();
  10. }
  11. }
  12. class AboutPageState extends State<AboutPage> {
  13. bool showImage = false;
  14. TextStyle textStyle = TextStyle(
  15. color: Colors.blue,
  16. decoration: TextDecoration.combine([TextDecoration.underline]));
  17. late Widget authorLink, mayunLink, githubLink;
  18. List<String> urls = [];
  19. List<String> titles = [];
  20. AboutPageState() {
  21. titles.add("yubo's blog");
  22. titles.add("码云");
  23. titles.add("GitHub");
  24. urls.add("https://yubo725.top");
  25. urls.add("https://gitee.com/yubo725");
  26. urls.add("https://github.com/yubo725");
  27. authorLink = GestureDetector(
  28. child: Container(
  29. margin: const EdgeInsets.fromLTRB(0.0, 80.0, 0.0, 0.0),
  30. child: Row(
  31. mainAxisAlignment: MainAxisAlignment.center,
  32. children: [
  33. Text("作者:"),
  34. Text(
  35. "yubo",
  36. style: textStyle,
  37. ),
  38. ],
  39. ),
  40. ),
  41. onTap: getLink(0),
  42. );
  43. mayunLink = GestureDetector(
  44. child: Container(
  45. margin: const EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 0.0),
  46. child: Row(
  47. mainAxisAlignment: MainAxisAlignment.center,
  48. children: [
  49. Text("码云:"),
  50. Text(
  51. "https://gitee.com/yubo725",
  52. style: textStyle,
  53. )
  54. ],
  55. ),
  56. ),
  57. onTap: getLink(1),
  58. );
  59. githubLink = GestureDetector(
  60. child: Container(
  61. margin: const EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 0.0),
  62. child: Row(
  63. mainAxisAlignment: MainAxisAlignment.center,
  64. children: [
  65. Text("GitHub:"),
  66. Text(
  67. "https://github.com/yubo725",
  68. style: textStyle,
  69. ),
  70. ],
  71. ),
  72. ),
  73. onTap: getLink(2),
  74. );
  75. }
  76. getLink(index) {
  77. String url = urls[index];
  78. String title = titles[index];
  79. return () {
  80. Navigator.of(context).push(MaterialPageRoute(builder: (ctx) {
  81. return CommonWebPage(title: title, url: url);
  82. }));
  83. };
  84. }
  85. Widget getImageOrBtn() {
  86. if (!showImage) {
  87. return Container(
  88. child: Center(
  89. child: InkWell(
  90. child: Container(
  91. padding: const EdgeInsets.fromLTRB(15.0, 8.0, 15.0, 8.0),
  92. child: Text("不要点我"),
  93. decoration: BoxDecoration(
  94. border: Border.all(color: Colors.black),
  95. borderRadius: BorderRadius.all(Radius.circular(5.0))),
  96. ),
  97. onTap: () {
  98. setState(() {
  99. showImage = true;
  100. });
  101. },
  102. ),
  103. ),
  104. );
  105. } else {
  106. return Image.asset(
  107. './images/ic_hongshu.jpg',
  108. width: 100.0,
  109. height: 100.0,
  110. );
  111. }
  112. }
  113. @override
  114. Widget build(BuildContext context) {
  115. return Scaffold(
  116. appBar: AppBar(
  117. title: Text("关于", style: TextStyle(color: Colors.white)),
  118. iconTheme: IconThemeData(color: Colors.white),
  119. ),
  120. body: Center(
  121. child: Column(
  122. children: [
  123. Container(
  124. width: 1.0,
  125. height: 100.0,
  126. color: Colors.transparent,
  127. ),
  128. Image.asset(
  129. './images/ic_osc_logo.png',
  130. width: 200.0,
  131. height: 56.0,
  132. ),
  133. Text("基于Google Flutter的开源中国客户端"),
  134. authorLink,
  135. mayunLink,
  136. githubLink,
  137. Expanded(flex: 1, child: getImageOrBtn()),
  138. Container(
  139. margin: const EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 15.0),
  140. child: Text(
  141. "本项目仅供学习使用,与开源中国官方无关",
  142. style: TextStyle(fontSize: 12.0),
  143. ))
  144. ],
  145. ),
  146. ));
  147. }
  148. }