AboutPage.dart 4.2 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 new AboutPageState();
  8. }
  9. }
  10. class AboutPageState extends State<AboutPage> {
  11. bool showImage = false;
  12. TextStyle textStyle = new TextStyle(
  13. color: Colors.blue,
  14. decoration: new TextDecoration.combine([TextDecoration.underline]));
  15. Widget authorLink, mayunLink, githubLink;
  16. List<String> urls = new List();
  17. List<String> titles = new 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 = new GestureDetector(
  26. child: new Container(
  27. margin: const EdgeInsets.fromLTRB(0.0, 80.0, 0.0, 0.0),
  28. child: new Row(
  29. mainAxisAlignment: MainAxisAlignment.center,
  30. children: [
  31. new Text("作者:"),
  32. new Text(
  33. "yubo",
  34. style: textStyle,
  35. ),
  36. ],
  37. ),
  38. ),
  39. onTap: getLink(0),
  40. );
  41. mayunLink = new GestureDetector(
  42. child: new Container(
  43. margin: const EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 0.0),
  44. child: new Row(
  45. mainAxisAlignment: MainAxisAlignment.center,
  46. children: [
  47. new Text("码云:"),
  48. new Text(
  49. "https://gitee.com/yubo725",
  50. style: textStyle,
  51. )
  52. ],
  53. ),
  54. ),
  55. onTap: getLink(1),
  56. );
  57. githubLink = new GestureDetector(
  58. child: new Container(
  59. margin: const EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 0.0),
  60. child: new Row(
  61. mainAxisAlignment: MainAxisAlignment.center,
  62. children: [
  63. new Text("GitHub:"),
  64. new 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(new MaterialPageRoute(builder: (ctx) {
  79. return new CommonWebPage(title: title, url: url);
  80. }));
  81. };
  82. }
  83. Widget getImageOrBtn() {
  84. if (!showImage) {
  85. return new Container(
  86. child: new Center(
  87. child: new InkWell(
  88. child: new Container(
  89. padding: const EdgeInsets.fromLTRB(15.0, 8.0, 15.0, 8.0),
  90. child: new Text("不要点我"),
  91. decoration: new BoxDecoration(
  92. border: new Border.all(color: Colors.black),
  93. borderRadius: new BorderRadius.all(new Radius.circular(5.0))),
  94. ),
  95. onTap: () {
  96. setState(() {
  97. showImage = true;
  98. });
  99. },
  100. ),
  101. ),
  102. );
  103. } else {
  104. return new 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 new Scaffold(
  114. appBar: new AppBar(
  115. title: new Text("关于", style: new TextStyle(color: Colors.white)),
  116. iconTheme: new IconThemeData(color: Colors.white),
  117. ),
  118. body: new Center(
  119. child: new Column(
  120. children: [
  121. new Container(
  122. width: 1.0,
  123. height: 100.0,
  124. color: Colors.transparent,
  125. ),
  126. new Image.asset(
  127. './images/ic_osc_logo.png',
  128. width: 200.0,
  129. height: 56.0,
  130. ),
  131. new Text("基于Google Flutter的开源中国客户端"),
  132. authorLink,
  133. mayunLink,
  134. githubLink,
  135. new Expanded(flex: 1, child: getImageOrBtn()),
  136. new Container(
  137. margin: const EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 15.0),
  138. child: new Text(
  139. "本项目仅供学习使用,与开源中国官方无关",
  140. style: new TextStyle(fontSize: 12.0),
  141. ))
  142. ],
  143. ),
  144. ));
  145. }
  146. }