Browse Source

remove new

git@h5.yoqi.me 1 year ago
parent
commit
fb5c11a6e8

+ 1 - 1
lib/constants/Constants.dart

@@ -10,6 +10,6 @@ class Constants {
 
   static final String END_LINE_TAG = "COMPLETE";
 
-  static EventBus eventBus = new EventBus();
+  static EventBus eventBus = EventBus();
   
 }

+ 23 - 23
lib/main.dart

@@ -7,25 +7,25 @@ import 'pages/MyInfoPage.dart';
 import './widgets/MyDrawer.dart';
 
 void main() {
-  runApp(new MyOSCClient());
+  runApp(MyOSCClient());
 }
 
 class MyOSCClient extends StatefulWidget {
   @override
-  State<StatefulWidget> createState() => new MyOSCClientState();
+  State<StatefulWidget> createState() => MyOSCClientState();
 }
 
 class MyOSCClientState extends State<MyOSCClient> {
   int _tabIndex = 0;
-  final tabTextStyleNormal = new TextStyle(color: const Color(0xff969696));
-  final tabTextStyleSelected = new TextStyle(color: const Color(0xff63ca6c));
+  final tabTextStyleNormal = TextStyle(color: const Color(0xff969696));
+  final tabTextStyleSelected = TextStyle(color: const Color(0xff63ca6c));
 
   var tabImages;
   var _body;
   var appBarTitles = ['资讯', '动弹', '发现', '我的'];
 
   Image getTabImage(path) {
-    return new Image.asset(path, width: 20.0, height: 20.0);
+    return Image.asset(path, width: 20.0, height: 20.0);
   }
 
   void initData() {
@@ -49,12 +49,12 @@ class MyOSCClientState extends State<MyOSCClient> {
         ]
       ];
     }
-    _body = new IndexedStack(
+    _body = IndexedStack(
       children: [
-        new NewsListPage(),
-        new TweetsListPage(),
-        new DiscoveryPage(),
-        new MyInfoPage()
+        NewsListPage(),
+        TweetsListPage(),
+        DiscoveryPage(),
+        MyInfoPage()
       ],
       index: _tabIndex,
     );
@@ -75,34 +75,34 @@ class MyOSCClientState extends State<MyOSCClient> {
   }
 
   Text getTabTitle(int curIndex) {
-    return new Text(appBarTitles[curIndex], style: getTabTextStyle(curIndex));
+    return Text(appBarTitles[curIndex], style: getTabTextStyle(curIndex));
   }
 
   @override
   Widget build(BuildContext context) {
     initData();
-    return new MaterialApp(
-      theme: new ThemeData(
+    return MaterialApp(
+      theme: ThemeData(
           primaryColor: const Color(0xFF63CA6C)
       ),
-      home: new Scaffold(
-        appBar: new AppBar(
-          title: new Text(appBarTitles[_tabIndex], style: new TextStyle(color: Colors.white)),
-          iconTheme: new IconThemeData(color: Colors.white)
+      home: Scaffold(
+        appBar: AppBar(
+          title: Text(appBarTitles[_tabIndex], style: TextStyle(color: Colors.white)),
+          iconTheme: IconThemeData(color: Colors.white)
         ),
         body: _body,
-        bottomNavigationBar: new CupertinoTabBar(
+        bottomNavigationBar: CupertinoTabBar(
           items: <BottomNavigationBarItem>[
-            new BottomNavigationBarItem(
+            BottomNavigationBarItem(
                 icon: getTabIcon(0),
                 title: getTabTitle(0)),
-            new BottomNavigationBarItem(
+            BottomNavigationBarItem(
                 icon: getTabIcon(1),
                 title: getTabTitle(1)),
-            new BottomNavigationBarItem(
+            BottomNavigationBarItem(
                 icon: getTabIcon(2),
                 title: getTabTitle(2)),
-            new BottomNavigationBarItem(
+            BottomNavigationBarItem(
                 icon: getTabIcon(3),
                 title: getTabTitle(3)),
           ],
@@ -113,7 +113,7 @@ class MyOSCClientState extends State<MyOSCClient> {
             });
           },
         ),
-        drawer: new MyDrawer(),
+        drawer: MyDrawer(),
       ),
     );
   }

+ 44 - 44
lib/pages/AboutPage.dart

@@ -6,18 +6,18 @@ import 'CommonWebPage.dart';
 class AboutPage extends StatefulWidget {
   @override
   State<StatefulWidget> createState() {
-    return new AboutPageState();
+    return AboutPageState();
   }
 }
 
 class AboutPageState extends State<AboutPage> {
   bool showImage = false;
-  TextStyle textStyle = new TextStyle(
+  TextStyle textStyle = TextStyle(
       color: Colors.blue,
-      decoration: new TextDecoration.combine([TextDecoration.underline]));
+      decoration: TextDecoration.combine([TextDecoration.underline]));
   Widget authorLink, mayunLink, githubLink;
-  List<String> urls = new List();
-  List<String> titles = new List();
+  List<String> urls = List();
+  List<String> titles = List();
 
   AboutPageState() {
     titles.add("yubo's blog");
@@ -26,14 +26,14 @@ class AboutPageState extends State<AboutPage> {
     urls.add("https://yubo725.top");
     urls.add("https://gitee.com/yubo725");
     urls.add("https://github.com/yubo725");
-    authorLink = new GestureDetector(
-      child: new Container(
+    authorLink = GestureDetector(
+      child: Container(
         margin: const EdgeInsets.fromLTRB(0.0, 80.0, 0.0, 0.0),
-        child: new Row(
+        child: Row(
           mainAxisAlignment: MainAxisAlignment.center,
           children: [
-            new Text("作者:"),
-            new Text(
+            Text("作者:"),
+            Text(
               "yubo",
               style: textStyle,
             ),
@@ -42,14 +42,14 @@ class AboutPageState extends State<AboutPage> {
       ),
       onTap: getLink(0),
     );
-    mayunLink = new GestureDetector(
-      child: new Container(
+    mayunLink = GestureDetector(
+      child: Container(
         margin: const EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 0.0),
-        child: new Row(
+        child: Row(
           mainAxisAlignment: MainAxisAlignment.center,
           children: [
-            new Text("码云:"),
-            new Text(
+            Text("码云:"),
+            Text(
               "https://gitee.com/yubo725",
               style: textStyle,
             )
@@ -58,14 +58,14 @@ class AboutPageState extends State<AboutPage> {
       ),
       onTap: getLink(1),
     );
-    githubLink = new GestureDetector(
-      child: new Container(
+    githubLink = GestureDetector(
+      child: Container(
         margin: const EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 0.0),
-        child: new Row(
+        child: Row(
           mainAxisAlignment: MainAxisAlignment.center,
           children: [
-            new Text("GitHub:"),
-            new Text(
+            Text("GitHub:"),
+            Text(
               "https://github.com/yubo725",
               style: textStyle,
             ),
@@ -80,23 +80,23 @@ class AboutPageState extends State<AboutPage> {
     String url = urls[index];
     String title = titles[index];
     return () {
-      Navigator.of(context).push(new MaterialPageRoute(builder: (ctx) {
-        return new CommonWebPage(title: title, url: url);
+      Navigator.of(context).push(MaterialPageRoute(builder: (ctx) {
+        return CommonWebPage(title: title, url: url);
       }));
     };
   }
 
   Widget getImageOrBtn() {
     if (!showImage) {
-      return new Container(
-        child: new Center(
-          child: new InkWell(
-            child: new Container(
+      return Container(
+        child: Center(
+          child: InkWell(
+            child: Container(
               padding: const EdgeInsets.fromLTRB(15.0, 8.0, 15.0, 8.0),
-              child: new Text("不要点我"),
-              decoration: new BoxDecoration(
-                  border: new Border.all(color: Colors.black),
-                  borderRadius: new BorderRadius.all(new Radius.circular(5.0))),
+              child: Text("不要点我"),
+              decoration: BoxDecoration(
+                  border: Border.all(color: Colors.black),
+                  borderRadius: BorderRadius.all(Radius.circular(5.0))),
             ),
             onTap: () {
               setState(() {
@@ -107,7 +107,7 @@ class AboutPageState extends State<AboutPage> {
         ),
       );
     } else {
-      return new Image.asset(
+      return Image.asset(
         './images/ic_hongshu.jpg',
         width: 100.0,
         height: 100.0,
@@ -117,34 +117,34 @@ class AboutPageState extends State<AboutPage> {
 
   @override
   Widget build(BuildContext context) {
-    return new Scaffold(
-      appBar: new AppBar(
-        title: new Text("关于", style: new TextStyle(color: Colors.white)),
-        iconTheme: new IconThemeData(color: Colors.white),
+    return Scaffold(
+      appBar: AppBar(
+        title: Text("关于", style: TextStyle(color: Colors.white)),
+        iconTheme: IconThemeData(color: Colors.white),
       ),
-      body: new Center(
-        child: new Column(
+      body: Center(
+        child: Column(
           children: [
-            new Container(
+            Container(
               width: 1.0,
               height: 100.0,
               color: Colors.transparent,
             ),
-            new Image.asset(
+            Image.asset(
               './images/ic_osc_logo.png',
               width: 200.0,
               height: 56.0,
             ),
-            new Text("基于Google Flutter的开源中国客户端"),
+            Text("基于Google Flutter的开源中国客户端"),
             authorLink,
             mayunLink,
             githubLink,
-            new Expanded(flex: 1, child: getImageOrBtn()),
-            new Container(
+            Expanded(flex: 1, child: getImageOrBtn()),
+            Container(
                 margin: const EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 15.0),
-                child: new Text(
+                child: Text(
                   "本项目仅供学习使用,与开源中国官方无关",
-                  style: new TextStyle(fontSize: 12.0),
+                  style: TextStyle(fontSize: 12.0),
                 ))
           ],
         ),

+ 53 - 53
lib/pages/BlackHousePage.dart

@@ -13,14 +13,14 @@ import '../util/Utf8Utils.dart';
 class BlackHousePage extends StatefulWidget {
   @override
   State<StatefulWidget> createState() {
-    return new BlackHousePageState();
+    return BlackHousePageState();
   }
 }
 
 class BlackHousePageState extends State<BlackHousePage> {
   bool isLogin = true;
   List blackDataList;
-  TextStyle btnStyle = new TextStyle(color: Colors.white, fontSize: 12.0);
+  TextStyle btnStyle = TextStyle(color: Colors.white, fontSize: 12.0);
 
   BlackHousePageState() {
     queryBlackList();
@@ -53,7 +53,7 @@ class BlackHousePageState extends State<BlackHousePage> {
   getUserInfo() async {
     SharedPreferences sp = await SharedPreferences.getInstance();
     String accessToken = sp.get(DataUtils.SP_AC_TOKEN);
-    Map<String, String> params = new Map();
+    Map<String, String> params = Map();
     params['access_token'] = accessToken;
     NetUtils.get(Api.USER_INFO, params: params).then((data) {
       if (data != null) {
@@ -70,7 +70,7 @@ class BlackHousePageState extends State<BlackHousePage> {
     DataUtils.getUserInfo().then((userInfo) {
       if (userInfo != null) {
         String userId = "${userInfo.id}";
-        Map<String, String> params = new Map();
+        Map<String, String> params = Map();
         params['userid'] = userId;
         params['authorid'] = "$authorId";
         NetUtils.get(Api.DELETE_BLACK, params: params).then((data) {
@@ -97,14 +97,14 @@ class BlackHousePageState extends State<BlackHousePage> {
     showDialog(
       context: context,
       builder: (ctx) {
-        return new AlertDialog(
-          title: new Text('提示'),
-          content: new Text(msg),
+        return AlertDialog(
+          title: Text('提示'),
+          content: Text(msg),
           actions: <Widget>[
-            new FlatButton(
-              child: new Text(
+            FlatButton(
+              child: Text(
                 '确定',
-                style: new TextStyle(color: Colors.red),
+                style: TextStyle(color: Colors.red),
               ),
               onPressed: () {
                 Navigator.of(context).pop();
@@ -121,14 +121,14 @@ class BlackHousePageState extends State<BlackHousePage> {
     showDialog(
       context: context,
       builder: (BuildContext ctx) {
-        return new AlertDialog(
-          title: new Text('提示'),
-          content: new Text('确定要把\"$name\"放出小黑屋吗?'),
+        return AlertDialog(
+          title: Text('提示'),
+          content: Text('确定要把\"$name\"放出小黑屋吗?'),
           actions: <Widget>[
-            new FlatButton(
-              child: new Text(
+            FlatButton(
+              child: Text(
                 '确定',
-                style: new TextStyle(color: Colors.red),
+                style: TextStyle(color: Colors.red),
               ),
               onPressed: () {
                 deleteFromBlack(item['authorid']);
@@ -141,23 +141,23 @@ class BlackHousePageState extends State<BlackHousePage> {
 
   Widget getBody() {
     if (!isLogin) {
-      return new Center(
-        child: new InkWell(
-          child: new Container(
+      return Center(
+        child: InkWell(
+          child: Container(
             padding: const EdgeInsets.fromLTRB(15.0, 8.0, 15.0, 8.0),
-            child: new Text("去登录"),
-            decoration: new BoxDecoration(
-                border: new Border.all(color: Colors.black),
-                borderRadius: new BorderRadius.all(new Radius.circular(5.0))
+            child: Text("去登录"),
+            decoration: BoxDecoration(
+                border: Border.all(color: Colors.black),
+                borderRadius: BorderRadius.all(Radius.circular(5.0))
             ),
           ),
           onTap: () async {
-            final result = await Navigator.of(context).push(new MaterialPageRoute(builder: (BuildContext context) {
+            final result = await Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) {
               return LoginPage();
             }));
             if (result != null && result == "refresh") {
               // 通知动弹页面刷新
-              Constants.eventBus.fire(new LoginEvent());
+              Constants.eventBus.fire(LoginEvent());
               getUserInfo();
             }
           },
@@ -165,62 +165,62 @@ class BlackHousePageState extends State<BlackHousePage> {
       );
     }
     if (blackDataList == null) {
-      return new Center(
-        child: new CircularProgressIndicator(),
+      return Center(
+        child: CircularProgressIndicator(),
       );
     } else if (blackDataList.length == 0) {
-      return new Center(
-        child: new Column(
+      return Center(
+        child: Column(
           mainAxisAlignment: MainAxisAlignment.center,
           children: [
-            new Text("小黑屋中没人..."),
-            new Text("长按动弹列表即可往小黑屋中加人")
+            Text("小黑屋中没人..."),
+            Text("长按动弹列表即可往小黑屋中加人")
           ],
         ),
       );
     }
-    return new GridView.count(
+    return GridView.count(
       crossAxisCount: 3,
-      children: new List.generate(blackDataList.length, (index) {
+      children: List.generate(blackDataList.length, (index) {
         String name = Utf8Utils.decode(blackDataList[index]['authorname']);
-        return new Container(
+        return Container(
           margin: const EdgeInsets.all(2.0),
           color: Colors.black,
-          child: new Column(
+          child: Column(
             mainAxisAlignment: MainAxisAlignment.center,
             children: [
-              new Container(
+              Container(
                 width: 45.0,
                 height: 45.0,
-                decoration: new BoxDecoration(
+                decoration: BoxDecoration(
                   shape: BoxShape.circle,
                   color: Colors.transparent,
-                  image: new DecorationImage(
-                      image: new NetworkImage(
+                  image: DecorationImage(
+                      image: NetworkImage(
                           "${blackDataList[index]['authoravatar']}"),
                       fit: BoxFit.cover),
-                  border: new Border.all(
+                  border: Border.all(
                     color: Colors.white,
                     width: 2.0,
                   ),
                 ),
               ),
-              new Container(
+              Container(
                 margin: const EdgeInsets.fromLTRB(0.0, 5.0, 0.0, 5.0),
                 child:
-                    new Text(name, style: new TextStyle(color: Colors.white)),
+                    Text(name, style: TextStyle(color: Colors.white)),
               ),
-              new InkWell(
-                child: new Container(
+              InkWell(
+                child: Container(
                   padding: const EdgeInsets.fromLTRB(8.0, 5.0, 5.0, 8.0),
-                  child: new Text(
+                  child: Text(
                     "放我出去",
                     style: btnStyle,
                   ),
-                  decoration: new BoxDecoration(
-                      border: new Border.all(color: Colors.white),
+                  decoration: BoxDecoration(
+                      border: Border.all(color: Colors.white),
                       borderRadius:
-                          new BorderRadius.all(new Radius.circular(5.0))),
+                          BorderRadius.all(Radius.circular(5.0))),
                 ),
                 onTap: () {
                   showSetFreeDialog(blackDataList[index]);
@@ -235,12 +235,12 @@ class BlackHousePageState extends State<BlackHousePage> {
 
   @override
   Widget build(BuildContext context) {
-    return new Scaffold(
-      appBar: new AppBar(
-        title: new Text("动弹小黑屋", style: new TextStyle(color: Colors.white)),
-        iconTheme: new IconThemeData(color: Colors.white),
+    return Scaffold(
+      appBar: AppBar(
+        title: Text("动弹小黑屋", style: TextStyle(color: Colors.white)),
+        iconTheme: IconThemeData(color: Colors.white),
       ),
-      body: new Padding(
+      body: Padding(
         padding: const EdgeInsets.fromLTRB(2.0, 4.0, 2.0, 0.0),
         child: getBody(),
       ),

+ 10 - 10
lib/pages/CommonWebPage.dart

@@ -11,14 +11,14 @@ class CommonWebPage extends StatefulWidget {
 
   @override
   State<StatefulWidget> createState() {
-    return new CommonWebPageState();
+    return CommonWebPageState();
   }
 }
 
 class CommonWebPageState extends State<CommonWebPage> {
   bool loading = true;
 
-  final flutterWebViewPlugin = new FlutterWebviewPlugin();
+  final flutterWebViewPlugin = FlutterWebviewPlugin();
 
   @override
   void initState() {
@@ -46,22 +46,22 @@ class CommonWebPageState extends State<CommonWebPage> {
   @override
   Widget build(BuildContext context) {
     List<Widget> titleContent = [];
-    titleContent.add(new Text(
+    titleContent.add(Text(
       widget.title,
-      style: new TextStyle(color: Colors.white),
+      style: TextStyle(color: Colors.white),
     ));
     if (loading) {
-      titleContent.add(new CupertinoActivityIndicator());
+      titleContent.add(CupertinoActivityIndicator());
     }
-    titleContent.add(new Container(width: 50.0));
-    return new WebviewScaffold(
+    titleContent.add(Container(width: 50.0));
+    return WebviewScaffold(
       url: widget.url,
-      appBar: new AppBar(
-        title: new Row(
+      appBar: AppBar(
+        title: Row(
           mainAxisAlignment: MainAxisAlignment.center,
           children: titleContent,
         ),
-        iconTheme: new IconThemeData(color: Colors.white),
+        iconTheme: IconThemeData(color: Colors.white),
       ),
       withZoom: true,
       withLocalStorage: true,

+ 29 - 29
lib/pages/DiscoveryPage.dart

@@ -26,8 +26,8 @@ class DiscoveryPage extends StatelessWidget {
   final titles = [
     "开源软件", "码云推荐", "代码片段", "扫一扫", "摇一摇", "码云封面人物", "线下活动"
   ];
-  final rightArrowIcon = new Image.asset('images/ic_arrow_right.png', width: ARROW_ICON_WIDTH, height: ARROW_ICON_WIDTH,);
-  final titleTextStyle = new TextStyle(fontSize: 16.0);
+  final rightArrowIcon = Image.asset('images/ic_arrow_right.png', width: ARROW_ICON_WIDTH, height: ARROW_ICON_WIDTH,);
+  final titleTextStyle = TextStyle(fontSize: 16.0);
   List listData = [];
 
   DiscoveryPage() {
@@ -37,7 +37,7 @@ class DiscoveryPage extends StatelessWidget {
   initData() {
     listData.add(TAG_START);
     for (int i = 0; i < 3; i++) {
-      listData.add(new ListItem(title: titles[i], icon: imagePaths[i]));
+      listData.add(ListItem(title: titles[i], icon: imagePaths[i]));
       if (i == 2) {
         listData.add(TAG_END);
       } else {
@@ -47,7 +47,7 @@ class DiscoveryPage extends StatelessWidget {
     listData.add(TAG_BLANK);
     listData.add(TAG_START);
     for (int i = 3; i < 5; i++) {
-      listData.add(new ListItem(title: titles[i], icon: imagePaths[i]));
+      listData.add(ListItem(title: titles[i], icon: imagePaths[i]));
       if (i == 4) {
         listData.add(TAG_END);
       } else {
@@ -57,7 +57,7 @@ class DiscoveryPage extends StatelessWidget {
     listData.add(TAG_BLANK);
     listData.add(TAG_START);
     for (int i = 5; i < 7; i++) {
-      listData.add(new ListItem(title: titles[i], icon: imagePaths[i]));
+      listData.add(ListItem(title: titles[i], icon: imagePaths[i]));
       if (i == 6) {
         listData.add(TAG_END);
       } else {
@@ -67,9 +67,9 @@ class DiscoveryPage extends StatelessWidget {
   }
 
   Widget getIconImage(path) {
-    return new Padding(
+    return Padding(
       padding: const EdgeInsets.fromLTRB(0.0, 0.0, 10.0, 0.0),
-      child: new Image.asset(path, width: IMAGE_ICON_WIDTH, height: IMAGE_ICON_WIDTH),
+      child: Image.asset(path, width: IMAGE_ICON_WIDTH, height: IMAGE_ICON_WIDTH),
     );
   }
 
@@ -78,37 +78,37 @@ class DiscoveryPage extends StatelessWidget {
     if (item is String) {
       switch (item) {
         case TAG_START:
-          return new Divider(height: 1.0,);
+          return Divider(height: 1.0,);
           break;
         case TAG_END:
-          return new Divider(height: 1.0,);
+          return Divider(height: 1.0,);
           break;
         case TAG_CENTER:
-          return new Padding(
+          return Padding(
             padding: const EdgeInsets.fromLTRB(50.0, 0.0, 0.0, 0.0),
-            child: new Divider(height: 1.0,),
+            child: Divider(height: 1.0,),
           );
           break;
         case TAG_BLANK:
-          return new Container(
+          return Container(
             height: 20.0,
           );
           break;
       }
     } else if (item is ListItem) {
-      var listItemContent =  new Padding(
+      var listItemContent =  Padding(
         padding: const EdgeInsets.fromLTRB(10.0, 15.0, 10.0, 15.0),
-        child: new Row(
+        child: Row(
           children: [
             getIconImage(item.icon),
-            new Expanded(
-                child: new Text(item.title, style: titleTextStyle,)
+            Expanded(
+                child: Text(item.title, style: titleTextStyle,)
             ),
             rightArrowIcon
           ],
         ),
       );
-      return new InkWell(
+      return InkWell(
         onTap: () {
           handleListItemClick(ctx, item);
         },
@@ -122,33 +122,33 @@ class DiscoveryPage extends StatelessWidget {
     if (title == "扫一扫") {
       scan();
     } else if (title == "线下活动") {
-      Navigator.of(ctx).push(new MaterialPageRoute(
+      Navigator.of(ctx).push(MaterialPageRoute(
         builder: (context) {
-          return new OfflineActivityPage();
+          return OfflineActivityPage();
         }
       ));
     } else if (title == "码云推荐") {
-      Navigator.of(ctx).push(new MaterialPageRoute(
+      Navigator.of(ctx).push(MaterialPageRoute(
           builder: (context) {
-            return new CommonWebPage(title: "码云推荐", url: "https://m.gitee.com/explore");
+            return CommonWebPage(title: "码云推荐", url: "https://m.gitee.com/explore");
           }
       ));
     } else if (title == "代码片段") {
-      Navigator.of(ctx).push(new MaterialPageRoute(
+      Navigator.of(ctx).push(MaterialPageRoute(
           builder: (context) {
-            return new CommonWebPage(title: "代码片段", url: "https://m.gitee.com/gists");
+            return CommonWebPage(title: "代码片段", url: "https://m.gitee.com/gists");
           }
       ));
     } else if (title == "开源软件") {
-      Navigator.of(ctx).push(new MaterialPageRoute(
+      Navigator.of(ctx).push(MaterialPageRoute(
           builder: (context) {
-            return new CommonWebPage(title: "开源软件", url: "https://m.gitee.com/explore");
+            return CommonWebPage(title: "开源软件", url: "https://m.gitee.com/explore");
           }
       ));
     } else if (title == "码云封面人物") {
-      Navigator.of(ctx).push(new MaterialPageRoute(
+      Navigator.of(ctx).push(MaterialPageRoute(
           builder: (context) {
-            return new CommonWebPage(title: "码云封面人物", url: "https://m.gitee.com/gitee-stars/");
+            return CommonWebPage(title: "码云封面人物", url: "https://m.gitee.com/gitee-stars/");
           }
       ));
     }
@@ -165,9 +165,9 @@ class DiscoveryPage extends StatelessWidget {
 
   @override
   Widget build(BuildContext context) {
-    return new Padding(
+    return Padding(
       padding: const EdgeInsets.fromLTRB(0.0, 20.0, 0.0, 0.0),
-      child: new ListView.builder(
+      child: ListView.builder(
         itemCount: listData.length,
         itemBuilder: (context, i) => renderRow(context, i),
       ),

+ 13 - 13
lib/pages/LoginPage.dart

@@ -8,17 +8,17 @@ import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
 
 class LoginPage extends StatefulWidget {
   @override
-  State<StatefulWidget> createState() => new LoginPageState();
+  State<StatefulWidget> createState() => LoginPageState();
 }
 
 class LoginPageState extends State<LoginPage> {
   int count = 0;
   final int MAX_COUNT = 5;
   bool loading = true;
-  GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey();
+  GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey();
   StreamSubscription<String> _onUrlChanged;
   StreamSubscription<WebViewStateChanged> _onStateChanged;
-  FlutterWebviewPlugin flutterWebViewPlugin = new FlutterWebviewPlugin();
+  FlutterWebviewPlugin flutterWebViewPlugin = FlutterWebviewPlugin();
 
   @override
   void initState() {
@@ -31,7 +31,7 @@ class LoginPageState extends State<LoginPage> {
       });
       if (url != null && url.length > 0 && url.contains("osc/osc.php?code=")) {
         // android中onUrlChanged回调时页面已加载完成,由于onStateChanged回调不能用,这里延迟1秒去拿js中的数据,没拿到就再延迟1秒,最多取5次
-        new Timer(const Duration(seconds: 1), parseResult);
+        Timer(const Duration(seconds: 1), parseResult);
       }
     });
   }
@@ -62,7 +62,7 @@ class LoginPageState extends State<LoginPage> {
         }
       } else {
         // 没拿到js中的数据,延迟一秒再拿
-        new Timer(const Duration(seconds: 1), parseResult);
+        Timer(const Duration(seconds: 1), parseResult);
       }
     });
   }
@@ -70,23 +70,23 @@ class LoginPageState extends State<LoginPage> {
   @override
   Widget build(BuildContext context) {
     List<Widget> titleContent = [];
-    titleContent.add(new Text(
+    titleContent.add(Text(
       "登录开源中国",
-      style: new TextStyle(color: Colors.white),
+      style: TextStyle(color: Colors.white),
     ));
     if (loading) {
-      titleContent.add(new CupertinoActivityIndicator());
+      titleContent.add(CupertinoActivityIndicator());
     }
-    titleContent.add(new Container(width: 50.0));
-    return new WebviewScaffold(
+    titleContent.add(Container(width: 50.0));
+    return WebviewScaffold(
       key: _scaffoldKey,
       url: Constants.LOGIN_URL,
-      appBar: new AppBar(
-        title: new Row(
+      appBar: AppBar(
+        title: Row(
           mainAxisAlignment: MainAxisAlignment.center,
           children: titleContent,
         ),
-        iconTheme: new IconThemeData(color: Colors.white),
+        iconTheme: IconThemeData(color: Colors.white),
       ),
       withZoom: true,
       withLocalStorage: true,

+ 40 - 40
lib/pages/MyInfoPage.dart

@@ -14,7 +14,7 @@ import '../model/UserInfo.dart';
 class MyInfoPage extends StatefulWidget {
   @override
   State<StatefulWidget> createState() {
-    return new MyInfoPageState();
+    return MyInfoPageState();
   }
 }
 
@@ -35,8 +35,8 @@ class MyInfoPageState extends State<MyInfoPage> {
   var icons = [];
   var userAvatar;
   var userName;
-  var titleTextStyle = new TextStyle(fontSize: 16.0);
-  var rightArrowIcon = new Image.asset(
+  var titleTextStyle = TextStyle(fontSize: 16.0);
+  var rightArrowIcon = Image.asset(
     'images/ic_arrow_right.png',
     width: ARROW_ICON_WIDTH,
     height: ARROW_ICON_WIDTH,
@@ -81,16 +81,16 @@ class MyInfoPageState extends State<MyInfoPage> {
   }
 
   Widget getIconImage(path) {
-    return new Padding(
+    return Padding(
       padding: const EdgeInsets.fromLTRB(0.0, 0.0, 10.0, 0.0),
-      child: new Image.asset(path,
+      child: Image.asset(path,
           width: IMAGE_ICON_WIDTH, height: IMAGE_ICON_WIDTH),
     );
   }
 
   @override
   Widget build(BuildContext context) {
-    var listView = new ListView.builder(
+    var listView = ListView.builder(
       itemCount: titles.length * 2,
       itemBuilder: (context, i) => renderRow(i),
     );
@@ -101,7 +101,7 @@ class MyInfoPageState extends State<MyInfoPage> {
   getUserInfo() async {
     SharedPreferences sp = await SharedPreferences.getInstance();
     String accessToken = sp.get(DataUtils.SP_AC_TOKEN);
-    Map<String, String> params = new Map();
+    Map<String, String> params = Map();
     params['access_token'] = accessToken;
     NetUtils.get(Api.USER_INFO, params: params).then((data) {
       if (data != null) {
@@ -118,14 +118,14 @@ class MyInfoPageState extends State<MyInfoPage> {
   _login() async {
     final result = await Navigator
         .of(context)
-        .push(new MaterialPageRoute(builder: (context) {
-      return new LoginPage();
+        .push(MaterialPageRoute(builder: (context) {
+      return LoginPage();
     }));
     if (result != null && result == "refresh") {
       // 刷新用户信息
       getUserInfo();
       // 通知动弹页面刷新
-      Constants.eventBus.fire(new LoginEvent());
+      Constants.eventBus.fire(LoginEvent());
     }
   }
 
@@ -133,42 +133,42 @@ class MyInfoPageState extends State<MyInfoPage> {
 
   renderRow(i) {
     if (i == 0) {
-      var avatarContainer = new Container(
+      var avatarContainer = Container(
         color: const Color(0xff63ca6c),
         height: 200.0,
-        child: new Center(
-          child: new Column(
+        child: Center(
+          child: Column(
             mainAxisAlignment: MainAxisAlignment.center,
             children: [
               userAvatar == null
-                  ? new Image.asset(
+                  ? Image.asset(
                       "images/ic_avatar_default.png",
                       width: 60.0,
                     )
-                  : new Container(
+                  : Container(
                       width: 60.0,
                       height: 60.0,
-                      decoration: new BoxDecoration(
+                      decoration: BoxDecoration(
                         shape: BoxShape.circle,
                         color: Colors.transparent,
-                        image: new DecorationImage(
-                            image: new NetworkImage(userAvatar),
+                        image: DecorationImage(
+                            image: NetworkImage(userAvatar),
                             fit: BoxFit.cover),
-                        border: new Border.all(
+                        border: Border.all(
                           color: Colors.white,
                           width: 2.0,
                         ),
                       ),
                     ),
-              new Text(
+              Text(
                 userName == null ? "点击头像登录" : userName,
-                style: new TextStyle(color: Colors.white, fontSize: 16.0),
+                style: TextStyle(color: Colors.white, fontSize: 16.0),
               ),
             ],
           ),
         ),
       );
-      return new GestureDetector(
+      return GestureDetector(
         onTap: () {
           DataUtils.isLogin().then((isLogin) {
             if (isLogin) {
@@ -185,19 +185,19 @@ class MyInfoPageState extends State<MyInfoPage> {
     }
     --i;
     if (i.isOdd) {
-      return new Divider(
+      return Divider(
         height: 1.0,
       );
     }
     i = i ~/ 2;
     String title = titles[i];
-    var listItemContent = new Padding(
+    var listItemContent = Padding(
       padding: const EdgeInsets.fromLTRB(10.0, 15.0, 10.0, 15.0),
-      child: new Row(
+      child: Row(
         children: [
           icons[i],
-          new Expanded(
-              child: new Text(
+          Expanded(
+              child: Text(
             title,
             style: titleTextStyle,
           )),
@@ -205,13 +205,13 @@ class MyInfoPageState extends State<MyInfoPage> {
         ],
       ),
     );
-    return new InkWell(
+    return InkWell(
       child: listItemContent,
       onTap: () {
         _handleListItemClick(title);
 //        Navigator
 //            .of(context)
-//            .push(new MaterialPageRoute(builder: (context) => new CommonWebPage(title: "Test", url: "https://my.oschina.net/u/815261/blog")));
+//            .push(MaterialPageRoute(builder: (context) => CommonWebPage(title: "Test", url: "https://my.oschina.net/u/815261/blog")));
       },
     );
   }
@@ -220,23 +220,23 @@ class MyInfoPageState extends State<MyInfoPage> {
     showDialog(
         context: context,
         builder: (BuildContext ctx) {
-          return new AlertDialog(
-            title: new Text('提示'),
-            content: new Text('没有登录,现在去登录吗?'),
+          return AlertDialog(
+            title: Text('提示'),
+            content: Text('没有登录,现在去登录吗?'),
             actions: <Widget>[
-              new FlatButton(
-                child: new Text(
+              FlatButton(
+                child: Text(
                   '取消',
-                  style: new TextStyle(color: Colors.red),
+                  style: TextStyle(color: Colors.red),
                 ),
                 onPressed: () {
                   Navigator.of(context).pop();
                 },
               ),
-              new FlatButton(
-                child: new Text(
+              FlatButton(
+                child: Text(
                   '确定',
-                  style: new TextStyle(color: Colors.blue),
+                  style: TextStyle(color: Colors.blue),
                 ),
                 onPressed: () {
                   Navigator.of(context).pop();
@@ -256,8 +256,8 @@ class MyInfoPageState extends State<MyInfoPage> {
       } else {
         DataUtils.getUserInfo().then((info) {
           Navigator.of(context).push(
-            new MaterialPageRoute(
-              builder: (context) => new CommonWebPage(
+            MaterialPageRoute(
+              builder: (context) => CommonWebPage(
                 title: "我的博客",
                 url: "https://my.oschina.net/u/${info.id}/blog"
               )

+ 9 - 9
lib/pages/NewsDetailPage.dart

@@ -9,7 +9,7 @@ class NewsDetailPage extends StatefulWidget {
   NewsDetailPage({Key key, this.id}):super(key: key);
 
   @override
-  State<StatefulWidget> createState() => new NewsDetailPageState(id: this.id);
+  State<StatefulWidget> createState() => NewsDetailPageState(id: this.id);
 }
 
 class NewsDetailPageState extends State<NewsDetailPage> {
@@ -17,7 +17,7 @@ class NewsDetailPageState extends State<NewsDetailPage> {
   String id;
   bool loaded = false;
   String detailDataStr;
-  final flutterWebViewPlugin = new FlutterWebviewPlugin();
+  final flutterWebViewPlugin = FlutterWebviewPlugin();
 
   NewsDetailPageState({Key key, this.id});
 
@@ -39,19 +39,19 @@ class NewsDetailPageState extends State<NewsDetailPage> {
   @override
   Widget build(BuildContext context) {
     List<Widget> titleContent = [];
-    titleContent.add(new Text("资讯详情", style: new TextStyle(color: Colors.white),));
+    titleContent.add(Text("资讯详情", style: TextStyle(color: Colors.white),));
     if (!loaded) {
-      titleContent.add(new CupertinoActivityIndicator());
+      titleContent.add(CupertinoActivityIndicator());
     }
-    titleContent.add(new Container(width: 50.0));
-    return new WebviewScaffold(
+    titleContent.add(Container(width: 50.0));
+    return WebviewScaffold(
       url: this.id,
-      appBar: new AppBar(
-        title: new Row(
+      appBar: AppBar(
+        title: Row(
           mainAxisAlignment: MainAxisAlignment.center,
           children: titleContent,
         ),
-        iconTheme: new IconThemeData(color: Colors.white),
+        iconTheme: IconThemeData(color: Colors.white),
       ),
       withZoom: false,
       withLocalStorage: true,

+ 49 - 49
lib/pages/NewsListPage.dart

@@ -11,7 +11,7 @@ import '../widgets/CommonEndLine.dart';
 class NewsListPage extends StatefulWidget {
   @override
   State<StatefulWidget> createState() {
-    return new NewsListPageState();
+    return NewsListPageState();
   }
 }
 
@@ -20,9 +20,9 @@ class NewsListPageState extends State<NewsListPage> {
   var slideData;
   var curPage = 1;
   var listTotalSize = 0;
-  ScrollController _controller = new ScrollController();
-  TextStyle titleTextStyle = new TextStyle(fontSize: 15.0);
-  TextStyle subtitleStyle = new TextStyle(color: const Color(0xFFB5BDC0), fontSize: 12.0);
+  ScrollController _controller = ScrollController();
+  TextStyle titleTextStyle = TextStyle(fontSize: 15.0);
+  TextStyle subtitleStyle = TextStyle(color: const Color(0xFFB5BDC0), fontSize: 12.0);
 
   NewsListPageState() {
     _controller.addListener(() {
@@ -52,16 +52,16 @@ class NewsListPageState extends State<NewsListPage> {
   @override
   Widget build(BuildContext context) {
     if (listData == null) {
-      return new Center(
-        child: new CircularProgressIndicator(),
+      return Center(
+        child: CircularProgressIndicator(),
       );
     } else {
-      Widget listView = new ListView.builder(
+      Widget listView = ListView.builder(
         itemCount: listData.length * 2,
         itemBuilder: (context, i) => renderRow(i),
         controller: _controller,
       );
-      return new RefreshIndicator(child: listView, onRefresh: _pullToRefresh);
+      return RefreshIndicator(child: listView, onRefresh: _pullToRefresh);
     }
   }
 
@@ -82,7 +82,7 @@ class NewsListPageState extends State<NewsListPage> {
               listData = _listData;
               slideData = _slideData;
             } else {
-              List list1 = new List();
+              List list1 = List();
               list1.addAll(listData);
               list1.addAll(_listData);
               if (list1.length >= listTotalSize) {
@@ -100,106 +100,106 @@ class NewsListPageState extends State<NewsListPage> {
 
   Widget renderRow(i) {
     if (i == 0) {
-      return new Container(
+      return Container(
         height: 180.0,
-        child: new SlideView(slideData),
+        child: SlideView(slideData),
       );
     }
     i -= 1;
     if (i.isOdd) {
-      return new Divider(height: 1.0);
+      return Divider(height: 1.0);
     }
     i = i ~/ 2;
     var itemData = listData[i];
     if (itemData is String && itemData == Constants.END_LINE_TAG) {
-      return new CommonEndLine();
+      return CommonEndLine();
     }
-    var titleRow = new Row(
+    var titleRow = Row(
       children: [
-        new Expanded(
-          child: new Text(itemData['title'], style: titleTextStyle),
+        Expanded(
+          child: Text(itemData['title'], style: titleTextStyle),
         )
       ],
     );
-    var timeRow = new Row(
+    var timeRow = Row(
       children: [
-        new Container(
+        Container(
           width: 20.0,
           height: 20.0,
-          decoration: new BoxDecoration(
+          decoration: BoxDecoration(
             shape: BoxShape.circle,
             color: const Color(0xFFECECEC),
-            image: new DecorationImage(
-                image: new NetworkImage(itemData['authorImg']), fit: BoxFit.cover),
-            border: new Border.all(
+            image: DecorationImage(
+                image: NetworkImage(itemData['authorImg']), fit: BoxFit.cover),
+            border: Border.all(
               color: const Color(0xFFECECEC),
               width: 2.0,
             ),
           ),
         ),
-        new Padding(
+        Padding(
           padding: const EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 0.0),
-          child: new Text(
+          child: Text(
             itemData['timeStr'],
             style: subtitleStyle,
           ),
         ),
-        new Expanded(
+        Expanded(
           flex: 1,
-          child: new Row(
+          child: Row(
             mainAxisAlignment: MainAxisAlignment.end,
             children: [
-              new Text("${itemData['commCount']}", style: subtitleStyle),
-              new Image.asset('./images/ic_comment.png', width: 16.0, height: 16.0),
+              Text("${itemData['commCount']}", style: subtitleStyle),
+              Image.asset('./images/ic_comment.png', width: 16.0, height: 16.0),
             ],
           ),
         )
       ],
     );
     var thumbImgUrl = itemData['thumb'];
-    var thumbImg = new Container(
+    var thumbImg = Container(
       margin: const EdgeInsets.all(10.0),
       width: 60.0,
       height: 60.0,
-      decoration: new BoxDecoration(
+      decoration: BoxDecoration(
         shape: BoxShape.circle,
         color: const Color(0xFFECECEC),
-        image: new DecorationImage(
-            image: new ExactAssetImage('./images/ic_img_default.jpg'),
+        image: DecorationImage(
+            image: ExactAssetImage('./images/ic_img_default.jpg'),
             fit: BoxFit.cover),
-        border: new Border.all(
+        border: Border.all(
           color: const Color(0xFFECECEC),
           width: 2.0,
         ),
       ),
     );
     if (thumbImgUrl != null && thumbImgUrl.length > 0) {
-      thumbImg = new Container(
+      thumbImg = Container(
         margin: const EdgeInsets.all(10.0),
         width: 60.0,
         height: 60.0,
-        decoration: new BoxDecoration(
+        decoration: BoxDecoration(
           shape: BoxShape.circle,
           color: const Color(0xFFECECEC),
-          image: new DecorationImage(
-              image: new NetworkImage(thumbImgUrl), fit: BoxFit.cover),
-          border: new Border.all(
+          image: DecorationImage(
+              image: NetworkImage(thumbImgUrl), fit: BoxFit.cover),
+          border: Border.all(
             color: const Color(0xFFECECEC),
             width: 2.0,
           ),
         ),
       );
     }
-    var row = new Row(
+    var row = Row(
       children: [
-        new Expanded(
+        Expanded(
           flex: 1,
-          child: new Padding(
+          child: Padding(
             padding: const EdgeInsets.all(10.0),
-            child: new Column(
+            child: Column(
               children: [
                 titleRow,
-                new Padding(
+                Padding(
                   padding: const EdgeInsets.fromLTRB(0.0, 8.0, 0.0, 0.0),
                   child: timeRow,
                 )
@@ -207,24 +207,24 @@ class NewsListPageState extends State<NewsListPage> {
             ),
           ),
         ),
-        new Padding(
+        Padding(
           padding: const EdgeInsets.all(6.0),
-          child: new Container(
+          child: Container(
             width: 100.0,
             height: 80.0,
             color: const Color(0xFFECECEC),
-            child: new Center(
+            child: Center(
               child: thumbImg,
             ),
           ),
         )
       ],
     );
-    return new InkWell(
+    return InkWell(
       child: row,
       onTap: () {
-        Navigator.of(context).push(new MaterialPageRoute(
-          builder: (ctx) => new NewsDetailPage(id: itemData['detailUrl'])
+        Navigator.of(context).push(MaterialPageRoute(
+          builder: (ctx) => NewsDetailPage(id: itemData['detailUrl'])
         ));
       },
     );

+ 36 - 36
lib/pages/OfflineActivityPage.dart

@@ -8,7 +8,7 @@ import '../pages/CommonWebPage.dart';
 class OfflineActivityPage extends StatefulWidget {
   @override
   State<StatefulWidget> createState() {
-    return new OfflineActivityPageState();
+    return OfflineActivityPageState();
   }
 }
 
@@ -18,7 +18,7 @@ class OfflineActivityPageState extends State<OfflineActivityPage> {
   String eventTypeRec = "recommend";
   int curPage = 1;
 
-  TextStyle titleTextStyle = new TextStyle(color: Colors.black, fontSize: 18.0);
+  TextStyle titleTextStyle = TextStyle(color: Colors.black, fontSize: 18.0);
 
   List recData, latestData, ychData;
 
@@ -54,50 +54,50 @@ class OfflineActivityPageState extends State<OfflineActivityPage> {
 
   Widget getRecBody() {
     if (recData == null) {
-      return new Center(child: new CircularProgressIndicator());
+      return Center(child: CircularProgressIndicator());
     } else if (recData.length == 0) {
-      return new Center(child: new Text("暂无数据"));
+      return Center(child: Text("暂无数据"));
     } else {
-      return new ListView.builder(itemBuilder: _renderRecRow, itemCount: recData.length);
+      return ListView.builder(itemBuilder: _renderRecRow, itemCount: recData.length);
     }
   }
 
   Widget getLatestBody() {
     if (latestData == null) {
-      return new Center(child: new CircularProgressIndicator());
+      return Center(child: CircularProgressIndicator());
     } else if (latestData.length == 0) {
-      return new Center(child: new Text("暂无数据"));
+      return Center(child: Text("暂无数据"));
     } else {
-      return new ListView.builder(itemBuilder: _renderLatestRow, itemCount: latestData.length);
+      return ListView.builder(itemBuilder: _renderLatestRow, itemCount: latestData.length);
     }
   }
 
   Widget getYchBody() {
     if (ychData == null) {
-      return new Center(child: new CircularProgressIndicator());
+      return Center(child: CircularProgressIndicator());
     } else if (ychData.length == 0) {
-      return new Center(child: new Text("暂无数据"));
+      return Center(child: Text("暂无数据"));
     } else {
-      return new ListView.builder(itemBuilder: _renderYchRow, itemCount: ychData.length);
+      return ListView.builder(itemBuilder: _renderYchRow, itemCount: ychData.length);
     }
   }
 
   Widget getCard(itemData) {
-    return new Card(
-      child: new Column(
+    return Card(
+      child: Column(
         children: [
-          new Image.network(itemData['cover'], fit: BoxFit.cover,),
-          new Container(
+          Image.network(itemData['cover'], fit: BoxFit.cover,),
+          Container(
             margin: const EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 5.0),
             alignment: Alignment.centerLeft,
-            child: new Text(itemData['title'], style: titleTextStyle,),
+            child: Text(itemData['title'], style: titleTextStyle,),
           ),
-          new Container(
+          Container(
               margin: const EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 5.0),
-              child: new Row(
+              child: Row(
                 children: [
-                  new Expanded(child: new Text(itemData['authorName']), flex: 1,),
-                  new Text(itemData['timeStr'])
+                  Expanded(child: Text(itemData['authorName']), flex: 1,),
+                  Text(itemData['timeStr'])
                 ],
               )
           )
@@ -108,7 +108,7 @@ class OfflineActivityPageState extends State<OfflineActivityPage> {
 
   Widget _renderRecRow(BuildContext ctx, int i) {
     Map itemData = recData[i];
-    return new InkWell(
+    return InkWell(
       child: getCard(itemData),
       onTap: () {
         _showDetail(itemData['detailUrl']);
@@ -118,7 +118,7 @@ class OfflineActivityPageState extends State<OfflineActivityPage> {
 
   Widget _renderLatestRow(BuildContext ctx, int i) {
     Map itemData = latestData[i];
-    return new InkWell(
+    return InkWell(
       child: getCard(itemData),
       onTap: () {
         _showDetail(itemData['detailUrl']);
@@ -128,7 +128,7 @@ class OfflineActivityPageState extends State<OfflineActivityPage> {
 
   Widget _renderYchRow(BuildContext ctx, int i) {
     Map itemData = ychData[i];
-    return new InkWell(
+    return InkWell(
       child: getCard(itemData),
       onTap: () {
         _showDetail(itemData['detailUrl']);
@@ -137,37 +137,37 @@ class OfflineActivityPageState extends State<OfflineActivityPage> {
   }
 
   _showDetail(detailUrl) {
-    Navigator.of(context).push(new MaterialPageRoute(
+    Navigator.of(context).push(MaterialPageRoute(
       builder: (ctx) {
-        return new CommonWebPage(title: '活动详情', url: detailUrl);
+        return CommonWebPage(title: '活动详情', url: detailUrl);
       }
     ));
   }
 
   @override
   Widget build(BuildContext context) {
-    return new Scaffold(
-      appBar: new AppBar(
-        title: new Text("线下活动", style: new TextStyle(color: Colors.white)),
-        iconTheme: new IconThemeData(color: Colors.white),
+    return Scaffold(
+      appBar: AppBar(
+        title: Text("线下活动", style: TextStyle(color: Colors.white)),
+        iconTheme: IconThemeData(color: Colors.white),
       ),
-      body: new DefaultTabController(
+      body: DefaultTabController(
         length: 3,
-        child: new Scaffold(
-            appBar: new TabBar(
+        child: Scaffold(
+            appBar: TabBar(
               tabs: <Widget>[
-                new Tab(
+                Tab(
                   text: "强力推荐",
                 ),
-                new Tab(
+                Tab(
                   text: "最新活动",
                 ),
-                new Tab(
+                Tab(
                   text: "源创会",
                 )
               ],
             ),
-            body: new TabBarView(
+            body: TabBarView(
               children: [
                 getRecBody(),
                 getLatestBody(),

+ 51 - 51
lib/pages/PublishTweetPage.dart

@@ -12,26 +12,26 @@ import 'package:image_picker/image_picker.dart';
 class PublishTweetPage extends StatefulWidget {
   @override
   State<StatefulWidget> createState() {
-    return new PublishTweetPageState();
+    return PublishTweetPageState();
   }
 }
 
 class PublishTweetPageState extends State<PublishTweetPage> {
 
-  TextEditingController _controller = new TextEditingController();
-  List<File> fileList = new List();
+  TextEditingController _controller = TextEditingController();
+  List<File> fileList = List();
   Future<File> _imageFile;
   bool isLoading = false;
   String msg = "";
 
   Widget getBody() {
-    var textField = new TextField(
-      decoration: new InputDecoration(
+    var textField = TextField(
+      decoration: InputDecoration(
         hintText: "说点什么吧~",
-        hintStyle: new TextStyle(
+        hintStyle: TextStyle(
           color: const Color(0xFF808080)
         ),
-        border: new OutlineInputBorder(
+        border: OutlineInputBorder(
           borderRadius: const BorderRadius.all(const Radius.circular(10.0))
         )
       ),
@@ -39,18 +39,18 @@ class PublishTweetPageState extends State<PublishTweetPage> {
       maxLength: 150,
       controller: _controller,
     );
-    var gridView = new Builder(
+    var gridView = Builder(
       builder: (ctx) {
-        return new GridView.count(
+        return GridView.count(
           crossAxisCount: 4,
-          children: new List.generate(fileList.length + 1, (index) {
+          children: List.generate(fileList.length + 1, (index) {
             var content;
             if (index == 0) {
               // 添加图片按钮
-              var addCell = new Center(
-                  child: new Image.asset('./images/ic_add_pics.png', width: 80.0, height: 80.0,)
+              var addCell = Center(
+                  child: Image.asset('./images/ic_add_pics.png', width: 80.0, height: 80.0,)
               );
-              content = new GestureDetector(
+              content = GestureDetector(
                 onTap: () {
                   // 添加图片
                   pickImage(ctx);
@@ -59,11 +59,11 @@ class PublishTweetPageState extends State<PublishTweetPage> {
               );
             } else {
               // 被选中的图片
-              content = new Center(
-                  child: new Image.file(fileList[index - 1], width: 80.0, height: 80.0, fit: BoxFit.cover,)
+              content = Center(
+                  child: Image.file(fileList[index - 1], width: 80.0, height: 80.0, fit: BoxFit.cover,)
               );
             }
-            return new Container(
+            return Container(
               margin: const EdgeInsets.all(2.0),
               width: 80.0,
               height: 80.0,
@@ -75,32 +75,32 @@ class PublishTweetPageState extends State<PublishTweetPage> {
       },
     );
     var children = [
-      new Text("提示:由于OSC的openapi限制,发布动弹的接口只支持上传一张图片,本项目可添加最多9张图片,但OSC只会接收最后一张图片。", style: new TextStyle(fontSize: 12.0),),
+      Text("提示:由于OSC的openapi限制,发布动弹的接口只支持上传一张图片,本项目可添加最多9张图片,但OSC只会接收最后一张图片。", style: TextStyle(fontSize: 12.0),),
       textField,
-      new Container(
+      Container(
           margin: const EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 0.0),
           height: 200.0,
           child: gridView
       )
     ];
     if (isLoading) {
-      children.add(new Container(
+      children.add(Container(
         margin: const EdgeInsets.fromLTRB(0.0, 20.0, 0.0, 0.0),
-        child: new Center(
-          child: new CircularProgressIndicator(),
+        child: Center(
+          child: CircularProgressIndicator(),
         ),
       ));
     } else {
-      children.add(new Container(
+      children.add(Container(
         margin: const EdgeInsets.fromLTRB(0.0, 20.0, 0.0, 0.0),
-        child: new Center(
-          child: new Text(msg),
+        child: Center(
+          child: Text(msg),
         )
       ));
     }
-    return new Container(
+    return Container(
       padding: const EdgeInsets.all(5.0),
-      child: new Column(
+      child: Column(
         children: children,
       ),
     );
@@ -111,8 +111,8 @@ class PublishTweetPageState extends State<PublishTweetPage> {
     // 如果已添加了9张图片,则提示不允许添加更多
     num size = fileList.length;
     if (size >= 9) {
-      Scaffold.of(ctx).showSnackBar(new SnackBar(
-        content: new Text("最多只能添加9张图片!"),
+      Scaffold.of(ctx).showSnackBar(SnackBar(
+        content: Text("最多只能添加9张图片!"),
       ));
       return;
     }
@@ -120,14 +120,14 @@ class PublishTweetPageState extends State<PublishTweetPage> {
   }
 
   Widget _bottomSheetBuilder(BuildContext context) {
-    return new Container(
+    return Container(
       height: 182.0,
-      child: new Padding(
+      child: Padding(
         padding: const EdgeInsets.fromLTRB(0.0, 30.0, 0.0, 30.0),
-        child: new Column(
+        child: Column(
           children: [
             _renderBottomMenuItem("相机拍照", ImageSource.camera),
-            new Divider(height: 2.0,),
+            Divider(height: 2.0,),
             _renderBottomMenuItem("图库选择照片", ImageSource.gallery)
           ],
         ),
@@ -136,13 +136,13 @@ class PublishTweetPageState extends State<PublishTweetPage> {
   }
 
   _renderBottomMenuItem(title, ImageSource source) {
-    var item = new Container(
+    var item = Container(
       height: 60.0,
-      child: new Center(
-        child: new Text(title)
+      child: Center(
+        child: Text(title)
       ),
     );
-    return new InkWell(
+    return InkWell(
       child: item,
       onTap: () {
         Navigator.of(context).pop();
@@ -155,30 +155,30 @@ class PublishTweetPageState extends State<PublishTweetPage> {
 
   sendTweet(ctx, token) async {
     if (token == null) {
-      Scaffold.of(ctx).showSnackBar(new SnackBar(
-        content: new Text("未登录!"),
+      Scaffold.of(ctx).showSnackBar(SnackBar(
+        content: Text("未登录!"),
       ));
       return;
     }
     String content = _controller.text;
     if (content == null || content.length == 0 || content.trim().length == 0) {
-      Scaffold.of(ctx).showSnackBar(new SnackBar(
-        content: new Text("请输入动弹内容!"),
+      Scaffold.of(ctx).showSnackBar(SnackBar(
+        content: Text("请输入动弹内容!"),
       ));
     }
     try {
-      Map<String, String> params = new Map();
+      Map<String, String> params = Map();
       params['msg'] = content;
       params['access_token'] = token;
-      var request = new MultipartRequest('POST', Uri.parse(Api.PUB_TWEET));
+      var request = MultipartRequest('POST', Uri.parse(Api.PUB_TWEET));
       request.fields.addAll(params);
       if (fileList != null && fileList.length > 0) {
         for (File f in fileList) {
-          var stream = new http.ByteStream(
+          var stream = http.ByteStream(
               DelegatingStream.typed(f.openRead()));
           var length = await f.length();
           var filename = f.path.substring(f.path.lastIndexOf("/") + 1);
-          request.files.add(new http.MultipartFile(
+          request.files.add(http.MultipartFile(
               'img', stream, length, filename: filename));
         }
       }
@@ -216,14 +216,14 @@ class PublishTweetPageState extends State<PublishTweetPage> {
 
   @override
   Widget build(BuildContext context) {
-    return new Scaffold(
-      appBar: new AppBar(
-        title: new Text("发布动弹", style: new TextStyle(color: Colors.white)),
-        iconTheme: new IconThemeData(color: Colors.white),
+    return Scaffold(
+      appBar: AppBar(
+        title: Text("发布动弹", style: TextStyle(color: Colors.white)),
+        iconTheme: IconThemeData(color: Colors.white),
         actions: <Widget>[
-          new Builder(
+          Builder(
             builder: (ctx) {
-              return new IconButton(icon: new Icon(Icons.send), onPressed: () {
+              return IconButton(icon: Icon(Icons.send), onPressed: () {
                 // 发送动弹
                 DataUtils.isLogin().then((isLogin) {
                   if (isLogin) {
@@ -239,7 +239,7 @@ class PublishTweetPageState extends State<PublishTweetPage> {
           )
         ],
       ),
-      body: new FutureBuilder(
+      body: FutureBuilder(
         future: _imageFile,
         builder: (BuildContext context, AsyncSnapshot<File> snapshot) {
           if (snapshot.connectionState == ConnectionState.done &&

+ 22 - 22
lib/pages/SettingsPage.dart

@@ -12,8 +12,8 @@ class SettingsPage extends StatelessWidget {
   static const double IMAGE_ICON_WIDTH = 30.0;
   static const double ARROW_ICON_WIDTH = 16.0;
 
-  final titleTextStyle = new TextStyle(fontSize: 16.0);
-  final rightArrowIcon = new Image.asset(
+  final titleTextStyle = TextStyle(fontSize: 16.0);
+  final rightArrowIcon = Image.asset(
     'images/ic_arrow_right.png',
     width: ARROW_ICON_WIDTH,
     height: ARROW_ICON_WIDTH,
@@ -25,14 +25,14 @@ class SettingsPage extends StatelessWidget {
     listData.add(TAG_BLANK);
     listData.add(TAG_START);
     listData.add(
-        new ListItem(title: '退出登录', icon: 'images/ic_discover_nearby.png'));
+        ListItem(title: '退出登录', icon: 'images/ic_discover_nearby.png'));
     listData.add(TAG_END);
   }
 
   Widget getIconImage(path) {
-    return new Padding(
+    return Padding(
       padding: const EdgeInsets.fromLTRB(0.0, 0.0, 10.0, 0.0),
-      child: new Image.asset(path,
+      child: Image.asset(path,
           width: IMAGE_ICON_WIDTH, height: IMAGE_ICON_WIDTH),
     );
   }
@@ -40,43 +40,43 @@ class SettingsPage extends StatelessWidget {
   _renderRow(BuildContext ctx, int i) {
     var item = listData[i];
     if (item is String) {
-      Widget w = new Divider(
+      Widget w = Divider(
         height: 1.0,
       );
       switch (item) {
         case TAG_START:
-          w = new Divider(
+          w = Divider(
             height: 1.0,
           );
           break;
         case TAG_END:
-          w = new Divider(
+          w = Divider(
             height: 1.0,
           );
           break;
         case TAG_CENTER:
-          w = new Padding(
+          w = Padding(
             padding: const EdgeInsets.fromLTRB(50.0, 0.0, 0.0, 0.0),
-            child: new Divider(
+            child: Divider(
               height: 1.0,
             ),
           );
           break;
         case TAG_BLANK:
-          w = new Container(
+          w = Container(
             height: 20.0,
           );
           break;
       }
       return w;
     } else if (item is ListItem) {
-      var listItemContent = new Padding(
+      var listItemContent = Padding(
         padding: const EdgeInsets.fromLTRB(10.0, 15.0, 10.0, 15.0),
-        child: new Row(
+        child: Row(
           children: [
             getIconImage(item.icon),
-            new Expanded(
-                child: new Text(
+            Expanded(
+                child: Text(
               item.title,
               style: titleTextStyle,
             )),
@@ -84,13 +84,13 @@ class SettingsPage extends StatelessWidget {
           ],
         ),
       );
-      return new InkWell(
+      return InkWell(
         onTap: () {
           String title = item.title;
           if (title == '退出登录') {
             DataUtils.clearLoginInfo().then((arg) {
               Navigator.of(ctx).pop();
-              Constants.eventBus.fire(new LogoutEvent());
+              Constants.eventBus.fire(LogoutEvent());
               print("event fired!");
             });
           }
@@ -102,12 +102,12 @@ class SettingsPage extends StatelessWidget {
 
   @override
   Widget build(BuildContext context) {
-    return new Scaffold(
-      appBar: new AppBar(
-        title: new Text("设置", style: new TextStyle(color: Colors.white)),
-        iconTheme: new IconThemeData(color: Colors.white),
+    return Scaffold(
+      appBar: AppBar(
+        title: Text("设置", style: TextStyle(color: Colors.white)),
+        iconTheme: IconThemeData(color: Colors.white),
       ),
-      body: new ListView.builder(
+      body: ListView.builder(
         itemBuilder: (ctx, i) => _renderRow(ctx, i),
         itemCount: listData.length,
       ),

+ 13 - 13
lib/pages/TestPage.dart

@@ -4,33 +4,33 @@ import 'package:flutter/cupertino.dart';
 class TestPage extends StatelessWidget {
   @override
   Widget build(BuildContext context) {
-    return new MaterialApp(
+    return MaterialApp(
       title: "Test",
-      home: new Scaffold(
-        appBar: new AppBar(
-          title: new Text("Test"),
+      home: Scaffold(
+        appBar: AppBar(
+          title: Text("Test"),
         ),
-        body: new Center(
-          child: new Column(
+        body: Center(
+          child: Column(
             mainAxisAlignment: MainAxisAlignment.center,
             children: [
-              new Text("hello"),
-              new Text("world")
+              Text("hello"),
+              Text("world")
             ],
           ),
         ),
-//        body: new Container(
+//        body: Container(
 //          margin: const EdgeInsets.all(10.0),
 //          width: 80.0,
 //          height: 80.0,
-//          decoration: new BoxDecoration(
+//          decoration: BoxDecoration(
 //            shape: BoxShape.circle,
 //            color: Colors.blue,
-//            image: new DecorationImage(
-//              image: new ExactAssetImage('./images/ic_test.png'),
+//            image: DecorationImage(
+//              image: ExactAssetImage('./images/ic_test.png'),
 //              fit: BoxFit.cover
 //            ),
-//            border: new Border.all(
+//            border: Border.all(
 //              color: Colors.white,
 //              width: 2.0,
 //            ),

+ 88 - 88
lib/pages/TweetDetailPage.dart

@@ -15,7 +15,7 @@ class TweetDetailPage extends StatefulWidget {
 
   @override
   State<StatefulWidget> createState() {
-    return new TweetDetailPageState(tweetData: tweetData);
+    return TweetDetailPageState(tweetData: tweetData);
   }
 }
 
@@ -23,19 +23,19 @@ class TweetDetailPageState extends State<TweetDetailPage> {
 
   Map<String, dynamic> tweetData;
   List commentList;
-  RegExp regExp1 = new RegExp("</.*>");
-  RegExp regExp2 = new RegExp("<.*>");
-  TextStyle subtitleStyle = new TextStyle(
+  RegExp regExp1 = RegExp("</.*>");
+  RegExp regExp2 = RegExp("<.*>");
+  TextStyle subtitleStyle = TextStyle(
       fontSize: 12.0,
       color: const Color(0xFFB5BDC0)
   );
-  TextStyle contentStyle = new TextStyle(
+  TextStyle contentStyle = TextStyle(
       fontSize: 15.0,
       color: Colors.black
   );
   num curPage = 1;
-  ScrollController _controller = new ScrollController();
-  TextEditingController _inputController = new TextEditingController();
+  ScrollController _controller = ScrollController();
+  TextEditingController _inputController = TextEditingController();
 
   TweetDetailPageState({Key key, this.tweetData});
 
@@ -47,7 +47,7 @@ class TweetDetailPageState extends State<TweetDetailPage> {
           if (token == null || token.length == 0) {
             return;
           }
-          Map<String, String> params = new Map();
+          Map<String, String> params = Map();
           var id = this.tweetData['id'];
           params['id'] = '$id';
           params['catalog'] = '3';// 3是动弹评论
@@ -60,11 +60,11 @@ class TweetDetailPageState extends State<TweetDetailPage> {
               if (!isLoadMore) {
                 commentList = json.decode(data)['commentList'];
                 if (commentList == null) {
-                  commentList = new List();
+                  commentList = List();
                 }
               } else {
                 // 加载更多数据
-                List list = new List();
+                List list = List();
                 list.addAll(commentList);
                 list.addAll(json.decode(data)['commentList']);
                 if (list.length >= tweetData['commentCount']) {
@@ -96,20 +96,20 @@ class TweetDetailPageState extends State<TweetDetailPage> {
 
   @override
   Widget build(BuildContext context) {
-    var _body = commentList == null ? new Center(
-      child: new CircularProgressIndicator(),
-    ) : new ListView.builder(
+    var _body = commentList == null ? Center(
+      child: CircularProgressIndicator(),
+    ) : ListView.builder(
       itemCount: commentList.length == 0 ? 1 : commentList.length * 2,
       itemBuilder: renderListItem,
       controller: _controller,
     );
-    return new Scaffold(
-      appBar: new AppBar(
-        title: new Text("动弹详情", style: new TextStyle(color: Colors.white)),
-        iconTheme: new IconThemeData(color: Colors.white),
+    return Scaffold(
+      appBar: AppBar(
+        title: Text("动弹详情", style: TextStyle(color: Colors.white)),
+        iconTheme: IconThemeData(color: Colors.white),
         actions: <Widget>[
-          new IconButton(
-            icon: new Icon(Icons.send),
+          IconButton(
+            icon: Icon(Icons.send),
             onPressed: () {
               // 回复楼主
               showReplyBottomView(context, true);
@@ -127,7 +127,7 @@ class TweetDetailPageState extends State<TweetDetailPage> {
     }
     i -= 1;
     if (i.isOdd) {
-      return new Divider(height: 1.0,);
+      return Divider(height: 1.0,);
     }
     i ~/= 2;
     return _renderCommentRow(context, i);
@@ -137,41 +137,41 @@ class TweetDetailPageState extends State<TweetDetailPage> {
   _renderCommentRow(context, i) {
     var listItem = commentList[i];
     if (listItem is String && listItem == Constants.END_LINE_TAG) {
-      return new CommonEndLine();
+      return CommonEndLine();
     }
     String avatar = listItem['commentPortrait'];
     String author = listItem['commentAuthor'];
     String date = listItem['pubDate'];
     String content = listItem['content'];
     content = clearHtmlContent(content);
-    var row = new Row(
+    var row = Row(
       children: [
-        new Padding(
+        Padding(
           padding: const EdgeInsets.all(10.0),
-          child: new Image.network(avatar, width: 35.0, height: 35.0,)
+          child: Image.network(avatar, width: 35.0, height: 35.0,)
         ),
-        new Expanded(
-          child: new Container(
+        Expanded(
+          child: Container(
             margin: const EdgeInsets.fromLTRB(0.0, 5.0, 0.0, 5.0),
-            child: new Column(
+            child: Column(
               children: [
-                new Row(
+                Row(
                   children: [
-                    new Expanded(
-                      child: new Text(author, style: new TextStyle(color: const Color(0xFF63CA6C)),),
+                    Expanded(
+                      child: Text(author, style: TextStyle(color: const Color(0xFF63CA6C)),),
                     ),
-                    new Padding(
+                    Padding(
                         padding: const EdgeInsets.fromLTRB(0.0, 0.0, 10.0, 0.0),
-                        child: new Text(date, style: subtitleStyle,)
+                        child: Text(date, style: subtitleStyle,)
                     )
                   ],
                 ),
-                new Padding(
+                Padding(
                     padding: const EdgeInsets.fromLTRB(0.0, 0.0, 10.0, 0.0),
-                    child: new Row(
+                    child: Row(
                       children: [
-                        new Expanded(
-                            child: new Text(content, style: contentStyle,)
+                        Expanded(
+                            child: Text(content, style: contentStyle,)
                         )
                       ],
                     )
@@ -182,9 +182,9 @@ class TweetDetailPageState extends State<TweetDetailPage> {
         )
       ],
     );
-    return new Builder(
+    return Builder(
       builder: (ctx) {
-        return new InkWell(
+        return InkWell(
           onTap: () {
             showReplyBottomView(ctx, false, data: listItem);
           },
@@ -208,26 +208,26 @@ class TweetDetailPageState extends State<TweetDetailPage> {
     showModalBottomSheet(
       context: ctx,
       builder: (sheetCtx) {
-        return new Container(
+        return Container(
           height: 230.0,
           padding: const EdgeInsets.all(20.0),
-          child: new Column(
+          child: Column(
             children: [
-              new Row(
+              Row(
                 children: [
-                  new Text(isMainFloor ? "回复楼主" : "回复"),
-                  new Expanded(child: new Text(title, style: new TextStyle(color: const Color(0xFF63CA6C)),)),
-                  new InkWell(
-                    child: new Container(
+                  Text(isMainFloor ? "回复楼主" : "回复"),
+                  Expanded(child: Text(title, style: TextStyle(color: const Color(0xFF63CA6C)),)),
+                  InkWell(
+                    child: Container(
                       padding: const EdgeInsets.fromLTRB(10.0, 6.0, 10.0, 6.0),
-                      decoration: new BoxDecoration(
-                        border: new Border.all(
+                      decoration: BoxDecoration(
+                        border: Border.all(
                           color: const Color(0xFF63CA6C),
                           width: 1.0,
                         ),
-                        borderRadius: new BorderRadius.all(new Radius.circular(6.0))
+                        borderRadius: BorderRadius.all(Radius.circular(6.0))
                       ),
-                      child: new Text("发送", style: new TextStyle(color: const Color(0xFF63CA6C)),),
+                      child: Text("发送", style: TextStyle(color: const Color(0xFF63CA6C)),),
                     ),
                     onTap: () {
                       // 发送回复
@@ -236,18 +236,18 @@ class TweetDetailPageState extends State<TweetDetailPage> {
                   )
                 ],
               ),
-              new Container(
+              Container(
                 height: 10.0,
               ),
-              new TextField(
+              TextField(
                 maxLines: 5,
                 controller: _inputController,
-                decoration: new InputDecoration(
+                decoration: InputDecoration(
                   hintText: "说点啥~",
-                  hintStyle: new TextStyle(
+                  hintStyle: TextStyle(
                       color: const Color(0xFF808080)
                   ),
-                  border: new OutlineInputBorder(
+                  border: OutlineInputBorder(
                     borderRadius: const BorderRadius.all(const Radius.circular(10.0)),
                   )
                 ),
@@ -267,7 +267,7 @@ class TweetDetailPageState extends State<TweetDetailPage> {
       DataUtils.isLogin().then((isLogin) {
         if (isLogin) {
           DataUtils.getAccessToken().then((token) {
-            Map<String, String> params = new Map();
+            Map<String, String> params = Map();
             params['access_token'] = token;
             params['id'] = "${tweetData['id']}";
             print("id: ${tweetData['id']}");
@@ -295,36 +295,36 @@ class TweetDetailPageState extends State<TweetDetailPage> {
   }
 
   Widget getTweetView(Map<String, dynamic> listItem) {
-    var authorRow = new Row(
+    var authorRow = Row(
       children: [
-        new Container(
+        Container(
           width: 35.0,
           height: 35.0,
-          decoration: new BoxDecoration(
+          decoration: BoxDecoration(
             shape: BoxShape.circle,
             color: Colors.blue,
-            image: new DecorationImage(
-                image: new NetworkImage(listItem['portrait']),
+            image: DecorationImage(
+                image: NetworkImage(listItem['portrait']),
                 fit: BoxFit.cover
             ),
-            border: new Border.all(
+            border: Border.all(
               color: Colors.white,
               width: 2.0,
             ),
           ),
         ),
-        new Padding(
+        Padding(
             padding: const EdgeInsets.fromLTRB(6.0, 0.0, 0.0, 0.0),
-            child: new Text(listItem['author'], style: new TextStyle(
+            child: Text(listItem['author'], style: TextStyle(
               fontSize: 16.0,
             ))
         ),
-        new Expanded(
-          child: new Row(
+        Expanded(
+          child: Row(
             mainAxisAlignment: MainAxisAlignment.end,
             children: [
-              new Text('${listItem['commentCount']}', style: subtitleStyle,),
-              new Image.asset('./images/ic_comment.png', width: 20.0, height: 20.0,)
+              Text('${listItem['commentCount']}', style: subtitleStyle,),
+              Image.asset('./images/ic_comment.png', width: 20.0, height: 20.0,)
             ],
           ),
         )
@@ -332,23 +332,23 @@ class TweetDetailPageState extends State<TweetDetailPage> {
     );
     var _body = listItem['body'];
     _body = clearHtmlContent(_body);
-    var contentRow = new Row(
+    var contentRow = Row(
       children: [
-        new Expanded(child: new Text(_body),)
+        Expanded(child: Text(_body),)
       ],
     );
-    var timeRow = new Row(
+    var timeRow = Row(
       mainAxisAlignment: MainAxisAlignment.start,
       children: [
-        new Text(listItem['pubDate'], style: subtitleStyle,)
+        Text(listItem['pubDate'], style: subtitleStyle,)
       ],
     );
     var columns = <Widget>[
-      new Padding(
+      Padding(
         padding: const EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 2.0),
         child: authorRow,
       ),
-      new Padding(
+      Padding(
         padding: const EdgeInsets.fromLTRB(52.0, 0.0, 10.0, 0.0),
         child: contentRow,
       ),
@@ -357,7 +357,7 @@ class TweetDetailPageState extends State<TweetDetailPage> {
     if (imgSmall != null && imgSmall.length > 0) {
       // 动弹中有图片
       List<String> list = imgSmall.split(",");
-      List<String> imgUrlList = new List<String>();
+      List<String> imgUrlList = List<String>();
       for (String s in list) {
         if (s.startsWith("http")) {
           imgUrlList.add(s);
@@ -375,52 +375,52 @@ class TweetDetailPageState extends State<TweetDetailPage> {
           num screenWidth = MediaQuery.of(context).size.width;
           double cellWidth = (screenWidth - 100) / 3;
           if (index < len) {
-            rowArr.add(new Padding(
+            rowArr.add(Padding(
               padding: const EdgeInsets.all(2.0),
-              child: new Image.network(imgUrlList[index], width: cellWidth, height: cellWidth),
+              child: Image.network(imgUrlList[index], width: cellWidth, height: cellWidth),
             ));
           }
         }
         rows.add(rowArr);
       }
       for (var row in rows) {
-        imgList.add(new Row(
+        imgList.add(Row(
           children: row,
         ));
       }
-      columns.add(new Padding(
+      columns.add(Padding(
         padding: const EdgeInsets.fromLTRB(52.0, 5.0, 10.0, 0.0),
-        child: new Column(
+        child: Column(
           children: imgList,
         ),
       ));
     }
-    columns.add(new Padding(
+    columns.add(Padding(
       padding: const EdgeInsets.fromLTRB(52.0, 10.0, 10.0, 6.0),
       child: timeRow,
     ));
-    columns.add(new Divider(height: 5.0,));
-    columns.add(new Container(
+    columns.add(Divider(height: 5.0,));
+    columns.add(Container(
       margin: const EdgeInsets.fromLTRB(0.0, 6.0, 0.0, 0.0),
-      child: new Row(
+      child: Row(
         children: [
-          new Container(
+          Container(
             width: 4.0,
             height: 20.0,
             color: const Color(0xFF63CA6C),
           ),
-          new Expanded(
+          Expanded(
             flex: 1,
-            child: new Container(
+            child: Container(
               height: 20.0,
               color: const Color(0xFFECECEC),
-              child: new Text("评论列表", style: new TextStyle(color: const Color(0xFF63CA6C)),)
+              child: Text("评论列表", style: TextStyle(color: const Color(0xFF63CA6C)),)
             ),
           )
         ],
       ),
     ));
-    return new Column(
+    return Column(
       children: columns,
     );
   }

+ 86 - 86
lib/pages/TweetsListPage.dart

@@ -15,7 +15,7 @@ import '../util/DataUtils.dart';
 class TweetsListPage extends StatefulWidget {
   @override
   State<StatefulWidget> createState() {
-    return new TweetsListPageState();
+    return TweetsListPageState();
   }
 }
 
@@ -24,8 +24,8 @@ class TweetsListPageState extends State<TweetsListPage> {
   List normalTweetsList;
   TextStyle authorTextStyle;
   TextStyle subtitleStyle;
-  RegExp regExp1 = new RegExp("</.*>");
-  RegExp regExp2 = new RegExp("<.*>");
+  RegExp regExp1 = RegExp("</.*>");
+  RegExp regExp2 = RegExp("<.*>");
   num curPage = 1;
   bool loading = false;
   ScrollController _controller;
@@ -53,10 +53,10 @@ class TweetsListPageState extends State<TweetsListPage> {
 
   TweetsListPageState() {
     authorTextStyle =
-        new TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold);
+        TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold);
     subtitleStyle =
-        new TextStyle(fontSize: 12.0, color: const Color(0xFFB5BDC0));
-    _controller = new ScrollController();
+        TextStyle(fontSize: 12.0, color: const Color(0xFFB5BDC0));
+    _controller = ScrollController();
     _controller.addListener(() {
       var maxScroll = _controller.position.maxScrollExtent;
       var pixels = _controller.position.pixels;
@@ -76,7 +76,7 @@ class TweetsListPageState extends State<TweetsListPage> {
             return;
           }
           loading = true;
-          Map<String, String> params = new Map();
+          Map<String, String> params = Map();
           params['access_token'] = token;
           params['page'] = "$curPage";
           if (isHot) {
@@ -97,7 +97,7 @@ class TweetsListPageState extends State<TweetsListPage> {
               }
             } else {
               // load more
-              List list = new List();
+              List list = List();
               list.addAll(normalTweetsList);
               list.addAll(obj['tweetlist']);
               normalTweetsList = list;
@@ -114,7 +114,7 @@ class TweetsListPageState extends State<TweetsListPage> {
   filterList(List<dynamic> objList, bool isHot) {
     BlackListUtils.getBlackListIds().then((intList) {
       if (intList != null && intList.isNotEmpty && objList != null) {
-        List newList = new List();
+        List newList = List();
         for (dynamic item in objList) {
           int authorId = item['authorid'];
           if (!intList.contains(authorId)) {
@@ -155,38 +155,38 @@ class TweetsListPageState extends State<TweetsListPage> {
   }
 
   Widget getRowWidget(Map<String, dynamic> listItem) {
-    var authorRow = new Row(
+    var authorRow = Row(
       children: [
-        new Container(
+        Container(
           width: 35.0,
           height: 35.0,
-          decoration: new BoxDecoration(
+          decoration: BoxDecoration(
             shape: BoxShape.circle,
             color: Colors.transparent,
-            image: new DecorationImage(
-                image: new NetworkImage(listItem['portrait']),
+            image: DecorationImage(
+                image: NetworkImage(listItem['portrait']),
                 fit: BoxFit.cover),
-            border: new Border.all(
+            border: Border.all(
               color: Colors.white,
               width: 2.0,
             ),
           ),
         ),
-        new Padding(
+        Padding(
             padding: const EdgeInsets.fromLTRB(6.0, 0.0, 0.0, 0.0),
-            child: new Text(listItem['author'],
-                style: new TextStyle(
+            child: Text(listItem['author'],
+                style: TextStyle(
                   fontSize: 16.0,
                 ))),
-        new Expanded(
-          child: new Row(
+        Expanded(
+          child: Row(
             mainAxisAlignment: MainAxisAlignment.end,
             children: [
-              new Text(
+              Text(
                 '${listItem['commentCount']}',
                 style: subtitleStyle,
               ),
-              new Image.asset(
+              Image.asset(
                 './images/ic_comment.png',
                 width: 16.0,
                 height: 16.0,
@@ -198,28 +198,28 @@ class TweetsListPageState extends State<TweetsListPage> {
     );
     var _body = listItem['body'];
     _body = clearHtmlContent(_body);
-    var contentRow = new Row(
+    var contentRow = Row(
       children: [
-        new Expanded(
-          child: new Text(_body),
+        Expanded(
+          child: Text(_body),
         )
       ],
     );
-    var timeRow = new Row(
+    var timeRow = Row(
       mainAxisAlignment: MainAxisAlignment.end,
       children: [
-        new Text(
+        Text(
           listItem['pubDate'],
           style: subtitleStyle,
         )
       ],
     );
     var columns = <Widget>[
-      new Padding(
+      Padding(
         padding: const EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 2.0),
         child: authorRow,
       ),
-      new Padding(
+      Padding(
         padding: const EdgeInsets.fromLTRB(52.0, 0.0, 10.0, 0.0),
         child: contentRow,
       ),
@@ -228,7 +228,7 @@ class TweetsListPageState extends State<TweetsListPage> {
     if (imgSmall != null && imgSmall.length > 0) {
       // 动弹中有图片
       List<String> list = imgSmall.split(",");
-      List<String> imgUrlList = new List<String>();
+      List<String> imgUrlList = List<String>();
       for (String s in list) {
         if (s.startsWith("http")) {
           imgUrlList.add(s);
@@ -246,9 +246,9 @@ class TweetsListPageState extends State<TweetsListPage> {
           num screenWidth = MediaQuery.of(context).size.width;
           double cellWidth = (screenWidth - 100) / 3;
           if (index < len) {
-            rowArr.add(new Padding(
+            rowArr.add(Padding(
               padding: const EdgeInsets.all(2.0),
-              child: new Image.network(imgUrlList[index],
+              child: Image.network(imgUrlList[index],
                   width: cellWidth, height: cellWidth),
             ));
           }
@@ -256,29 +256,29 @@ class TweetsListPageState extends State<TweetsListPage> {
         rows.add(rowArr);
       }
       for (var row in rows) {
-        imgList.add(new Row(
+        imgList.add(Row(
           children: row,
         ));
       }
-      columns.add(new Padding(
+      columns.add(Padding(
         padding: const EdgeInsets.fromLTRB(52.0, 5.0, 10.0, 0.0),
-        child: new Column(
+        child: Column(
           children: imgList,
         ),
       ));
     }
-    columns.add(new Padding(
+    columns.add(Padding(
       padding: const EdgeInsets.fromLTRB(0.0, 10.0, 10.0, 6.0),
       child: timeRow,
     ));
-    return new InkWell(
-      child: new Column(
+    return InkWell(
+      child: Column(
         children: columns,
       ),
       onTap: () {
         // 跳转到动弹详情
-        Navigator.of(context).push(new MaterialPageRoute(builder: (ctx) {
-          return new TweetDetailPage(
+        Navigator.of(context).push(MaterialPageRoute(builder: (ctx) {
+          return TweetDetailPage(
             tweetData: listItem,
           );
         }));
@@ -287,23 +287,23 @@ class TweetsListPageState extends State<TweetsListPage> {
         showDialog(
           context: context,
           builder: (BuildContext ctx) {
-            return new AlertDialog(
-              title: new Text('提示'),
-              content: new Text('要把\"${listItem['author']}\"关进小黑屋吗?'),
+            return AlertDialog(
+              title: Text('提示'),
+              content: Text('要把\"${listItem['author']}\"关进小黑屋吗?'),
               actions: <Widget>[
-                new FlatButton(
-                  child: new Text(
+                FlatButton(
+                  child: Text(
                     '取消',
-                    style: new TextStyle(color: Colors.red),
+                    style: TextStyle(color: Colors.red),
                   ),
                   onPressed: () {
                     Navigator.of(context).pop();
                   },
                 ),
-                new FlatButton(
-                  child: new Text(
+                FlatButton(
+                  child: Text(
                     '确定',
-                    style: new TextStyle(color: Colors.blue),
+                    style: TextStyle(color: Colors.blue),
                   ),
                   onPressed: () {
                     putIntoBlackHouse(listItem);
@@ -324,7 +324,7 @@ class TweetsListPageState extends State<TweetsListPage> {
     DataUtils.getUserInfo().then((info) {
       if (info != null) {
         int loginUserId = info.id;
-        Map<String, String> params = new Map();
+        Map<String, String> params = Map();
         params['userid'] = '$loginUserId';
         params['authorid'] = '$authorId';
         params['authoravatar'] = portrait;
@@ -359,14 +359,14 @@ class TweetsListPageState extends State<TweetsListPage> {
     showDialog(
       context: context,
       builder: (BuildContext ctx) {
-        return new AlertDialog(
-          title: new Text('提示'),
-          content: new Text(msg),
+        return AlertDialog(
+          title: Text('提示'),
+          content: Text(msg),
           actions: <Widget>[
-            new FlatButton(
-              child: new Text(
+            FlatButton(
+              child: Text(
                 '确定',
-                style: new TextStyle(color: Colors.red),
+                style: TextStyle(color: Colors.red),
               ),
               onPressed: () {
                 Navigator.of(context).pop();
@@ -379,7 +379,7 @@ class TweetsListPageState extends State<TweetsListPage> {
 
   renderHotRow(i) {
     if (i.isOdd) {
-      return new Divider(
+      return Divider(
         height: 1.0,
       );
     } else {
@@ -390,7 +390,7 @@ class TweetsListPageState extends State<TweetsListPage> {
 
   renderNormalRow(i) {
     if (i.isOdd) {
-      return new Divider(
+      return Divider(
         height: 1.0,
       );
     } else {
@@ -417,12 +417,12 @@ class TweetsListPageState extends State<TweetsListPage> {
   Widget getHotListView() {
     if (hotTweetsList == null) {
       getTweetsList(false, true);
-      return new Center(
-        child: new CircularProgressIndicator(),
+      return Center(
+        child: CircularProgressIndicator(),
       );
     } else {
       // 热门动弹列表
-      return new ListView.builder(
+      return ListView.builder(
         itemCount: hotTweetsList.length * 2 - 1,
         itemBuilder: (context, i) => renderHotRow(i),
       );
@@ -432,13 +432,13 @@ class TweetsListPageState extends State<TweetsListPage> {
   Widget getNormalListView() {
     if (normalTweetsList == null) {
       getTweetsList(false, false);
-      return new Center(
-        child: new CircularProgressIndicator(),
+      return Center(
+        child: CircularProgressIndicator(),
       );
     } else {
       // 普通动弹列表
-      return new RefreshIndicator(
-        child: new ListView.builder(
+      return RefreshIndicator(
+        child: ListView.builder(
           itemCount: normalTweetsList.length * 2 - 1,
           itemBuilder: (context, i) => renderNormalRow(i),
           physics: const AlwaysScrollableScrollPhysics(),
@@ -451,37 +451,37 @@ class TweetsListPageState extends State<TweetsListPage> {
   @override
   Widget build(BuildContext context) {
     if (!isUserLogin) {
-      return new Center(
-        child: new Column(
+      return Center(
+        child: Column(
           mainAxisAlignment: MainAxisAlignment.center,
           children: [
-            new Container(
+            Container(
               padding: const EdgeInsets.all(10.0),
-              child: new Center(
-                child: new Column(
+              child: Center(
+                child: Column(
                   children: [
-                    new Text("由于OSC的openapi限制"),
-                    new Text("必须登录后才能获取动弹信息")
+                    Text("由于OSC的openapi限制"),
+                    Text("必须登录后才能获取动弹信息")
                   ],
                 ),
               )
             ),
-            new InkWell(
-              child: new Container(
+            InkWell(
+              child: Container(
                 padding: const EdgeInsets.fromLTRB(15.0, 8.0, 15.0, 8.0),
-                child: new Text("去登录"),
-                decoration: new BoxDecoration(
-                  border: new Border.all(color: Colors.black),
-                  borderRadius: new BorderRadius.all(new Radius.circular(5.0))
+                child: Text("去登录"),
+                decoration: BoxDecoration(
+                  border: Border.all(color: Colors.black),
+                  borderRadius: BorderRadius.all(Radius.circular(5.0))
                 ),
               ),
               onTap: () async {
-                final result = await Navigator.of(context).push(new MaterialPageRoute(builder: (BuildContext context) {
+                final result = await Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) {
                   return LoginPage();
                 }));
                 if (result != null && result == "refresh") {
                   // 通知动弹页面刷新
-                  Constants.eventBus.fire(new LoginEvent());
+                  Constants.eventBus.fire(LoginEvent());
                 }
               },
             ),
@@ -489,20 +489,20 @@ class TweetsListPageState extends State<TweetsListPage> {
         ),
       );
     }
-    return new DefaultTabController(
+    return DefaultTabController(
       length: 2,
-      child: new Scaffold(
-        appBar: new TabBar(
+      child: Scaffold(
+        appBar: TabBar(
           tabs: <Widget>[
-            new Tab(
+            Tab(
               text: "动弹列表",
             ),
-            new Tab(
+            Tab(
               text: "热门动弹",
             )
           ],
         ),
-        body: new TabBarView(
+        body: TabBarView(
           children: [getNormalListView(), getHotListView()],
         )),
     );

+ 1 - 1
lib/pages/UserInfoDetailPage.dart

@@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
 class UserInfoDetailPage extends StatefulWidget {
   @override
   State<StatefulWidget> createState() {
-    return new UserInfoDetailState();
+    return UserInfoDetailState();
   }
 }
 

+ 5 - 5
lib/util/BlackListUtils.dart

@@ -9,9 +9,9 @@ class BlackListUtils {
   // 将对象数组转化为整型数组
   static List<int> convert(List objList) {
     if (objList == null || objList.isEmpty) {
-      return new List<int>();
+      return List<int>();
     }
-    List<int> intList = new List();
+    List<int> intList = List();
     for (var obj in objList) {
       intList.add(obj['authorid']);
     }
@@ -23,7 +23,7 @@ class BlackListUtils {
     if (str != null && str.length > 0) {
       List<String> list = str.split(",");
       if (list != null && list.isNotEmpty) {
-        List<int> intList = new List();
+        List<int> intList = List();
         for (String s in list) {
           intList.add(int.parse(s));
         }
@@ -38,7 +38,7 @@ class BlackListUtils {
     if (list == null || list.isEmpty) {
       return null;
     }
-    StringBuffer sb = new StringBuffer();
+    StringBuffer sb = StringBuffer();
     for (int id in list) {
       sb.write("$id,");
     }
@@ -81,7 +81,7 @@ class BlackListUtils {
         return list;
       }
     } else {
-      List<int> l = new List();
+      List<int> l = List();
       l.add(id);
       String str = await saveBlackListIds(l);
       return _str2intList(str);

+ 2 - 2
lib/util/DataUtils.dart

@@ -65,7 +65,7 @@ class DataUtils {
       await sp.setString(SP_USER_LOC, location);
       await sp.setString(SP_USER_EMAIL, email);
       await sp.setString(SP_USER_URL, url);
-      UserInfo userInfo = new UserInfo(
+      UserInfo userInfo = UserInfo(
         id: id,
         name: name,
         gender: gender,
@@ -86,7 +86,7 @@ class DataUtils {
     if (isLogin == null || !isLogin) {
       return null;
     }
-    UserInfo userInfo = new UserInfo();
+    UserInfo userInfo = UserInfo();
     userInfo.id = sp.getInt(SP_USER_ID);
     userInfo.name = sp.getString(SP_USER_NAME);
     userInfo.avatar = sp.getString(SP_USER_AVATAR);

+ 1 - 1
lib/util/NetUtils.dart

@@ -4,7 +4,7 @@ import 'package:http/http.dart' as http;
 class NetUtils {
   static Future<String> get(String url, {Map<String, String> params}) async {
     if (params != null && params.isNotEmpty) {
-      StringBuffer sb = new StringBuffer("?");
+      StringBuffer sb = StringBuffer("?");
       params.forEach((key, value) {
         sb.write("$key" + "=" + "$value" + "&");
       });

+ 2 - 2
lib/util/Utf8Utils.dart

@@ -7,7 +7,7 @@ class Utf8Utils {
       return null;
     }
     List<int> list = utf8.encode(origin);
-    StringBuffer sb = new StringBuffer();
+    StringBuffer sb = StringBuffer();
     for (int i in list) {
       sb.write("$i,");
     }
@@ -21,7 +21,7 @@ class Utf8Utils {
     }
     List<String> list = encodeStr.split(",");
     if (list != null && list.isNotEmpty) {
-      List<int> intList = new List();
+      List<int> intList = List();
       for (String s in list) {
         intList.add(int.parse(s));
       }

+ 6 - 6
lib/widgets/CircleImage.dart

@@ -22,21 +22,21 @@ class CircleImageState extends State<CircleImage> {
   Widget build(BuildContext context) {
     var img;
     if (widget.type == CircleImageType.network) {
-      img = new Image.network(widget.path, width: widget.width, height: widget.height);
+      img = Image.network(widget.path, width: widget.width, height: widget.height);
     } else {
-      img = new Image.asset(widget.path, width: widget.width, height: widget.height);
+      img = Image.asset(widget.path, width: widget.width, height: widget.height);
     }
-    return new Container(
+    return Container(
       width: widget.width,
       height: widget.height,
-      decoration: new BoxDecoration(
+      decoration: BoxDecoration(
         shape: BoxShape.circle,
         color: Colors.blue,
-        image: new DecorationImage(
+        image: DecorationImage(
             image: img,
             fit: BoxFit.cover
         ),
-        border: new Border.all(
+        border: Border.all(
           color: Colors.white,
           width: 2.0,
         ),

+ 7 - 7
lib/widgets/CommonEndLine.dart

@@ -3,18 +3,18 @@ import 'package:flutter/material.dart';
 class CommonEndLine extends StatelessWidget {
   @override
   Widget build(BuildContext context) {
-    return new Container(
+    return Container(
       color: const Color(0xFFEEEEEE),
       padding: const EdgeInsets.fromLTRB(5.0, 15.0, 5.0, 15.0),
-      child: new Row(
+      child: Row(
         children: [
-          new Expanded(
-            child: new Divider(height: 10.0,),
+          Expanded(
+            child: Divider(height: 10.0,),
             flex: 1,
           ),
-          new Text("我也是有底线的"),
-          new Expanded(
-            child: new Divider(height: 10.0,),
+          Text("我也是有底线的"),
+          Expanded(
+            child: Divider(height: 10.0,),
             flex: 1,
           ),
         ],

+ 25 - 25
lib/widgets/MyDrawer.dart

@@ -9,24 +9,24 @@ class MyDrawer extends StatelessWidget {
 
   static const double IMAGE_ICON_WIDTH = 30.0;
   static const double ARROW_ICON_WIDTH = 16.0;
-  var rightArrowIcon = new Image.asset('images/ic_arrow_right.png', width: ARROW_ICON_WIDTH, height: ARROW_ICON_WIDTH,);
+  var rightArrowIcon = Image.asset('images/ic_arrow_right.png', width: ARROW_ICON_WIDTH, height: ARROW_ICON_WIDTH,);
   List menuTitles = ['发布动弹', '动弹小黑屋', '关于', '设置'];
   List menuIcons = ['./images/leftmenu/ic_fabu.png', './images/leftmenu/ic_xiaoheiwu.png', './images/leftmenu/ic_about.png', './images/leftmenu/ic_settings.png'];
-  TextStyle menuStyle = new TextStyle(
+  TextStyle menuStyle = TextStyle(
     fontSize: 15.0,
   );
 
   @override
   Widget build(BuildContext context) {
-    return new ConstrainedBox(
+    return ConstrainedBox(
       constraints: const BoxConstraints.expand(width: 304.0),
-      child: new Material(
+      child: Material(
         elevation: 16.0,
-        child: new Container(
-          decoration: new BoxDecoration(
+        child: Container(
+          decoration: BoxDecoration(
             color: const Color(0xFFFFFFFF),
           ),
-          child: new ListView.builder(
+          child: ListView.builder(
             itemCount: menuTitles.length * 2 + 1,
             itemBuilder: renderRow,
           ),
@@ -36,17 +36,17 @@ class MyDrawer extends StatelessWidget {
   }
 
   Widget getIconImage(path) {
-    return new Padding(
+    return Padding(
       padding: const EdgeInsets.fromLTRB(2.0, 0.0, 6.0, 0.0),
-      child: new Image.asset(path, width: 28.0, height: 28.0),
+      child: Image.asset(path, width: 28.0, height: 28.0),
     );
   }
 
   Widget renderRow(BuildContext context, int index) {
     if (index == 0) {
       // render cover image
-      var img = new Image.asset('./images/cover_img.jpg', width: 304.0, height: 304.0,);
-      return new Container(
+      var img = Image.asset('./images/cover_img.jpg', width: 304.0, height: 304.0,);
+      return Container(
         width: 304.0,
         height: 304.0,
         margin: const EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 10.0),
@@ -55,56 +55,56 @@ class MyDrawer extends StatelessWidget {
     }
     index -= 1;
     if (index.isOdd) {
-      return new Divider();
+      return Divider();
     }
     index = index ~/2;
 
-    var listItemContent =  new Padding(
+    var listItemContent =  Padding(
       padding: const EdgeInsets.fromLTRB(10.0, 15.0, 10.0, 15.0),
-      child: new Row(
+      child: Row(
         children: [
           getIconImage(menuIcons[index]),
-          new Expanded(
-              child: new Text(menuTitles[index], style: menuStyle,)
+          Expanded(
+              child: Text(menuTitles[index], style: menuStyle,)
           ),
           rightArrowIcon
         ],
       ),
     );
 
-    return new InkWell(
+    return InkWell(
       child: listItemContent,
       onTap: () {
         switch (index) {
           case 0:
             // 发布动弹
-            Navigator.of(context).push(new MaterialPageRoute(
+            Navigator.of(context).push(MaterialPageRoute(
                 builder: (ctx) {
-                  return new PublishTweetPage();
+                  return PublishTweetPage();
                 }
             ));
             break;
           case 1:
             // 小黑屋
-            Navigator.of(context).push(new MaterialPageRoute(
+            Navigator.of(context).push(MaterialPageRoute(
                 builder: (ctx) {
-                  return new BlackHousePage();
+                  return BlackHousePage();
                 }
             ));
             break;
           case 2:
             // 关于
-            Navigator.of(context).push(new MaterialPageRoute(
+            Navigator.of(context).push(MaterialPageRoute(
                 builder: (ctx) {
-                  return new AboutPage();
+                  return AboutPage();
                 }
             ));
             break;
           case 3:
             // 设置
-            Navigator.of(context).push(new MaterialPageRoute(
+            Navigator.of(context).push(MaterialPageRoute(
                 builder: (ctx) {
-                  return new SettingsPage();
+                  return SettingsPage();
                 }
             ));
             break;

+ 13 - 13
lib/widgets/SlideView.dart

@@ -10,7 +10,7 @@ class SlideView extends StatefulWidget {
 
   @override
   State<StatefulWidget> createState() {
-    return new SlideViewState(data);
+    return SlideViewState(data);
   }
 }
 
@@ -25,7 +25,7 @@ class SlideViewState extends State<SlideView> with SingleTickerProviderStateMixi
   @override
   void initState() {
     super.initState();
-    tabController = new TabController(length: slideData == null ? 0 : slideData.length, vsync: this);
+    tabController = TabController(length: slideData == null ? 0 : slideData.length, vsync: this);
   }
 
   @override
@@ -35,9 +35,9 @@ class SlideViewState extends State<SlideView> with SingleTickerProviderStateMixi
   }
 
   Widget generateCard() {
-    return new Card(
+    return Card(
       color: Colors.blue,
-      child: new Image.asset("images/ic_avatar_default.png", width: 20.0, height: 20.0,),
+      child: Image.asset("images/ic_avatar_default.png", width: 20.0, height: 20.0,),
     );
   }
 
@@ -50,22 +50,22 @@ class SlideViewState extends State<SlideView> with SingleTickerProviderStateMixi
         var imgUrl = item['imgUrl'];
         var title = item['title'];
         var detailUrl = item['detailUrl'];
-        items.add(new GestureDetector(
+        items.add(GestureDetector(
           onTap: () {
             // 点击跳转到详情
-            Navigator.of(context).push(new MaterialPageRoute(
-                builder: (ctx) => new NewsDetailPage(id: detailUrl)
+            Navigator.of(context).push(MaterialPageRoute(
+                builder: (ctx) => NewsDetailPage(id: detailUrl)
             ));
           },
-          child: new Stack(
+          child: Stack(
             children: [
-              new Image.network(imgUrl),
-              new Container(
+              Image.network(imgUrl),
+              Container(
                 width: MediaQuery.of(context).size.width,
                 color: const Color(0x50000000),
-                child: new Padding(
+                child: Padding(
                   padding: const EdgeInsets.all(6.0),
-                  child: new Text(title, style: new TextStyle(color: Colors.white, fontSize: 15.0)),
+                  child: Text(title, style: TextStyle(color: Colors.white, fontSize: 15.0)),
                 )
               )
             ],
@@ -73,7 +73,7 @@ class SlideViewState extends State<SlideView> with SingleTickerProviderStateMixi
         ));
       }
     }
-    return new TabBarView(
+    return TabBarView(
       controller: tabController,
       children: items,
     );

+ 1 - 1
test/widget_test.dart

@@ -12,7 +12,7 @@ import 'package:flutter_osc/main.dart';
 void main() {
   testWidgets('Counter increments smoke test', (WidgetTester tester) async {
     // Build our app and trigger a frame.
-    await tester.pumpWidget(new MyOSCClient());
+    await tester.pumpWidget(MyOSCClient());
 
     // Verify that our counter starts at 0.
     expect(find.text('0'), findsOneWidget);