Skip to content

Commit 1e062e5

Browse files
committed
fix:修复登录问题
1 parent 6f86796 commit 1e062e5

File tree

4 files changed

+72
-72
lines changed

4 files changed

+72
-72
lines changed

lib/page/app_login/index.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ class _IndexState extends State<Index> {
134134
.validate()) {
135135
await Store.value<UserModel>(context)
136136
.$loginController(context, {
137-
'name': nameCtl.text,
138-
'pwd': pwdCtl.text
137+
'name': nameCtl.text.trim(),
138+
'pwd': pwdCtl.text.trim()
139139
});
140140
}
141141
},

lib/store/objects/github_resp_info.dart

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
class GitHubRespInfo extends Object {
55
num id;
66
String url;
7-
Map app;
7+
App app;
88
String token;
99
String hashed_token;
1010
String token_last_eight;
@@ -45,19 +45,19 @@ class GitHubRespInfo extends Object {
4545
fingerprint = json['fingerprint'];
4646
}
4747

48-
Map<String, dynamic> toJson(instance) => {
49-
'id': instance.id,
50-
'url': instance.url,
51-
'app': App.fromJson(instance.app),
52-
'token': instance.token,
53-
'hashed_token': instance.hashed_token,
54-
'token_last_eight': instance.token_last_eight,
55-
'note': instance.note,
56-
'note_url': instance.note_url,
57-
'created_at': instance.created_at,
58-
'updated_at': instance.updated_at,
59-
'scopes': instance.scopes,
60-
'fingerprint': instance.fingerprint,
48+
Map<String, dynamic> toJson() => {
49+
'id': id,
50+
'url': url,
51+
'app': App.fromJson(app),
52+
'token': token,
53+
'hashed_token': hashed_token,
54+
'token_last_eight': token_last_eight,
55+
'note': note,
56+
'note_url': note_url,
57+
'created_at': created_at,
58+
'updated_at': updated_at,
59+
'scopes': scopes,
60+
'fingerprint': fingerprint,
6161
};
6262
}
6363

@@ -84,11 +84,11 @@ class App extends Object {
8484
map = json['map'];
8585
}
8686

87-
Map<String, dynamic> toJson(instance) => {
88-
'str': instance.str,
89-
'number': instance.number,
90-
'boolean': instance.boolean,
91-
'array': instance.array,
92-
'map': instance.map,
87+
Map<String, dynamic> toJson() => {
88+
'str': str,
89+
'number': number,
90+
'boolean': boolean,
91+
'array': array,
92+
'map': map,
9393
};
9494
}

lib/store/objects/user_info.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class UserInfo extends Object {
119119
disk_usage = instance['disk_usage'];
120120
collaborators = instance['collaborators'];
121121
two_factor_authentication = instance['two_factor_authentication'];
122-
plan = Plan.fromJson(json.decode(instance['plan']));
122+
plan = Plan.fromJson(instance['plan']);
123123
}
124124

125125
Map<String, dynamic> toJson() => {
@@ -160,7 +160,7 @@ class UserInfo extends Object {
160160
'disk_usage': disk_usage,
161161
'collaborators': collaborators,
162162
'two_factor_authentication': two_factor_authentication,
163-
'plan': json.encode(plan),
163+
'plan': plan,
164164
};
165165
}
166166

@@ -177,8 +177,11 @@ class Plan extends Object {
177177
this.private_repos,
178178
});
179179

180-
Plan.fromJson(Map<String, dynamic> instance) {
180+
Plan.fromJson(instance) {
181181
if (instance != null) {
182+
if (instance.runtimeType == String) {
183+
instance = json.decode(instance);
184+
}
182185
name = instance['name'];
183186
space = instance['space'];
184187
collaborators = instance['collaborators'];

lib/widget/common/iconbutton/demo.dart

Lines changed: 44 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Index extends StatefulWidget {
66
}
77

88
class _IndexState extends State<Index> {
9-
List data = [58273,58275,59493,57903,58283,58284,57771,58285];
9+
List data = [58273, 58275, 59493, 57903, 58283, 58284, 57771, 58285];
1010
int index = 0;
1111
@override
1212
void initState() {
@@ -16,52 +16,49 @@ class _IndexState extends State<Index> {
1616
@override
1717
Widget build(BuildContext context) {
1818
return Scaffold(
19-
appBar: AppBar(
20-
title: Text('IconButton'),
21-
),
22-
body: Container(
23-
padding: EdgeInsets.fromLTRB(20.0, 0, 20.0, 0),
24-
child: ListView(
25-
children: <Widget>[
26-
IconButton(
27-
iconSize: 30.0,
28-
padding: EdgeInsets.all(8.0),
29-
alignment: Alignment.center,
30-
icon: Icon(IconData(
31-
data[index],
32-
fontFamily: 'MaterialIcons',
33-
matchTextDirection: true
34-
)),
35-
color: Theme.of(context).primaryColor,
36-
highlightColor: Colors.black12,
37-
splashColor: Theme.of(context).primaryColorLight,
38-
onPressed: (){
39-
if (index < 7) {
40-
this.setState(() {
41-
index = index + 1;
42-
});
43-
} else {
44-
this.setState(() {
45-
index = 0;
46-
});
47-
}
48-
},
49-
tooltip: '长按文本提示',
50-
),
51-
IconButton(
52-
iconSize: 30.0,
53-
padding: EdgeInsets.all(8.0),
54-
alignment: Alignment.center,
55-
icon: Icon(Icons.sync_disabled),
56-
color: Theme.of(context).primaryColor,
57-
highlightColor: Colors.black12,
58-
splashColor: Theme.of(context).primaryColorLight,
59-
tooltip: '长按文本提示',
60-
disabledColor: Colors.grey
61-
)
62-
],
19+
appBar: AppBar(
20+
title: Text('IconButton'),
6321
),
64-
)
65-
);
22+
body: Container(
23+
padding: EdgeInsets.fromLTRB(20.0, 0, 20.0, 0),
24+
child: ListView(
25+
children: <Widget>[
26+
IconButton(
27+
iconSize: 30.0,
28+
padding: EdgeInsets.all(8.0),
29+
alignment: Alignment.center,
30+
icon: Icon(IconData(data[index],
31+
fontFamily: 'MaterialIcons', matchTextDirection: true)),
32+
color: Theme.of(context).primaryColor,
33+
highlightColor: Colors.black12,
34+
splashColor: Theme.of(context).primaryColorLight,
35+
onPressed: () {
36+
if (index < 7) {
37+
this.setState(() {
38+
index = index + 1;
39+
});
40+
} else {
41+
this.setState(() {
42+
index = 0;
43+
});
44+
}
45+
},
46+
tooltip: '长按文本提示',
47+
),
48+
IconButton(
49+
iconSize: 30.0,
50+
padding: EdgeInsets.all(8.0),
51+
alignment: Alignment.center,
52+
icon: Icon(Icons.sync_disabled),
53+
color: Theme.of(context).primaryColor,
54+
highlightColor: Colors.black12,
55+
splashColor: Theme.of(context).primaryColorLight,
56+
tooltip: '长按文本提示',
57+
disabledColor: Colors.grey,
58+
onPressed: () {},
59+
)
60+
],
61+
),
62+
));
6663
}
6764
}

0 commit comments

Comments
 (0)