Skip to content

Commit aeccb7e

Browse files
committed
user page
1 parent 195a9ef commit aeccb7e

4 files changed

Lines changed: 8 additions & 6 deletions

File tree

‎lib/common/utils/NavigatorUtils.dart‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/material.dart';
22
import 'package:gsy_github_app_flutter/page/HomePage.dart';
33
import 'package:gsy_github_app_flutter/page/LoginPage.dart';
4+
import 'package:gsy_github_app_flutter/page/PersonPage.dart';
45

56
class NavigatorUtils {
67
static pushReplacementNamed(BuildContext context, String routeName) {
@@ -18,4 +19,8 @@ class NavigatorUtils {
1819
static goLogin(BuildContext context) {
1920
Navigator.pushReplacementNamed(context, LoginPage.sName);
2021
}
22+
23+
static goPerson(BuildContext context, String userName) {
24+
Navigator.push(context, new MaterialPageRoute(builder: (context) => new PersonPage(userName)));
25+
}
2126
}

‎lib/page/PersonPage.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class PersonPage extends StatefulWidget {
2828
class _PersonState extends State<PersonPage> with AutomaticKeepAliveClientMixin {
2929
final String userName;
3030

31-
User userInfo;
31+
User userInfo = User.empty();
3232

3333
_PersonState(this.userName);
3434

‎lib/widget/EventItem.dart‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
22
import 'package:gsy_github_app_flutter/common/style/GSYStyle.dart';
33
import 'package:gsy_github_app_flutter/common/utils/CommonUtils.dart';
44
import 'package:gsy_github_app_flutter/common/utils/EventUtils.dart';
5+
import 'package:gsy_github_app_flutter/common/utils/NavigatorUtils.dart';
56
import 'package:gsy_github_app_flutter/page/PersonPage.dart';
67
import 'package:gsy_github_app_flutter/widget/GSYCardItem.dart';
78

@@ -41,10 +42,7 @@ class EventItem extends StatelessWidget {
4142
),
4243
),
4344
onPressed: () {
44-
Navigator.push(
45-
context,
46-
new MaterialPageRoute(builder: (context) => new PersonPage(eventViewModel.actionUser)),
47-
);
45+
NavigatorUtils.goPerson(context, eventViewModel.actionUser);
4846
}),
4947
new Padding(padding: EdgeInsets.all(5.0)),
5048
new Expanded(child: new Text(eventViewModel.actionUser, style: GSYConstant.smallTextBold)),

‎lib/widget/UserHeader.dart‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ class UserHeaderItem extends StatelessWidget {
8383
child: new Text(
8484
userInfo.bio == null ? GSYStrings.nothing_now : userInfo.bio,
8585
style: GSYConstant.subLightSmallText,
86-
overflow: TextOverflow.ellipsis,
8786
),
8887
margin: new EdgeInsets.only(top: 6.0, bottom: 2.0),
8988
alignment: Alignment.topLeft),

0 commit comments

Comments
 (0)