Showing
3 changed files
with
118 additions
and
102 deletions
... | @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; | ... | @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; |
2 | import 'package:one_poem/res/resources.dart'; | 2 | import 'package:one_poem/res/resources.dart'; |
3 | import 'package:one_poem/routers/fluro_navigator.dart'; | 3 | import 'package:one_poem/routers/fluro_navigator.dart'; |
4 | import 'package:one_poem/routers/routers.dart'; | 4 | import 'package:one_poem/routers/routers.dart'; |
5 | -import 'package:one_poem/util/toast_utils.dart'; | ||
6 | import 'package:one_poem/widgets/my_app_bar.dart'; | 5 | import 'package:one_poem/widgets/my_app_bar.dart'; |
7 | 6 | ||
8 | import 'package:one_poem/extension/int_extension.dart'; | 7 | import 'package:one_poem/extension/int_extension.dart'; | ... | ... |
1 | +import 'package:flutter/cupertino.dart'; | ||
1 | import 'package:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
2 | import 'package:one_poem/res/resources.dart'; | 3 | import 'package:one_poem/res/resources.dart'; |
3 | import 'package:one_poem/routers/fluro_navigator.dart'; | 4 | import 'package:one_poem/routers/fluro_navigator.dart'; |
4 | import 'package:one_poem/routers/routers.dart'; | 5 | import 'package:one_poem/routers/routers.dart'; |
5 | -import 'package:one_poem/util/toast_utils.dart'; | ||
6 | import 'package:one_poem/widgets/my_app_bar.dart'; | 6 | import 'package:one_poem/widgets/my_app_bar.dart'; |
7 | 7 | ||
8 | import 'package:one_poem/extension/int_extension.dart'; | 8 | import 'package:one_poem/extension/int_extension.dart'; |
... | @@ -18,6 +18,8 @@ class PoemPublish extends StatefulWidget { | ... | @@ -18,6 +18,8 @@ class PoemPublish extends StatefulWidget { |
18 | } | 18 | } |
19 | 19 | ||
20 | class _PoemPublishState extends State<PoemPublish> { | 20 | class _PoemPublishState extends State<PoemPublish> { |
21 | + bool isPublishing = false; | ||
22 | + | ||
21 | @override | 23 | @override |
22 | void initState() { | 24 | void initState() { |
23 | super.initState(); | 25 | super.initState(); |
... | @@ -45,120 +47,136 @@ class _PoemPublishState extends State<PoemPublish> { | ... | @@ -45,120 +47,136 @@ class _PoemPublishState extends State<PoemPublish> { |
45 | ), | 47 | ), |
46 | ), | 48 | ), |
47 | ), | 49 | ), |
48 | - body: Column( | 50 | + body: Stack( |
49 | - crossAxisAlignment: CrossAxisAlignment.start, | 51 | + children: [ |
50 | - children: <Widget>[ | 52 | + Column( |
51 | - Padding( | 53 | + crossAxisAlignment: CrossAxisAlignment.start, |
52 | - padding: const EdgeInsets.all( | 54 | + children: <Widget>[ |
53 | - 10.0, | 55 | + Padding( |
54 | - ), | 56 | + padding: const EdgeInsets.all( |
55 | - child: ConstrainedBox( | 57 | + 10.0, |
56 | - constraints: const BoxConstraints( | ||
57 | - maxHeight: 200, | ||
58 | - maxWidth: double.infinity, | ||
59 | - ), | ||
60 | - child: TextField( | ||
61 | - maxLines: 10, | ||
62 | - decoration: InputDecoration( | ||
63 | - contentPadding: const EdgeInsets.all(10.0), | ||
64 | - hintText: '读此一言,仿佛身临其境', | ||
65 | - border: OutlineInputBorder( | ||
66 | - borderRadius: BorderRadius.circular(5), | ||
67 | - borderSide: BorderSide.none), | ||
68 | - filled: true, | ||
69 | - fillColor: Colors.grey.shade100, | ||
70 | - ), | ||
71 | - ), | ||
72 | - ), | ||
73 | - ), | ||
74 | - Container( | ||
75 | - padding: EdgeInsets.all(10.px), | ||
76 | - alignment: Alignment.centerLeft, | ||
77 | - width: double.infinity, | ||
78 | - height: 36.px, | ||
79 | - child: Wrap( | ||
80 | - children: [ | ||
81 | - Icon( | ||
82 | - Icons.room_outlined, | ||
83 | - size: 15.px, | ||
84 | - ), | ||
85 | - Gaps.hGap5, | ||
86 | - const Text( | ||
87 | - "我在此地", | ||
88 | - style: TextStyle(color: Colors.black45), | ||
89 | ), | 58 | ), |
90 | - ], | 59 | + child: ConstrainedBox( |
91 | - ), | 60 | + constraints: const BoxConstraints( |
92 | - ), | 61 | + maxHeight: 200, |
93 | - Container( | 62 | + maxWidth: double.infinity, |
94 | - padding: EdgeInsets.all(10.px), | 63 | + ), |
95 | - alignment: Alignment.centerLeft, | 64 | + child: TextField( |
96 | - width: double.infinity, | 65 | + maxLines: 10, |
97 | - height: 36.px, | 66 | + decoration: InputDecoration( |
98 | - child: Wrap( | 67 | + contentPadding: const EdgeInsets.all(10.0), |
99 | - children: [ | 68 | + hintText: '读此一言,仿佛身临其境', |
100 | - Icon( | 69 | + border: OutlineInputBorder( |
101 | - Icons.record_voice_over_outlined, | 70 | + borderRadius: BorderRadius.circular(5), |
102 | - size: 15.px, | 71 | + borderSide: BorderSide.none), |
72 | + filled: true, | ||
73 | + fillColor: Colors.grey.shade100, | ||
74 | + ), | ||
75 | + ), | ||
103 | ), | 76 | ), |
104 | - Gaps.hGap5, | 77 | + ), |
105 | - const Text( | 78 | + Container( |
106 | - "所用口音", | 79 | + padding: EdgeInsets.all(10.px), |
107 | - style: TextStyle(color: Colors.black45), | 80 | + alignment: Alignment.centerLeft, |
81 | + width: double.infinity, | ||
82 | + height: 36.px, | ||
83 | + child: Wrap( | ||
84 | + children: [ | ||
85 | + Icon( | ||
86 | + Icons.room_outlined, | ||
87 | + size: 15.px, | ||
88 | + ), | ||
89 | + Gaps.hGap5, | ||
90 | + const Text( | ||
91 | + "我在此地", | ||
92 | + style: TextStyle(color: Colors.black45), | ||
93 | + ), | ||
94 | + ], | ||
108 | ), | 95 | ), |
109 | - Gaps.hGap10, | 96 | + ), |
110 | - const Text( | 97 | + Container( |
111 | - "普通话", | 98 | + padding: EdgeInsets.all(10.px), |
112 | - style: TextStyle(color: Colors.black45), | 99 | + alignment: Alignment.centerLeft, |
100 | + width: double.infinity, | ||
101 | + height: 36.px, | ||
102 | + child: Wrap( | ||
103 | + children: [ | ||
104 | + Icon( | ||
105 | + Icons.record_voice_over_outlined, | ||
106 | + size: 15.px, | ||
107 | + ), | ||
108 | + Gaps.hGap5, | ||
109 | + const Text( | ||
110 | + "所用口音", | ||
111 | + style: TextStyle(color: Colors.black45), | ||
112 | + ), | ||
113 | + Gaps.hGap10, | ||
114 | + const Text( | ||
115 | + "普通话", | ||
116 | + style: TextStyle(color: Colors.black45), | ||
117 | + ), | ||
118 | + ], | ||
113 | ), | 119 | ), |
114 | - ], | 120 | + ), |
115 | - ), | 121 | + const Spacer(), |
116 | - ), | 122 | + Expanded( |
117 | - const Spacer(), | 123 | + child: Center( |
118 | - Expanded( | 124 | + child: Column( |
119 | - child: Center( | 125 | + crossAxisAlignment: CrossAxisAlignment.center, |
120 | - child: Column( | 126 | + mainAxisAlignment: MainAxisAlignment.center, |
121 | - crossAxisAlignment: CrossAxisAlignment.center, | 127 | + children: [ |
122 | - mainAxisAlignment: MainAxisAlignment.center, | 128 | + Text( |
123 | - children: [ | 129 | + "发布临境,让更多人身临其境", |
124 | - Text( | 130 | + style: TextStyle(fontSize: 14.px), |
125 | - "发布临境,让更多人身临其境", | 131 | + ), |
126 | - style: TextStyle(fontSize: 14.px), | 132 | + Gaps.vGap10, |
127 | - ), | 133 | + TextButton( |
128 | - Gaps.vGap10, | 134 | + style: ButtonStyle( |
129 | - TextButton( | 135 | + side: MaterialStateProperty.all( |
130 | - style: ButtonStyle( | 136 | + BorderSide( |
131 | - side: MaterialStateProperty.all( | 137 | + color: Colors.black54, |
132 | - BorderSide( | 138 | + width: 1.px, |
133 | - color: Colors.black54, | 139 | + ), |
134 | - width: 1.px, | 140 | + ), |
141 | + ), | ||
142 | + onPressed: () { | ||
143 | + publishPoem(context); | ||
144 | + }, | ||
145 | + child: Text( | ||
146 | + "发布", | ||
147 | + style: TextStyle( | ||
148 | + color: Colors.black54, fontSize: 15.px), | ||
135 | ), | 149 | ), |
136 | ), | 150 | ), |
137 | - ), | 151 | + ], |
138 | - onPressed: () { | ||
139 | - publishPoem(context); | ||
140 | - }, | ||
141 | - child: Text( | ||
142 | - "发布", | ||
143 | - style: | ||
144 | - TextStyle(color: Colors.black54, fontSize: 15.px), | ||
145 | - ), | ||
146 | ), | 152 | ), |
147 | - ], | 153 | + ), |
148 | ), | 154 | ), |
149 | - ), | 155 | + ], |
150 | ), | 156 | ), |
157 | + isPublishing | ||
158 | + ? const Center( | ||
159 | + child: CupertinoActivityIndicator( | ||
160 | + radius: 16.0, | ||
161 | + ), | ||
162 | + ) | ||
163 | + : Container(), | ||
151 | ], | 164 | ], |
152 | ), | 165 | ), |
153 | ), | 166 | ), |
154 | ); | 167 | ); |
155 | } | 168 | } |
156 | 169 | ||
157 | - void publishPoem(BuildContext context) { | 170 | + Future<void> publishPoem(BuildContext context) async { |
158 | - NavigatorUtils.push( | 171 | + isPublishing = true; |
159 | - context, | 172 | + setState(() {}); |
160 | - '${PoemRouter.poemCompletePage}?id=100', | 173 | + // TODO 等待套入正式接口发布临境 |
161 | - ); | 174 | + await Future.delayed(const Duration(seconds: 2), () { |
175 | + NavigatorUtils.push( | ||
176 | + context, | ||
177 | + '${PoemRouter.poemCompletePage}?id=100', | ||
178 | + ); | ||
179 | + }); | ||
162 | } | 180 | } |
163 | 181 | ||
164 | Future<bool> _isExit() async { | 182 | Future<bool> _isExit() async { | ... | ... |
... | @@ -47,7 +47,6 @@ class _PoemRecordVideoPageState extends State<PoemRecordVideoPage> | ... | @@ -47,7 +47,6 @@ class _PoemRecordVideoPageState extends State<PoemRecordVideoPage> |
47 | 47 | ||
48 | ///记录当前的时间 | 48 | ///记录当前的时间 |
49 | int currentTimer = 0; | 49 | int currentTimer = 0; |
50 | - | ||
51 | int duration = 10 * 1000; //TODO 60 * 1000; | 50 | int duration = 10 * 1000; //TODO 60 * 1000; |
52 | 51 | ||
53 | @override | 52 | @override | ... | ... |
-
Please register or login to post a comment