kidd3166 3 年之前
父节点
当前提交
0f622e145e

二进制
lib/assets/img/2.0x/date_state_day.png


二进制
lib/assets/img/2.0x/date_state_select.png


二进制
lib/assets/img/date_state_day.png


二进制
lib/assets/img/date_state_select.png


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

@@ -171,7 +171,7 @@ class _PageState extends State<ConsumePage> with InjectApi {
                             children: <Widget>[
                               SafeArea(
                                 child: Padding(
-                                  padding: const EdgeInsets.symmetric(horizontal: 8.0),
+                                  padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 5.0),
                                   child: Row(
                                     mainAxisAlignment: MainAxisAlignment.center,
                                     children: ["日", "/", "周", "/", "月", "/", "年"]

+ 75 - 21
lib/pages/home/duration_page.dart

@@ -2,6 +2,7 @@ import 'dart:math';
 import 'dart:ui';
 
 import 'package:dartin/dartin.dart';
+import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
 import 'package:percent_indicator/circular_percent_indicator.dart';
@@ -43,6 +44,16 @@ class _PageState extends State<DurationPage> {
 
   @override
   Widget build(BuildContext context) {
+    var _dot = Container(
+      width: 5,
+      height: 5,
+      decoration: BoxDecoration(shape: BoxShape.circle, color: Color(0xff5498FF)),
+    );
+    var _dotFailed = Container(
+      width: 5,
+      height: 5,
+      decoration: BoxDecoration(shape: BoxShape.circle, color: Color(0xffFF5B1D)),
+    );
     return Scaffold(
       body: FutureBuilder(
         future: inject<RestClient>().getSportTargetIndex().asStream().map((event) => event.data).last,
@@ -59,9 +70,7 @@ class _PageState extends State<DurationPage> {
                       highlightColor: Colors.red,
                       onPressed: () async {
                         await NavigatorUtil.goPage(context, (context) => DurationSettingPage());
-                        setState(() {
-
-                        });
+                        setState(() {});
                       },
                     )
                   ]),
@@ -79,7 +88,6 @@ class _PageState extends State<DurationPage> {
                               percent: min(1.0, 1.0 * (snapshot.data?.today?.durationMinute ?? 0) / snapshot.data?.today?.durationTargetMinute ?? 0),
                               center: Column(
                                 children: <Widget>[
-
                                   Text(
                                     "${snapshot.data?.today?.durationMinute ?? 0}",
                                     style: Theme.of(context).textTheme.headline2.copyWith(fontSize: 40.0),
@@ -207,7 +215,7 @@ class _PageState extends State<DurationPage> {
                           Container(
                             padding: const EdgeInsets.all(12.0),
                             decoration: circular(),
-                            height: 380.0,
+                            height: 406.0,
                             child: Column(
                               children: <Widget>[
                                 Center(
@@ -283,18 +291,29 @@ class _PageState extends State<DurationPage> {
                                                       itemBuilder: (_, index) {
                                                         var item = _value[index];
                                                         return Center(
-                                                            child: item.today ==true? Stack(
-                                                              children: <Widget>[
-                                                                Text("${item.title}",
-                                                                    style:  Theme.of(context).textTheme.subtitle1),
-                                                                Image.asset("lib/assets/img/date_state_day.png")
-                                                              ],
-                                                              alignment: Alignment.center,
-                                                            ) : item.state == 2 ? Image.asset("lib/assets/img/date_state_select.png")
-                                                                : Text("${item.title}",
-                                                                    style: item.enable
-                                                                        ? Theme.of(context).textTheme.bodyText2
-                                                                        : Theme.of(context).textTheme.subtitle1)
+                                                            child: item.today == true
+                                                                ? Container(
+                                                                    padding: const EdgeInsets.all(6.0),
+                                                                    decoration: BoxDecoration(shape: BoxShape.circle, color: Theme.of(context).accentColor),
+                                                                    child: Text("${item.title}",
+                                                                        style: Theme.of(context).textTheme.subtitle1.copyWith(color: Colors.white)),
+                                                                  )
+                                                                : Stack(
+                                                                    children: <Widget>[
+                                                                      Text("${item.title}",
+                                                                          style: item.enable
+                                                                              ? Theme.of(context).textTheme.bodyText2
+                                                                              : Theme.of(context).textTheme.subtitle1),
+                                                                      if (item.state > 0)
+                                                                        Align(
+                                                                            alignment: Alignment.bottomCenter,
+                                                                            child: Padding(
+                                                                              child: item.state == 2 ? _dot : _dotFailed,
+                                                                              padding: const EdgeInsets.only(bottom: 4.0),
+                                                                            ))
+                                                                    ],
+                                                                    alignment: Alignment.center,
+                                                                  )
                                                             // Stack(
                                                             //             children: <Widget>[
                                                             //               Text("${item.title}",
@@ -306,7 +325,7 @@ class _PageState extends State<DurationPage> {
                                                             //             alignment: Alignment.center,
                                                             //           )
                                                             //         : Image.asset("lib/assets/img/date_state_select.png")
-                                                        );
+                                                            );
                                                       },
                                                       itemCount: 49,
                                                     ),
@@ -314,6 +333,38 @@ class _PageState extends State<DurationPage> {
                                           });
                                     },
                                   ),
+                                ),
+                                Divider(),
+                                SizedBox(
+                                  height: 5,
+                                ),
+                                Row(
+                                  children: <Widget>[
+                                    SizedBox(
+                                      width: 16,
+                                    ),
+                                    _dot,
+                                    SizedBox(
+                                      width: 6,
+                                    ),
+                                    Text(
+                                      "运动达标",
+                                      style: Theme.of(context).textTheme.bodyText1,
+                                      strutStyle: fixedLine,
+                                    ),
+                                    SizedBox(
+                                      width: 45,
+                                    ),
+                                    _dotFailed,
+                                    SizedBox(
+                                      width: 6,
+                                    ),
+                                    Text(
+                                      "运动不达标",
+                                      style: Theme.of(context).textTheme.bodyText1,
+                                      strutStyle: fixedLine,
+                                    ),
+                                  ],
                                 )
                               ],
                             ),
@@ -404,7 +455,7 @@ class _PageState extends State<DurationPage> {
     DateTime now = DateTime(time.year, time.month, time.day);
     DateTime next = DateTime(time.year, time.month + 1, time.day);
     int inDays = next.difference(time).inDays;
-    print("11111111111111111 ${now} ${now.weekday} ${now} ${inDays}");
+    // print("11111111111111111 ${now} ${now.weekday} ${now} ${inDays}");
     if (now.weekday != 7) {
       for (var i = 0; i < now.weekday; i++) {
         items.add(_DataItem("", 0));
@@ -412,11 +463,14 @@ class _PageState extends State<DurationPage> {
     }
     for (var i = 0; i < inDays; i++) {
       bool lastDay = false;
-      if (now.month == today.month && i+1 > todayday) {
+      if (now.month == today.month && i + 1 > todayday) {
         lastDay = true;
       }
       items.add(
-        _DataItem("${i + 1}", 0, enable: lastDay, today: now.month == today.month && todayday == i + 1, tag: "${now.year}-${now.month.toString().padLeft(2, '0')}-${(i + 1).toString().padLeft(2, '0')}"),
+        _DataItem("${i + 1}", 0,
+            enable: lastDay,
+            today: now.month == today.month && todayday == i + 1,
+            tag: "${now.year}-${now.month.toString().padLeft(2, '0')}-${(i + 1).toString().padLeft(2, '0')}"),
       );
     }
     int end = now.weekday - 1 + inDays;

+ 12 - 6
lib/pages/home/step_realtime_page.dart

@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
 import 'package:flutter/painting.dart';
 import 'package:provider/provider.dart';
 import 'package:sport/provider/bluetooth.dart';
+import 'package:sport/utils/toast.dart';
 import 'package:sport/widgets/appbar.dart';
 import 'package:sport/widgets/dialog/alert_dialog.dart';
 import 'package:sport/widgets/misc.dart';
@@ -62,6 +63,11 @@ class _PageState extends State<StepRealTimePage> {
   }
 
   void _startStep() {
+    print("1111111111 ${ Provider.of<Bluetooth>(context, listen: false).stepRealtimeSwitchNotifier}");
+    if( Provider.of<Bluetooth>(context, listen: false).stepRealtimeSwitchNotifier.value == false) {
+      ToastUtil.show("固件不支持");
+      return;
+    }
     if (_timer != null) {
       _timer.cancel();
       _valueNotifier.value = _startText;
@@ -174,12 +180,8 @@ class _PageState extends State<StepRealTimePage> {
                     child: Padding(
                       padding: const EdgeInsets.only(bottom: 80.0),
                       child: ValueListenableBuilder(
-                        valueListenable: Provider.of<Bluetooth>(context, listen: false).stepRealtimeSwitchNotifier,
-                        builder: (BuildContext context, bool value, Widget child) => !value
-                            ? Container()
-                            : ValueListenableBuilder(
                                 valueListenable: _valueNotifier,
-                                builder: (_, value, __) => value == _startText
+                                builder: (_, value, __) => _timer == null
                                     ? InkWell(
                                         onTap: () => _startStep(),
                                         borderRadius: BorderRadius.all(Radius.circular(50.0)),
@@ -226,6 +228,10 @@ class _PageState extends State<StepRealTimePage> {
                                                   _paused = true;
                                                   _startStepValue = 0;
                                                   Provider.of<Bluetooth>(context, listen: false).stepRealtimeNotifier.value = 0;
+                                                }else{
+                                                  setState(() {
+
+                                                  });
                                                 }
                                               },
                                             ),
@@ -256,7 +262,7 @@ class _PageState extends State<StepRealTimePage> {
                                         ),
                                       ),
                               ),
-                      ),
+
                     ),
                   ),
                 ),

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

@@ -19,7 +19,7 @@ class StrengthPage extends StatefulWidget {
 }
 
 class _PageState extends State<StrengthPage> with InjectApi {
-  ValueNotifier<int> _valueNotifierIndex = ValueNotifier(3);
+  ValueNotifier<int> _valueNotifierIndex = ValueNotifier(26);
   SwiperController _swiperController;
   ScrollController _scrollController;
 

+ 1 - 0
lib/pages/home_page.dart

@@ -52,6 +52,7 @@ class _HomePageState extends LifecycleState<HomePage> with ConfigInject {
     switch (state) {
       case AppLifecycleState.resumed:
         Provider.of<Bluetooth>(context, listen: false).listen();
+        SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
         break;
       case AppLifecycleState.paused:
         Provider.of<Bluetooth>(context, listen: false).disposeBluetooth();

+ 62 - 123
lib/pages/social/new_social_index_page.dart

@@ -31,6 +31,8 @@ import 'package:sport/widgets/misc.dart';
 import 'package:sport/widgets/persistent_header.dart';
 import 'package:sport/widgets/space.dart';
 
+final List<String> _tabs = ['热门', '关注', '最新', '精华', '官方'];
+
 class NewSocialIndexPage extends StatefulWidget {
   NewSocialIndexPage();
 
@@ -38,20 +40,19 @@ class NewSocialIndexPage extends StatefulWidget {
   State<StatefulWidget> createState() => _PageState();
 }
 
-class _PageState
-    extends ViewStateLifecycle<NewSocialIndexPage, SocialDetailModel>
-    with TickerProviderStateMixin, UserId, InjectApi {
+class _PageState extends ViewStateLifecycle<NewSocialIndexPage, SocialDetailModel> with TickerProviderStateMixin, UserId, InjectApi {
   ScrollController _controller;
   double _expandedHeight = 0;
   int _brightness = 0;
 
   TabController _tabController;
-  final List<String> _tabs = ['热门', '关注', '最新', '精华', '官方'];
   Future<RespPage<Post>> _getPostListByOfficial;
   final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
+
   @override
   SocialDetailModel createModel() => SocialDetailModel(0);
   SocialIndexModel indexModel = new SocialIndexModel();
+
   // 右边draw中的 当前选择的索引...
 
   ValueNotifier<int> drawOneIndex = ValueNotifier(0);
@@ -73,16 +74,18 @@ class _PageState
   ];
   ValueNotifier<bool> isShowSelect = ValueNotifier(false);
 
+  void _refresh(){
+    model?.setForumIdAndOrigin(_tabController.index, forumId, isOfficial);
+    _controller.animateTo(0, duration: Duration(milliseconds: 100), curve: Curves.ease);
+  }
+
   @override
   void initState() {
     super.initState();
-    _tabController = TabController(
-        length: _tabs.length, initialIndex: 0, vsync: this)
+    _tabController = TabController(length: _tabs.length, initialIndex: 0, vsync: this)
       ..addListener(() {
         if (_tabController.index.toDouble() == _tabController.animation.value) {
-          model?.setForumIdAndOrigin(_tabController.index, forumId, isOfficial);
-          _controller.animateTo(0,
-              duration: Duration(milliseconds: 100), curve: Curves.ease);
+          _refresh();
         }
       });
     _controller = ScrollController()
@@ -102,6 +105,7 @@ class _PageState
         }
       });
     initButtonList();
+
   }
 
   @override
@@ -132,8 +136,7 @@ class _PageState
   Widget _buildSearchWidget() {
     return GestureDetector(
       onTap: () {
-        Navigator.push(
-            context, new MaterialPageRoute(builder: (context) => SearchPage()));
+        Navigator.push(context, new MaterialPageRoute(builder: (context) => SearchPage()));
       },
       child: Container(
 //        margin: EdgeInsets.fromLTRB(12.0, 0, 12.0, 12.0),
@@ -166,27 +169,17 @@ class _PageState
   //  @index       当前显示的下标
   //  @targetIndex 目标下标
   //  @type        origin / project
-  Widget _buildDrawerButtonItem(
-      Forum data, int index, ValueNotifier<int> targetIndex, String type) {
+  Widget _buildDrawerButtonItem(Forum data, int index, ValueNotifier<int> targetIndex, String type) {
     return InkWell(
       child: Container(
         decoration: BoxDecoration(
-            color: index == targetIndex.value
-                ? Theme.of(context).accentColor
-                : Colors.white,
+            color: index == targetIndex.value ? Theme.of(context).accentColor : Colors.white,
             borderRadius: BorderRadius.all(Radius.circular(20.0)),
-            border: Border.all(
-                color: index == targetIndex.value
-                    ? Colors.white
-                    : Color(0xff999999))),
+            border: Border.all(color: index == targetIndex.value ? Colors.white : Color(0xff999999))),
         padding: EdgeInsets.symmetric(vertical: 8.0, horizontal: 25.0),
         child: Text(
           data.gameName,
-          style: TextStyle(
-              fontSize: 14.0,
-              color: index == targetIndex.value
-                  ? Colors.white
-                  : Color(0xff999999)),
+          style: TextStyle(fontSize: 14.0, color: index == targetIndex.value ? Colors.white : Color(0xff999999)),
         ),
       ),
       onTap: () {
@@ -223,11 +216,7 @@ class _PageState
                   height: 43.0,
                 )
               : Container(),
-          Text("运动项目",
-              style: TextStyle(
-                  color: Color(0xff333333),
-                  fontSize: 16.0,
-                  fontWeight: FontWeight.bold)),
+          Text("运动项目", style: TextStyle(color: Color(0xff333333), fontSize: 16.0, fontWeight: FontWeight.bold)),
           Space(
             height: 16.0,
           ),
@@ -250,18 +239,8 @@ class _PageState
         spacing: 8.0,
         runSpacing: 16.0,
         children: list != null
-            ? list
-                .asMap()
-                .entries
-                .map((e) => _buildDrawerButtonItem(
-                    e.value, e.key, targetIndex, "project"))
-                .toList()
-            : buttonData
-                .asMap()
-                .entries
-                .map((e) => _buildDrawerButtonItem(
-                    e.value, e.key, targetIndex, "origin"))
-                .toList(),
+            ? list.asMap().entries.map((e) => _buildDrawerButtonItem(e.value, e.key, targetIndex, "project")).toList()
+            : buttonData.asMap().entries.map((e) => _buildDrawerButtonItem(e.value, e.key, targetIndex, "origin")).toList(),
       ),
     );
   }
@@ -293,21 +272,17 @@ class _PageState
         ));
   }
 
-  Widget _buildFilterButton(
-      String name, ValueNotifier<int> index, String type) {
+  Widget _buildFilterButton(String name, ValueNotifier<int> index, String type) {
     return InkWell(
       child: Container(
         padding: EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
-        decoration: BoxDecoration(
-            border: Border.all(color: Theme.of(context).accentColor),
-            borderRadius: BorderRadius.all(Radius.circular(44.0))),
+        decoration: BoxDecoration(border: Border.all(color: Theme.of(context).accentColor), borderRadius: BorderRadius.all(Radius.circular(44.0))),
         child: Row(
           crossAxisAlignment: CrossAxisAlignment.center,
           children: <Widget>[
             Text(
               "$name",
-              style: TextStyle(
-                  color: Theme.of(context).accentColor, fontSize: 12.0),
+              style: TextStyle(color: Theme.of(context).accentColor, fontSize: 12.0),
             ),
             Space(
               width: 5.0,
@@ -321,9 +296,7 @@ class _PageState
         ),
       ),
       onTap: () {
-        type == "one"
-            ? model.setForumIdAndOrigin(_tabController.index, "", isOfficial)
-            : model.setForumIdAndOrigin(_tabController.index, forumId, "");
+        type == "one" ? model.setForumIdAndOrigin(_tabController.index, "", isOfficial) : model.setForumIdAndOrigin(_tabController.index, forumId, "");
         index.value = 0;
       },
     );
@@ -373,60 +346,32 @@ class _PageState
                               pinned: false,
                               actions: <Widget>[
                                 Selector<SocialIndexModel, ViewState>(
-                                    selector: (_, SocialIndexModel model) =>
-                                        model.viewState,
-                                    shouldRebuild: (_, v) =>
-                                        v == ViewState.idle,
-                                    builder: (BuildContext context,
-                                        ViewState value, Widget child) {
+                                    selector: (_, SocialIndexModel model) => model.viewState,
+                                    shouldRebuild: (_, v) => v == ViewState.idle,
+                                    builder: (BuildContext context, ViewState value, Widget child) {
                                       return IconButton(
                                         icon: Stack(
                                           alignment: Alignment.center,
                                           children: <Widget>[
-                                            Image.asset(
-                                                "lib/assets/img/bbs_icon_news.png"),
+                                            Image.asset("lib/assets/img/bbs_icon_news.png"),
                                             FutureBuilder(
-                                                future: SharedPreferences
-                                                    .getInstance(),
-                                                builder: (BuildContext context,
-                                                    AsyncSnapshot<
-                                                            SharedPreferences>
-                                                        snapshot) {
-                                                  if (snapshot
-                                                          .connectionState ==
-                                                      ConnectionState.done) {
-                                                    if (snapshot.data.getBool(
-                                                            "message_setting") ??
-                                                        true == true) {
+                                                future: SharedPreferences.getInstance(),
+                                                builder: (BuildContext context, AsyncSnapshot<SharedPreferences> snapshot) {
+                                                  if (snapshot.connectionState == ConnectionState.done) {
+                                                    if (snapshot.data.getBool("message_setting") ?? true == true) {
                                                       return FutureBuilder(
                                                           future: _getCount(),
-                                                          builder: (BuildContext
-                                                                  context,
-                                                              AsyncSnapshot<int>
-                                                                  snapshot) {
-                                                            if (snapshot.data !=
-                                                                    null &&
-                                                                snapshot.data >
-                                                                    0) {
+                                                          builder: (BuildContext context, AsyncSnapshot<int> snapshot) {
+                                                            if (snapshot.data != null && snapshot.data > 0) {
                                                               return Align(
-                                                                alignment:
-                                                                    Alignment
-                                                                        .topRight,
-                                                                child:
-                                                                    Container(
-                                                                  margin: const EdgeInsets
-                                                                          .only(
-                                                                      top: 6.0),
+                                                                alignment: Alignment.topRight,
+                                                                child: Container(
+                                                                  margin: const EdgeInsets.only(top: 6.0),
                                                                   width: 10,
                                                                   height: 10,
-                                                                  decoration: BoxDecoration(
-                                                                      shape: BoxShape
-                                                                          .circle,
-                                                                      color: Colors
-                                                                          .red),
+                                                                  decoration: BoxDecoration(shape: BoxShape.circle, color: Colors.red),
                                                                   child: Center(
-                                                                    child: Text(
-                                                                        ""),
+                                                                    child: Text(""),
                                                                   ),
                                                                 ),
                                                               );
@@ -440,8 +385,7 @@ class _PageState
                                           ],
                                         ),
                                         onPressed: () async {
-                                          await NavigatorUtil.go(
-                                              context, Routes.socialMessage);
+                                          await NavigatorUtil.go(context, Routes.socialMessage);
                                           setState(() {});
                                         },
                                       );
@@ -458,20 +402,17 @@ class _PageState
                                   padding: EdgeInsets.only(bottom: 5),
                                   child: TabBar(
                                     isScrollable: true,
-                                    indicatorPadding:
-                                        EdgeInsets.symmetric(horizontal: 8),
+                                    indicatorPadding: EdgeInsets.symmetric(horizontal: 8),
                                     indicatorWeight: 3,
                                     controller: _tabController,
-                                    tabs:
-                                        _tabs.map((e) => Tab(text: e)).toList(),
+                                    tabs: _tabs.map((e) => Tab(text: e)).toList(),
                                   ),
                                 )),
                             pinned: true,
                           ),
                           SliverToBoxAdapter(
                             child: Padding(
-                              padding: EdgeInsets.symmetric(
-                                  vertical: 12.0, horizontal: 12.0),
+                              padding: EdgeInsets.symmetric(vertical: 12.0, horizontal: 12.0),
                               child: Row(
                                 children: <Widget>[
                                   _buildSearchWidget(),
@@ -492,8 +433,7 @@ class _PageState
                                               width: 22,
                                               height: 22,
                                             ),
-                                      onTap: () => _scaffoldKey.currentState
-                                          .openEndDrawer(),
+                                      onTap: () => _scaffoldKey.currentState.openEndDrawer(),
                                     ),
                                   ),
                                 ],
@@ -505,19 +445,11 @@ class _PageState
                               padding: EdgeInsets.only(left: 12.0),
                               child: Row(
                                 children: <Widget>[
-                                  if (drawOneIndex.value != 0)
-                                    _buildFilterButton(
-                                        '${buttonList[drawOneIndex.value].gameName}',
-                                        drawOneIndex,
-                                        "one"),
+                                  if (drawOneIndex.value != 0) _buildFilterButton('${buttonList[drawOneIndex.value].gameName}', drawOneIndex, "one"),
                                   Space(
                                     width: 10.0,
                                   ),
-                                  if (drawTwoIndex.value != 0)
-                                    _buildFilterButton(
-                                        '${buttonData[drawTwoIndex.value].gameName}',
-                                        drawTwoIndex,
-                                        "two"),
+                                  if (drawTwoIndex.value != 0) _buildFilterButton('${buttonData[drawTwoIndex.value].gameName}', drawTwoIndex, "two"),
                                 ],
                               ),
                             ),
@@ -532,8 +464,7 @@ class _PageState
                                 child: RequestErrorWidget(
                                   null,
                                   msg: "暂无帖子~",
-                                  assets:
-                                      RequestErrorWidget.ASSETS_NO_INVITATION,
+                                  assets: RequestErrorWidget.ASSETS_NO_INVITATION,
                                 ),
                               ),
                             ),
@@ -542,8 +473,7 @@ class _PageState
                               delegate: SliverChildBuilderDelegate(
                                 (context, index) {
                                   Post post = model.list[index];
-                                  return PostWidget(
-                                      post, model, selfId == post.userId);
+                                  return PostWidget(post, model, selfId == post.userId);
                                 },
                                 childCount: model.list.length,
                               ),
@@ -563,19 +493,28 @@ class _PageState
           alignment: Alignment.centerRight,
           decoration: BoxDecoration(
             image: DecorationImage(
-              image: AssetImage("lib/assets/img/bbs_icon_edit.png",)
-            ),
+                image: AssetImage(
+              "lib/assets/img/bbs_icon_edit.png",
+            )),
 //            color: Colors.white,
           ),
         ),
-        onTap: () {
+        onTap: () async {
 //            print('FloatingActionButton');
-          NavigatorUtil.goPage(
+          var result = await NavigatorUtil.goPage(
               context,
               (context) => PostPage(
                     "",
                     forums: buttonList,
                   ));
+          if(result == true){
+            if (_tabController.index.toDouble() == _tabController.animation.value) {
+              _refresh();
+            }else{
+              _tabController?.index = 2;
+            }
+
+          }
         },
       ),
     );

+ 7 - 4
lib/pages/social/post_page.dart

@@ -94,6 +94,9 @@ class _PageState extends State<PostPage> {
                 // }else {
                 //   Navigator.of(context).pop(true);
                 // }
+
+                _focusNode?.unfocus();
+
                 String postValue = _valueNotifier.value.trim();
                 if (postValue == "") {
                   ToastUtil.show("不能发布空白内容喔!");
@@ -118,11 +121,11 @@ class _PageState extends State<PostPage> {
                         ));
                 if (result == true) {
                   ToastUtil.show("发布成功");
-                  if(widget.forum != null) {
-                    NavigatorUtil.pushAndRemoveUntil(context, (context) => SocialDetailPage(widget.forum, index: 2), RouteSettings(name: "forum"));
-                  }else {
+                  // if(widget.forum != null) {
+                  //   NavigatorUtil.pushAndRemoveUntil(context, (context) => SocialDetailPage(widget.forum, index: 2), RouteSettings(name: "forum"));
+                  // }else {
                     Navigator.of(context).pop(true);
-                  }
+                  // }
                 } else {
                   // ToastUtil.show("已取消发布");
                 }

+ 1 - 1
lib/provider/bluetooth.dart

@@ -149,7 +149,7 @@ class Bluetooth with ChangeNotifier, InjectApi {
     periodicSubscription?.cancel();
     listenSubscription?.cancel();
     listenSubscription = null;
-
+    stepRealtimeSwitchNotifier?.value = false;
     disposeDevice();
     FlutterBlue.instance?.stopScan();
     _founded = false;

+ 32 - 32
lib/widgets/dialog/search_device.dart

@@ -193,25 +193,6 @@ class _FindDevicesScreen extends State<FindDevicesScreen> with SingleTickerProvi
           child: SingleChildScrollView(
             child: Column(
               children: <Widget>[
-                if (_search)
-                  Padding(
-                    padding: const EdgeInsets.symmetric(vertical: 30),
-                    child: Column(
-                      children: <Widget>[
-                        Stack(
-                          alignment: Alignment.center,
-                          children: <Widget>[
-                            RotationTransition(turns: _animation, child: Image.asset("lib/assets/img/pop_image_circle.png")),
-                            Image.asset("lib/assets/img/pop_image_shoes.png")
-                          ],
-                        ),
-                        SizedBox(
-                          height: 12,
-                        ),
-                        Text("搜索中...")
-                      ],
-                    ),
-                  ),
                 // if (!_search)
                 //   StreamBuilder<List<BluetoothDevice>>(
                 //     stream: Stream.fromFuture(FlutterBlue.instance.connectedDevices),
@@ -279,19 +260,38 @@ class _FindDevicesScreen extends State<FindDevicesScreen> with SingleTickerProvi
                     return Column(
                       children: list.isEmpty == true
                           ? [
-                              Padding(
-                                  padding: const EdgeInsets.all(30.0),
-                                  child: Center(
-                                    child: Column(
-                                      children: <Widget>[
-                                        Image.asset("lib/assets/img/pop_image_noequipment.png"),
-                                        SizedBox(
-                                          height: 10,
+                              _search
+                                  ? Padding(
+                                      padding: const EdgeInsets.symmetric(vertical: 30),
+                                      child: Column(
+                                        children: <Widget>[
+                                          Stack(
+                                            alignment: Alignment.center,
+                                            children: <Widget>[
+                                              RotationTransition(turns: _animation, child: Image.asset("lib/assets/img/pop_image_circle.png")),
+                                              Image.asset("lib/assets/img/pop_image_shoes.png")
+                                            ],
+                                          ),
+                                          SizedBox(
+                                            height: 12,
+                                          ),
+                                          Text("搜索中...")
+                                        ],
+                                      ),
+                                    )
+                                  : Padding(
+                                      padding: const EdgeInsets.all(30.0),
+                                      child: Center(
+                                        child: Column(
+                                          children: <Widget>[
+                                            Image.asset("lib/assets/img/pop_image_noequipment.png"),
+                                            SizedBox(
+                                              height: 10,
+                                            ),
+                                            Text("暂无设备")
+                                          ],
                                         ),
-                                        Text("暂无设备")
-                                      ],
-                                    ),
-                                  ))
+                                      ))
                             ]
                           : list
                               .map(
@@ -325,7 +325,7 @@ class _FindDevicesScreen extends State<FindDevicesScreen> with SingleTickerProvi
               if (snapshot.data) {
                 return CancelButton(
                   height: 35,
-                  content: "取消",
+                  content: "搜索中...",
                   callback: () {
                     FlutterBlue.instance.stopScan();
                     setState(() {