AboutPage.dart 4.0 KB

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