kidd3166 3 yıl önce
ebeveyn
işleme
aced10aaa6

+ 1 - 1
lib/pages/home/consume_page.dart

@@ -387,7 +387,7 @@ class _PageState extends State<ConsumePage> with InjectApi {
                                                       style: Theme.of(context).textTheme.headline1,
                                                     ),
                                                     SizedBox(
-                                                      height: 12.0,
+                                                      height: 16.0,
                                                     ),
                                                     Container(
                                                       padding: const EdgeInsets.fromLTRB(14.0, 21.0, 14.0, 21.0),

+ 4 - 11
lib/pages/home/duration_setting_page.dart

@@ -10,6 +10,7 @@ import 'package:sport/widgets/appbar.dart';
 import 'package:sport/widgets/button_primary.dart';
 import 'package:sport/widgets/dialog/alert_dialog.dart';
 import 'package:sport/widgets/dialog/request_dialog.dart';
+import 'package:sport/widgets/misc.dart';
 
 class DurationSettingPage extends StatefulWidget {
   @override
@@ -39,15 +40,7 @@ class _PageState extends State<DurationSettingPage> with SingleTickerProviderSta
   Widget build(BuildContext context) {
     return Scaffold(
       backgroundColor: Colors.white,
-      appBar: AppBar(
-        titleSpacing: 0,
-        centerTitle: false,
-        title: Text(
-          "设定目标",
-          style: titleStyle,
-        ),
-        leading: buildBackButton(context),
-      ),
+      appBar: buildAppBar(context, title: "设定目标"),
       body: Padding(
         padding: const EdgeInsets.all(12.0),
         child: Column(
@@ -198,7 +191,7 @@ class _FormState extends State<_Form> {
                 width: .5,
               ),
             ),
-            child: Center(child: Text("自定义", style: Theme.of(context).textTheme.subtitle1.copyWith(color: Theme.of(context).accentColor))),
+            child: Center(child: Text("自定义", style: Theme.of(context).textTheme.subtitle1.copyWith(color: Theme.of(context).accentColor), strutStyle: fixedLine,)),
           ),
         ),
         const SizedBox(
@@ -245,7 +238,7 @@ class _FormState extends State<_Form> {
           ),
         ),
         PrimaryButton(
-          height: 35.0,
+          height: 44.0,
           content: "确定",
           callback: () async {
             await request(context, () async {

+ 132 - 126
lib/pages/home/sport_list_page.dart

@@ -1,11 +1,11 @@
 import 'dart:ui';
 
 import 'package:cached_network_image/cached_network_image.dart';
-import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter_rating_bar/flutter_rating_bar.dart';
 import 'package:sport/bean/game.dart';
 import 'package:sport/pages/game/game_detail.dart';
+import 'package:sport/router/navigator_util.dart';
 import 'package:sport/services/api/inject_api.dart';
 import 'package:sport/services/api/resp.dart';
 import 'package:sport/widgets/decoration.dart';
@@ -37,140 +37,146 @@ class _PageState extends State<SportListPage> with InjectApi {
       filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
       child: Scaffold(
         backgroundColor: Colors.transparent.withOpacity(0.5),
-        body: Center(
-          child: Padding(
-            padding: const EdgeInsets.fromLTRB(0, 80.0, 0, 20.0),
-            child: Column(
-              children: <Widget>[
-                Padding(
-                  padding: const EdgeInsets.all(12.0),
-                  child: Stack(
-                    alignment: Alignment.center,
-                    children: <Widget>[
-                      Image.asset(
-                        "lib/assets/img/mine_image_achievement.png",
-                        fit: BoxFit.fitWidth,
-                        width: 240,
-                      ),
-                      Text(
-                        "运动列表",
-                        style: Theme.of(context).textTheme.headline4,
-                        strutStyle: fixedLine,
-                      )
-                    ],
+        body: GestureDetector(
+          onTap: () => Navigator.maybePop(context),
+          behavior: HitTestBehavior.opaque,
+          child: Center(
+            child: Padding(
+              padding: const EdgeInsets.fromLTRB(0, 80.0, 0, 20.0),
+              child: Column(
+                children: <Widget>[
+                  Padding(
+                    padding: const EdgeInsets.all(12.0),
+                    child: Stack(
+                      alignment: Alignment.center,
+                      children: <Widget>[
+                        Image.asset(
+                          "lib/assets/img/mine_image_achievement.png",
+                          fit: BoxFit.fitWidth,
+                          width: 240,
+                        ),
+                        Text(
+                          "运动列表",
+                          style: Theme.of(context).textTheme.headline4,
+                          strutStyle: fixedLine,
+                        )
+                      ],
+                    ),
                   ),
-                ),
-                Expanded(
-                  child: SingleChildScrollView(
-                    child: Padding(
-                      padding: const EdgeInsets.all(12.0),
-                      child: Column(
-                        children: <Widget>[
-                          Container(
-                            margin: _padding,
-                            child: GameRun(),
-                            decoration: circular(),
-                          ),
-                          FutureBuilder(
-                            future: _future,
-                            builder: (BuildContext context, AsyncSnapshot<RespList<GameInfoData>> snapshot) {
-                              if (snapshot.connectionState != ConnectionState.done) return RequestLoadingWidget();
-                              var list = snapshot.data?.results;
-                              return Column(
-                                  children: list
-                                      .map((e) => Padding(
+                  Expanded(
+                    child: SingleChildScrollView(
+                      child: Padding(
+                        padding: const EdgeInsets.all(12.0),
+                        child: Column(
+                          children: <Widget>[
+                            Container(
+                              margin: _padding,
+                              child: GameRun(),
+                              decoration: circular(),
+                            ),
+                            FutureBuilder(
+                              future: _future,
+                              builder: (BuildContext context, AsyncSnapshot<RespList<GameInfoData>> snapshot) {
+                                if (snapshot.connectionState != ConnectionState.done) return RequestLoadingWidget();
+                                var list = snapshot.data?.results;
+                                return Column(
+                                    children: list
+                                        .map((e) => Padding(
                                             padding: _padding,
-                                            child: ClipRRect(
-                                                borderRadius: BorderRadius.circular(10.0),
-                                                child: Container(
-                                                  color: Colors.white,
-                                                  child: Row(
-                                                    children: <Widget>[
-                                                      CachedNetworkImage(
-                                                        width: 90.0,
-                                                        height: 90.0,
-                                                        fit: BoxFit.cover,
-                                                        imageUrl: "${e.cover}",
-                                                      ),
-                                                      const SizedBox(
-                                                        width: 12.0,
-                                                      ),
-                                                      Expanded(
-                                                        child: Column(
-                                                          crossAxisAlignment: CrossAxisAlignment.start,
-                                                          children: <Widget>[
-                                                            Text(
-                                                              e.name,
-                                                              style: Theme.of(context).textTheme.headline3,
-                                                            ),
-                                                            const SizedBox(
-                                                              height: 3,
-                                                            ),
-                                                            Text(
-                                                              "${e.userCount}人在练",
-                                                              style: Theme.of(context).textTheme.bodyText1,
-                                                            ),
-                                                            const SizedBox(
-                                                              height: 5,
-                                                            ),
-                                                            Row(
-                                                              children: <Widget>[
-                                                                Text(
-                                                                  "难度: ",
-                                                                  style: Theme.of(context).textTheme.bodyText1,
-                                                                ),
-                                                                RatingBarIndicator(
-                                                                  rating: e.difficulty / 20.0,
-                                                                  itemBuilder: (context, index) => Image.asset(
-                                                                    "lib/assets/img/con_icon_difficulty_normal.png",
-                                                                    color: const Color(0xffFFC400),
-                                                                  ),
-                                                                  itemCount: 5,
-                                                                  itemSize: 14.0,
-                                                                  unratedColor: const Color(0xffCECECE),
-                                                                  direction: Axis.horizontal,
-                                                                )
-                                                              ],
-                                                            )
-                                                          ],
+                                            child: GestureDetector(
+                                              onTap: () => NavigatorUtil.goPage(context, (context) => GameDetailsPage(e)),
+                                              child: ClipRRect(
+                                                  borderRadius: BorderRadius.circular(10.0),
+                                                  child: Container(
+                                                    color: Colors.white,
+                                                    child: Row(
+                                                      children: <Widget>[
+                                                        CachedNetworkImage(
+                                                          width: 90.0,
+                                                          height: 90.0,
+                                                          fit: BoxFit.cover,
+                                                          imageUrl: "${e.cover}",
+                                                        ),
+                                                        const SizedBox(
+                                                          width: 12.0,
                                                         ),
-                                                      ),
-                                                      Container(
-                                                        width: 120.0,
-                                                        child: PositionedBottom(
-                                                          e,
-                                                          (v) {
-                                                            startGame(context, e);
-                                                          },
-                                                          height: 35.0,
-                                                          width: 93.0,
-                                                          textStyle: TextStyle(
-                                                            color: Colors.white,
-                                                            fontSize: 14.0,
+                                                        Expanded(
+                                                          child: Column(
+                                                            crossAxisAlignment: CrossAxisAlignment.start,
+                                                            children: <Widget>[
+                                                              Text(
+                                                                e.name,
+                                                                style: Theme.of(context).textTheme.headline3,
+                                                              ),
+                                                              const SizedBox(
+                                                                height: 3,
+                                                              ),
+                                                              Text(
+                                                                "${e.userCount}人在练",
+                                                                style: Theme.of(context).textTheme.bodyText1,
+                                                              ),
+                                                              const SizedBox(
+                                                                height: 5,
+                                                              ),
+                                                              Row(
+                                                                children: <Widget>[
+                                                                  Text(
+                                                                    "难度: ",
+                                                                    style: Theme.of(context).textTheme.bodyText1,
+                                                                  ),
+                                                                  RatingBarIndicator(
+                                                                    rating: e.difficulty / 20.0,
+                                                                    itemBuilder: (context, index) => Image.asset(
+                                                                      "lib/assets/img/con_icon_difficulty_normal.png",
+                                                                      color: const Color(0xffFFC400),
+                                                                    ),
+                                                                    itemCount: 5,
+                                                                    itemSize: 14.0,
+                                                                    unratedColor: const Color(0xffCECECE),
+                                                                    direction: Axis.horizontal,
+                                                                  )
+                                                                ],
+                                                              )
+                                                            ],
                                                           ),
                                                         ),
-                                                      )
-                                                    ],
-                                                  ),
-                                                )),
-                                          ))
-                                      .toList());
-                            },
-                          )
-                        ],
+                                                        Container(
+                                                          width: 120.0,
+                                                          child: PositionedBottom(
+                                                            e,
+                                                            (v) {
+                                                              startGame(context, e);
+                                                            },
+                                                            height: 35.0,
+                                                            width: 93.0,
+                                                            textStyle: TextStyle(
+                                                              color: Colors.white,
+                                                              fontSize: 14.0,
+                                                            ),
+                                                          ),
+                                                        )
+                                                      ],
+                                                    ),
+                                                  )),
+                                            )))
+                                        .toList());
+                              },
+                            )
+                          ],
+                        ),
                       ),
                     ),
                   ),
-                ),
-                GestureDetector(
-                  behavior: HitTestBehavior.opaque,
-                  onTap: () => Navigator.maybePop(context),
-                  child: Padding(
-                    padding: const EdgeInsets.all(8.0),
-                    child: Image.asset("lib/assets/img/pop_share_chose.png"),
+                  GestureDetector(
+                    behavior: HitTestBehavior.opaque,
+                    onTap: () => Navigator.maybePop(context),
+                    child: Padding(
+                      padding: const EdgeInsets.all(8.0),
+                      child: Image.asset("lib/assets/img/pop_share_chose.png"),
+                    ),
                   ),
-                ),
-              ],
+                ],
+              ),
             ),
           ),
         ),

+ 27 - 27
lib/pages/home/step_page.dart

@@ -59,14 +59,9 @@ class _PageState extends State<StepPage> with TickerProviderStateMixin, InjectAp
   Widget build(BuildContext context) {
     return Scaffold(
         backgroundColor: Colors.white,
-        appBar: AppBar(
-          titleSpacing: -12.0,
-          centerTitle: false,
-          title: Text(
-            "运动步数",
-            style: titleStyle,
-          ),
-          leading: buildBackButton(context),
+        appBar: buildAppBar(
+          context,
+          title: "运动步数",
           actions: <Widget>[
             IconButton(
               icon: Image.asset(
@@ -193,7 +188,7 @@ class _PageState extends State<StepPage> with TickerProviderStateMixin, InjectAp
                               return snapshot.connectionState != ConnectionState.done
                                   ? RequestLoadingWidget()
                                   : Padding(
-                                      padding:const EdgeInsets.fromLTRB(12.0, 12.0, 12.0, 0),
+                                      padding: const EdgeInsets.fromLTRB(12.0, 12.0, 12.0, 0),
                                       child: SingleChildScrollView(
                                         child: Column(
                                           children: <Widget>[
@@ -203,7 +198,7 @@ class _PageState extends State<StepPage> with TickerProviderStateMixin, InjectAp
                                             ),
                                             Text(
                                               toType() == 0 ? "日总步数" : "日均步数",
-                                              style: Theme.of(context).textTheme.subtitle2.copyWith(color:Color(0xff999999)),
+                                              style: Theme.of(context).textTheme.subtitle2.copyWith(color: Color(0xff999999)),
                                             ),
                                             SizedBox(
                                               height: 30.0,
@@ -213,7 +208,10 @@ class _PageState extends State<StepPage> with TickerProviderStateMixin, InjectAp
                                               child: CustomPaint(
                                                 painter: Chart(
                                                     type: TABS.indexOf(_tab.value),
-                                                    records: snapshot.data?.data?.records?.map((e) => ChartItem(type == 3 ? "${e.month}": e.createdAt, e.step))?.toList() ?? [],
+                                                    records: snapshot.data?.data?.records
+                                                            ?.map((e) => ChartItem(type == 3 ? "${e.month}" : e.createdAt, e.step))
+                                                            ?.toList() ??
+                                                        [],
                                                     dateTime: time,
                                                     drawMax: true,
                                                     unit: "歩")
@@ -241,7 +239,8 @@ class _PageState extends State<StepPage> with TickerProviderStateMixin, InjectAp
                                                   RichText(
                                                     text: TextSpan(style: Theme.of(context).textTheme.subtitle2, children: <InlineSpan>[
                                                       TextSpan(
-                                                          text: '${_value == null ? ".." : "${((_value.sum.stepDaily + _value.sum.stepGame) * .6).toStringAsFixed(1)}"}',
+                                                          text:
+                                                              '${_value == null ? ".." : "${((_value.sum.stepDaily + _value.sum.stepGame) * .6).toStringAsFixed(1)}"}',
                                                           style: Theme.of(context).textTheme.subtitle2.copyWith(fontWeight: FontWeight.bold, fontSize: 25)),
                                                       TextSpan(text: ' 米', style: Theme.of(context).textTheme.subtitle1),
                                                     ]),
@@ -249,21 +248,22 @@ class _PageState extends State<StepPage> with TickerProviderStateMixin, InjectAp
                                                   Divider(
                                                     height: 24,
                                                   ),
-                                                  if(type != 0)
-                                                  Row(
-                                                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
-                                                    children: <Widget>[
-                                                      Text(
-                                                        type == 1? "周总步数" : type ==2?"月总步数":"年总步数",
-                                                        style: Theme.of(context).textTheme.subtitle1,
-                                                      ),
-                                                      Text("${_value == null ? ".." : "${_value.sum.stepDaily + _value.sum.stepGame}"}", style: Theme.of(context).textTheme.subtitle1)
-                                                    ],
-                                                  ),
-                                                  if(type != 0)
-                                                  Space(
-                                                    height: 8,
-                                                  ),
+                                                  if (type != 0)
+                                                    Row(
+                                                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                                                      children: <Widget>[
+                                                        Text(
+                                                          type == 1 ? "周总步数" : type == 2 ? "月总步数" : "年总步数",
+                                                          style: Theme.of(context).textTheme.subtitle1,
+                                                        ),
+                                                        Text("${_value == null ? ".." : "${_value.sum.stepDaily + _value.sum.stepGame}"}",
+                                                            style: Theme.of(context).textTheme.subtitle1)
+                                                      ],
+                                                    ),
+                                                  if (type != 0)
+                                                    Space(
+                                                      height: 8,
+                                                    ),
                                                   Row(
                                                     mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                                     children: <Widget>[

+ 1 - 9
lib/pages/home/step_realtime_page.dart

@@ -115,15 +115,7 @@ class _PageState extends State<StepRealTimePage> {
   Widget build(BuildContext context) {
     return Scaffold(
         backgroundColor: Colors.white,
-        appBar: AppBar(
-          titleSpacing: 0,
-          centerTitle: false,
-          title: Text(
-            "实时计步",
-            style: titleStyle,
-          ),
-          leading: buildBackButton(context),
-        ),
+        appBar: buildAppBar(context, title: "实时计步"),
         body: Column(
           children: <Widget>[
             Flexible(

+ 1 - 7
lib/pages/my/feedback_page.dart

@@ -117,13 +117,7 @@ class _PageState extends State<FeedbackPage> with InjectLoginApi, InjectApi {
   @override
   Widget build(BuildContext context) {
     return Scaffold(
-        appBar: AppBar(
-          title: Text(
-            "用户反馈",
-            style: titleStyle,
-          ),
-          leading: buildBackButton(context),
-        ),
+        appBar: buildAppBar(context, title: "用户反馈"),
         body: Column(
           children: <Widget>[
             Expanded(

+ 1 - 8
lib/pages/social/block_user_list_page.dart

@@ -42,14 +42,7 @@ class _PageDetailState extends ViewStateLifecycle<BlockUserListPage, SimpleModel
   Widget build(BuildContext context) {
     return Scaffold(
       backgroundColor: Colors.white,
-      appBar: AppBar(
-        elevation: 0,
-        leading: buildBackButton(context),
-        title: Text(
-          "屏蔽列表",
-          style: titleStyle,
-        ),
-      ),
+      appBar: buildAppBar(context, title: "屏蔽列表"),
       body: ProviderWidget<SimpleModel>(
           model: model,
           onModelReady: (model) => model.initData(),

+ 5 - 16
lib/pages/social/new_social_index_page.dart

@@ -399,11 +399,11 @@ class _PageState extends ViewStateLifecycle<NewSocialIndexPage, SocialDetailMode
                           header,
                           SliverPersistentHeader(
                             delegate: PersistentHeader(
-                                min: 34,
-                                max: 34,
+                                min: 44,
+                                max: 44,
                                 child: Container(
                                   color: Colors.white,
-                                  padding: EdgeInsets.only(bottom: 5),
+                                  padding: EdgeInsets.only(bottom: 10),
                                   child: TabBar(
                                     isScrollable: true,
                                     indicatorPadding: EdgeInsets.symmetric(horizontal: 8),
@@ -416,7 +416,7 @@ class _PageState extends ViewStateLifecycle<NewSocialIndexPage, SocialDetailMode
                           ),
                           SliverToBoxAdapter(
                             child: Padding(
-                              padding: EdgeInsets.symmetric(vertical: 12.0, horizontal: 12.0),
+                              padding: EdgeInsets.symmetric(vertical: 6.0, horizontal: 12.0),
                               child: Row(
                                 children: <Widget>[
                                   _buildSearchWidget(),
@@ -491,18 +491,7 @@ class _PageState extends ViewStateLifecycle<NewSocialIndexPage, SocialDetailMode
         },
       ),
       floatingActionButton: InkWell(
-        child: Container(
-          width: 88.0,
-          height: 88.0,
-          alignment: Alignment.centerRight,
-          decoration: BoxDecoration(
-            image: DecorationImage(
-                image: AssetImage(
-              "lib/assets/img/bbs_icon_edit.png",
-            )),
-//            color: Colors.white,
-          ),
-        ),
+        child: Image.asset("lib/assets/img/bbs_icon_edit.png"),
         onTap: () async {
 //            print('FloatingActionButton');
           var result = await NavigatorUtil.goPage(

+ 1 - 11
lib/pages/social/post_detail_page.dart

@@ -593,17 +593,7 @@ class _PageState extends ViewStateLifecycle<PostDetailPage, PostDetailModel> wit
   Widget build(BuildContext context) {
     return Scaffold(
       backgroundColor: Colors.white,
-      appBar: AppBar(
-        titleSpacing: -5,
-        title: Container(
-          alignment: Alignment.centerLeft,
-          child: Text(
-            "帖子详情",
-            style: titleStyle,
-          ),
-        ),
-        leading: buildBackButton(context),
-        actions: <Widget>[
+      appBar: buildAppBar(context, title: "帖子详情" , actions: <Widget>[
       PopupMenuTheme(
       data: PopupMenuThemeData(shape: PopmenuShape(borderRadius: BorderRadius.all(Radius.circular(10.0)))),
     child: PopupMenuButton(

+ 1 - 11
lib/pages/social/share_achievement.dart

@@ -22,16 +22,7 @@ class ShareAchievementPage extends StatelessWidget {
 //    print("${DateTime.now().millisecondsSinceEpoch}");
     // TODO: implement build
     return Scaffold(
-        appBar: AppBar(
-          titleSpacing: -5,
-          title: Container(
-            child: Text(
-              "成就分享",
-              style: titleStyle,
-            ),
-            alignment: Alignment.centerLeft,
-          ),
-          leading: buildBackButton(context),
+        appBar: buildAppBar(context, title: "成就分享"),
 //          actions: <Widget>[
 //            IconButton(
 //              icon: Image.asset("lib/assets/img/bbs_icon_share.png"),
@@ -41,7 +32,6 @@ class ShareAchievementPage extends StatelessWidget {
 //              },
 //            )
 //          ],
-        ),
         body: Stack(children: [
           Container(
               color: Color(0xff999999),

+ 1 - 12
lib/pages/social/user_friend_add_page.dart

@@ -139,18 +139,7 @@ class _PageState extends ViewStateLifecycle<UserFriendAddPage, SimpleModel> with
   Widget build(BuildContext context) {
     return Scaffold(
       backgroundColor: Colors.white,
-      appBar: AppBar(
-        elevation: 0,
-        leading: buildBackButton(context),
-        titleSpacing: -5,
-        title: Container(
-          alignment: Alignment.centerLeft,
-          child: Text(
-            "添加好友",
-            style: titleStyle,
-          ),
-        ),
-        actions: <Widget>[
+      appBar: buildAppBar(context, title: "添加好友", actions: <Widget>[
           IconButton(
             icon: Image.asset("lib/assets/img/fiends_image_scanning.png"),
             onPressed: () async {

+ 14 - 2
lib/widgets/appbar.dart

@@ -71,11 +71,10 @@ Widget buildFlexibleSpace(
       title: paddingLeading
           ? Padding(
               padding: EdgeInsets.only(
-                  left: (settings.maxExtent - box.biggest.height) / 3 * 1.6,bottom: 1.0),
+                  left: (settings.maxExtent - box.biggest.height) / 3 * 1.6,bottom: .5),
               child: Text(
                 title,
                 style: textStyle,
-//                strutStyle:fixedLine,
               ),
             )
           : Text(
@@ -107,3 +106,16 @@ Widget buildBackButton(BuildContext context) {
     },
   );
 }
+
+Widget buildAppBar(BuildContext context, {String title, List<Widget> actions}) {
+  return AppBar(
+    titleSpacing: -16.0,
+    centerTitle: false,
+    title: title == null ? null : Text(
+      "$title",
+      style: titleStyle,
+    ),
+    leading: buildBackButton(context),
+    actions: actions,
+  );
+}