Showing
3 changed files
with
27 additions
and
34 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,8 +398,8 @@ class _PointSelectTextButton extends StatelessWidget { | ... | @@ -403,8 +398,8 @@ 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, | 
| ... | @@ -443,8 +438,7 @@ class TextGroup extends StatelessWidget { | ... | @@ -443,8 +438,7 @@ 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, | ||
| 448 | this.tag, { | 442 | this.tag, { | 
| 449 | Key? key, | 443 | Key? key, | 
| 450 | this.color, | 444 | this.color, | ... | ... | 
| ... | @@ -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