Showing
3 changed files
with
42 additions
and
49 deletions
1 | +import 'package:Parlando/net/dio_utils.dart'; | ||
2 | +import 'package:Parlando/net/http_api.dart'; | ||
3 | +import 'package:Parlando/res/constant.dart'; | ||
4 | +import 'package:Parlando/util/toast_utils.dart'; | ||
1 | import 'package:flutter/material.dart'; | 5 | import 'package:flutter/material.dart'; |
2 | import 'package:Parlando/membership/membership_router.dart'; | 6 | import 'package:Parlando/membership/membership_router.dart'; |
3 | import 'package:Parlando/poem/poem_router.dart'; | 7 | import 'package:Parlando/poem/poem_router.dart'; |
... | @@ -31,6 +35,25 @@ class AccountPage extends StatefulWidget { | ... | @@ -31,6 +35,25 @@ class AccountPage extends StatefulWidget { |
31 | 35 | ||
32 | class _AccountPageState extends State<AccountPage> { | 36 | class _AccountPageState extends State<AccountPage> { |
33 | @override | 37 | @override |
38 | + void initState() { | ||
39 | + super.initState(); | ||
40 | + | ||
41 | + //todo MVVM? | ||
42 | + Map<String, String> params = <String, String>{ | ||
43 | + "profile": "1", | ||
44 | + }; | ||
45 | + DioUtils.instance.asyncRequestNetwork( | ||
46 | + Method.post, | ||
47 | + HttpApi.login, | ||
48 | + queryParameters: params, | ||
49 | + onSuccess: (data) {}, | ||
50 | + onError: (code, msg) { | ||
51 | + Toast.show(msg.toString()); | ||
52 | + }, | ||
53 | + ); | ||
54 | + } | ||
55 | + | ||
56 | + @override | ||
34 | Widget build(BuildContext context) { | 57 | Widget build(BuildContext context) { |
35 | Widget likeButton = Container( | 58 | Widget likeButton = Container( |
36 | color: ColorPlate.white, | 59 | color: ColorPlate.white, |
... | @@ -248,37 +271,9 @@ class _MembershipButton extends StatelessWidget { | ... | @@ -248,37 +271,9 @@ class _MembershipButton extends StatelessWidget { |
248 | } | 271 | } |
249 | } | 272 | } |
250 | 273 | ||
251 | -class _UserRightButton extends StatelessWidget { | ||
252 | - const _UserRightButton({ | ||
253 | - Key? key, | ||
254 | - required this.title, | ||
255 | - }) : super(key: key); | ||
256 | - | ||
257 | - final String title; | ||
258 | - | ||
259 | - @override | ||
260 | - Widget build(BuildContext context) { | ||
261 | - return Container( | ||
262 | - padding: EdgeInsets.symmetric( | ||
263 | - vertical: 3.px, | ||
264 | - horizontal: 12.px, | ||
265 | - ), | ||
266 | - margin: EdgeInsets.all(8.px), | ||
267 | - alignment: Alignment.center, | ||
268 | - child: Text( | ||
269 | - title, | ||
270 | - style: const TextStyle(color: ColorPlate.orange), | ||
271 | - ), | ||
272 | - decoration: BoxDecoration( | ||
273 | - border: Border.all(color: ColorPlate.orange), | ||
274 | - borderRadius: BorderRadius.circular(4.px), | ||
275 | - ), | ||
276 | - ); | ||
277 | - } | ||
278 | -} | ||
279 | - | ||
280 | class _UserTag extends StatelessWidget { | 274 | class _UserTag extends StatelessWidget { |
281 | final String? tag; | 275 | final String? tag; |
276 | + | ||
282 | const _UserTag({ | 277 | const _UserTag({ |
283 | Key? key, | 278 | Key? key, |
284 | this.tag, | 279 | this.tag, |
... | @@ -403,12 +398,12 @@ class _PointSelectTextButton extends StatelessWidget { | ... | @@ -403,12 +398,12 @@ class _PointSelectTextButton extends StatelessWidget { |
403 | final bool isSelect; | 398 | final bool isSelect; |
404 | final String title; | 399 | final String title; |
405 | final Function? onTap; | 400 | final Function? onTap; |
406 | - const _PointSelectTextButton( | 401 | + |
407 | - this.isSelect, | 402 | + const _PointSelectTextButton(this.isSelect, |
408 | - this.title, { | 403 | + this.title, { |
409 | - Key? key, | 404 | + Key? key, |
410 | - this.onTap, | 405 | + this.onTap, |
411 | - }) : super(key: key); | 406 | + }) : super(key: key); |
412 | 407 | ||
413 | @override | 408 | @override |
414 | Widget build(BuildContext context) { | 409 | Widget build(BuildContext context) { |
... | @@ -418,13 +413,13 @@ class _PointSelectTextButton extends StatelessWidget { | ... | @@ -418,13 +413,13 @@ class _PointSelectTextButton extends StatelessWidget { |
418 | children: <Widget>[ | 413 | children: <Widget>[ |
419 | isSelect | 414 | isSelect |
420 | ? Container( | 415 | ? Container( |
421 | - width: 6.px, | 416 | + width: 6.px, |
422 | - height: 6.px, | 417 | + height: 6.px, |
423 | - decoration: BoxDecoration( | 418 | + decoration: BoxDecoration( |
424 | - color: ColorPlate.orange, | 419 | + color: ColorPlate.orange, |
425 | - borderRadius: BorderRadius.circular(3), | 420 | + borderRadius: BorderRadius.circular(3), |
426 | - ), | 421 | + ), |
427 | - ) | 422 | + ) |
428 | : Container(), | 423 | : Container(), |
429 | Container( | 424 | Container( |
430 | padding: const EdgeInsets.only(left: 2), | 425 | padding: const EdgeInsets.only(left: 2), |
... | @@ -443,12 +438,11 @@ class TextGroup extends StatelessWidget { | ... | @@ -443,12 +438,11 @@ class TextGroup extends StatelessWidget { |
443 | final String title, tag; | 438 | final String title, tag; |
444 | final Color? color; | 439 | final Color? color; |
445 | 440 | ||
446 | - const TextGroup( | 441 | + const TextGroup(this.title, |
447 | - this.title, | 442 | + this.tag, { |
448 | - this.tag, { | 443 | + Key? key, |
449 | - Key? key, | 444 | + this.color, |
450 | - this.color, | 445 | + }) : super(key: key); |
451 | - }) : super(key: key); | ||
452 | 446 | ||
453 | @override | 447 | @override |
454 | Widget build(BuildContext context) { | 448 | Widget build(BuildContext context) { | ... | ... |
... | @@ -126,7 +126,6 @@ class _LoginPageState extends State<LoginPage> | ... | @@ -126,7 +126,6 @@ class _LoginPageState extends State<LoginPage> |
126 | } | 126 | } |
127 | 127 | ||
128 | void _login() { | 128 | void _login() { |
129 | - setState(() {}); | ||
130 | _isLoading = true; | 129 | _isLoading = true; |
131 | setState(() {}); | 130 | setState(() {}); |
132 | Map<String, String> params = <String, String>{ | 131 | Map<String, String> params = <String, String>{ | ... | ... |
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment