kidd3166 il y a 3 ans
Parent
commit
d803c25446

BIN
fonts/DIN-BOLD.OTF


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

@@ -92,7 +92,7 @@ class _PageState extends State<ConsumePage> with InjectApi {
                                 children: <Widget>[
                                   Text("消耗卡路里", style: Theme.of(context).textTheme.subtitle1),
                                   SizedBox(
-                                    height: 22.0,
+                                    height: 26.0,
                                   ),
                                   Row(
                                     children: <Widget>[
@@ -113,7 +113,7 @@ class _PageState extends State<ConsumePage> with InjectApi {
                                     crossAxisAlignment: CrossAxisAlignment.end,
                                   ),
                                   SizedBox(
-                                    height: 10,
+                                    height: 8,
                                   ),
                                   GestureDetector(
                                     onTap: () async {
@@ -247,7 +247,7 @@ class _PageState extends State<ConsumePage> with InjectApi {
                                             ),
                                             Text(
                                               text,
-                                              style: Theme.of(context).textTheme.bodyText2,
+                                              style: Theme.of(context).textTheme.bodyText2.copyWith(color: Color(0xff333333)),
                                               strutStyle: fixedLine,
                                             ),
                                             GestureDetector(
@@ -329,7 +329,7 @@ class _PageState extends State<ConsumePage> with InjectApi {
                                               width: 12.0,
                                             ),
                                             Padding(
-                                              padding: const EdgeInsets.all(8.0),
+                                              padding: const EdgeInsets.fromLTRB(8, 8, 8, 4),
                                               child: StaggeredGridView.extent(
                                                   maxCrossAxisExtent: (MediaQuery.of(context).size.width - 32.0) / 2,
                                                   padding: EdgeInsets.zero,
@@ -358,7 +358,7 @@ class _PageState extends State<ConsumePage> with InjectApi {
                                                                       children: <Widget>[
                                                                         Text(
                                                                           e.title,
-                                                                          style: Theme.of(context).textTheme.headline1.copyWith(fontSize: 20.0),
+                                                                          style: e.unit != "" ? Theme.of(context).textTheme.headline1.copyWith(fontSize: 20.0):Theme.of(context).textTheme.headline1.copyWith(fontSize: 16.0),
                                                                           strutStyle: fixedLine,
                                                                         ),
                                                                         Text(" ${e.unit}", style: Theme.of(context).textTheme.subtitle2),
@@ -384,7 +384,7 @@ class _PageState extends State<ConsumePage> with InjectApi {
                                                   children: <Widget>[
                                                     Text(
                                                       "日均数据",
-                                                      style: Theme.of(context).textTheme.headline1,
+                                                      style: Theme.of(context).textTheme.headline1.copyWith(fontSize: 16.0),
                                                     ),
                                                     SizedBox(
                                                       height: 16.0,

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

@@ -95,7 +95,7 @@ class _PageState extends State<DurationPage> {
                                 children: <Widget>[
                                   Text(
                                     "${snapshot.data?.today?.value ?? 0}",
-                                    style: Theme.of(context).textTheme.headline2.copyWith(fontSize: 40.0),
+                                    style: Theme.of(context).textTheme.headline2.copyWith(fontSize: 40.0, fontFamily: "DIN"),
                                   ),
                                   Text(
                                     "${snapshot.data?.today?.label}",

+ 4 - 4
lib/pages/home/home_info_page.dart

@@ -238,7 +238,7 @@ class _PageState extends ViewStateLifecycle<HomeInfoPage, SportIndexModel> with
                                     children: <Widget>[
                                       Text(
                                         "${model.data?.today?.step ?? 0}",
-                                        style: Theme.of(context).textTheme.headline2.copyWith(fontSize: 26.0),
+                                        style: Theme.of(context).textTheme.headline2.copyWith(fontSize: 26.0, fontFamily: "DIN"),
                                         strutStyle: fixedLine,
                                       ),
                                       Text(
@@ -288,7 +288,7 @@ class _PageState extends ViewStateLifecycle<HomeInfoPage, SportIndexModel> with
                                     children: <Widget>[
                                       Text(
                                         "${model.data?.today?.consume ?? 0}",
-                                        style: Theme.of(context).textTheme.headline2.copyWith(fontSize: 26.0),
+                                        style: Theme.of(context).textTheme.headline2.copyWith(fontSize: 26.0, fontFamily: "DIN"),
                                         strutStyle: fixedLine,
                                       ),
                                       Text(
@@ -360,7 +360,7 @@ class _PageState extends ViewStateLifecycle<HomeInfoPage, SportIndexModel> with
                                     ),
                                     Text(
                                       "${model.data?.today?.value(model.data?.target?.type) ?? 0}",
-                                      style: Theme.of(context).textTheme.headline2.copyWith(fontSize: 26.0),
+                                      style: Theme.of(context).textTheme.headline2.copyWith(fontSize: 26.0, fontFamily: "DIN"),
                                       strutStyle: fixedLine,
                                     ),
                                     Text(
@@ -455,7 +455,7 @@ class _PageState extends ViewStateLifecycle<HomeInfoPage, SportIndexModel> with
                                   ),
                                   Text(
                                     "${model.data?.today?.strength?.toStringAsFixed(1) ?? 0}",
-                                    style: Theme.of(context).textTheme.headline2.copyWith(fontSize: 26.0),
+                                    style: Theme.of(context).textTheme.headline2.copyWith(fontSize: 26.0, fontFamily: "DIN"),
                                     strutStyle: fixedLine,
                                   ),
                                   Text(

+ 6 - 4
lib/pages/home/strength_page.dart

@@ -68,12 +68,14 @@ class _PageState extends State<StrengthPage> with InjectApi {
                               center: Column(
                                 children: <Widget>[
                                   SizedBox(
-                                    height: 10.0,
+                                    height: 16.0,
                                   ),
                                   Text(
                                     "${strengthToValue(snapshot?.data?.data?.sum?.consume ?? 0).toStringAsFixed(1)}",
-                                    style: Theme.of(context).textTheme.headline2.copyWith(fontSize: 26.0),
+                                    style: Theme.of(context).textTheme.headline2.copyWith(fontSize: 40.0, fontFamily: "DIN"),
                                     strutStyle: fixedLine,
+                                  ),SizedBox(
+                                    height: 5.0,
                                   ),
                                   Text(
                                     "卡/分",
@@ -164,7 +166,7 @@ class _PageState extends State<StrengthPage> with InjectApi {
                             children: <Widget>[
                               Text(
                                 "${snapshot?.data?.data?.sum?.consume ?? 0}",
-                                style: Theme.of(context).textTheme.headline2.copyWith(fontSize: 26.0),
+                                style: Theme.of(context).textTheme.headline2.copyWith(fontSize: 26.0, fontFamily: "DIN"),
                               ),
                               Space(height: 4.0,),
                               Text(
@@ -179,7 +181,7 @@ class _PageState extends State<StrengthPage> with InjectApi {
                             children: <Widget>[
                               Text(
                                 "${snapshot?.data?.data?.sum?.durationMinute ?? 0}",
-                                style: Theme.of(context).textTheme.headline2.copyWith(fontSize: 26.0),
+                                style: Theme.of(context).textTheme.headline2.copyWith(fontSize: 26.0, fontFamily: "DIN"),
                               ),
                               Space(height: 4.0,),
                               Text(

+ 4 - 2
lib/pages/social/new_social_index_page.dart

@@ -346,6 +346,8 @@ class _PageState extends ViewStateLifecycle<NewSocialIndexPage, SocialDetailMode
                           buildSliverAppBar(context, "社区",
                               canBack: false,
                               pinned: false,
+                              height: 100.0,
+                              padding: const EdgeInsets.fromLTRB(12.0, 0, 0, 6.0),
                               actions: <Widget>[
                                 Selector<SocialIndexModel, ViewState>(
                                     selector: (_, SocialIndexModel model) => model.viewState,
@@ -397,8 +399,8 @@ class _PageState extends ViewStateLifecycle<NewSocialIndexPage, SocialDetailMode
                           header,
                           SliverPersistentHeader(
                             delegate: PersistentHeader(
-                                min: 44,
-                                max: 44,
+                                min: 50,
+                                max: 50,
                                 child: Container(
                                   color: Colors.white,
                                   padding: EdgeInsets.only(bottom: 10),

+ 3 - 12
lib/pages/social/user_friend_page.dart

@@ -236,18 +236,9 @@ class _PageDetailState
                                     children: <Widget>[
                                       ListTile(
                                         leading: InkWell(
-                                          child: Container(
-                                            width: 44,
-                                            height: 44,
-                                            decoration: BoxDecoration(
-                                              shape: BoxShape.rectangle,
-                                              borderRadius:
-                                              BorderRadius.circular(4.0),
-                                              image: DecorationImage(
-                                                  image: CachedNetworkImageProvider(
-                                                    model.items[index].user.avatar,
-                                                  )),
-                                            ),
+                                          child: CircleAvatar(
+                                            backgroundImage: userAvatarProvider(model.items[index].user.avatar),
+                                            radius: 22,
                                           ),
                                           onTap: () {
                                             NavigatorUtil.goPage(

+ 18 - 31
lib/widgets/appbar.dart

@@ -2,10 +2,7 @@ import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
 import 'package:sport/widgets/image.dart';
 
-import 'misc.dart';
-
-const titleStyle = TextStyle(
-    fontWeight: FontWeight.w600, fontSize: 18.0, color: Color(0xff333333));
+const titleStyle = TextStyle(fontWeight: FontWeight.w600, fontSize: 18.0, color: Color(0xff333333));
 
 Widget buildSliverAppBar(BuildContext context, String title,
     {List<Widget> actions,
@@ -18,12 +15,11 @@ Widget buildSliverAppBar(BuildContext context, String title,
     brightness = -1,
     textStyle = titleStyle,
     whiteBackButton = false,
-    pinned = true}) {
+    pinned = true,
+    EdgeInsets padding = const EdgeInsets.fromLTRB(12.0, 0, 0, 15.0)}) {
   return SliverAppBar(
       pinned: pinned,
-      brightness: brightness == -1
-          ? null
-          : brightness == 1 ? Brightness.dark : Brightness.light,
+      brightness: brightness == -1 ? null : brightness == 1 ? Brightness.dark : Brightness.light,
       expandedHeight: height,
       backgroundColor: backgroundColor,
       forceElevated: innerBoxIsScrolled,
@@ -45,33 +41,25 @@ Widget buildSliverAppBar(BuildContext context, String title,
                 )
               : whiteBackButton
                   ? IconButton(
-                      icon:
-                          Image.asset("lib/assets/img/topbar_return_white.png"),
+                      icon: Image.asset("lib/assets/img/topbar_return_white.png"),
                       onPressed: () {
                         Navigator.of(context).pop();
                       },
                     )
                   : Container(),
       actions: actions,
-      flexibleSpace: buildFlexibleSpace(title,
-          paddingLeading: paddingLeading, textStyle: textStyle));
+      flexibleSpace: _buildFlexibleSpace(title, paddingLeading: paddingLeading, textStyle: textStyle, padding: padding));
 }
 
-Widget buildFlexibleSpace(
-  String title, {
-  paddingLeading = true,
-  textStyle = titleStyle,
-}) {
+Widget _buildFlexibleSpace(String title, {paddingLeading = true, textStyle = titleStyle, EdgeInsets padding}) {
   return LayoutBuilder(builder: (context, box) {
-    final FlexibleSpaceBarSettings settings =
-        context.dependOnInheritedWidgetOfExactType<FlexibleSpaceBarSettings>();
+    final FlexibleSpaceBarSettings settings = context.dependOnInheritedWidgetOfExactType<FlexibleSpaceBarSettings>();
     return FlexibleSpaceBar(
       centerTitle: false,
-      titlePadding: EdgeInsets.fromLTRB(12.0, 0, 0, 15.0),
+      titlePadding: padding,
       title: paddingLeading
           ? Padding(
-              padding: EdgeInsets.only(
-                  left: (settings.maxExtent - box.biggest.height) / 3 * 1.6,bottom: .5),
+              padding: EdgeInsets.only(left: (settings.maxExtent - box.biggest.height) / 3 * 1.6, bottom: .5),
               child: Text(
                 title,
                 style: textStyle,
@@ -85,14 +73,11 @@ Widget buildFlexibleSpace(
   });
 }
 
-Widget buildActionButton(String title, VoidCallback onPressed,
-    {Color textColor}) {
+Widget buildActionButton(String title, VoidCallback onPressed, {Color textColor}) {
   return IconButton(
     icon: Text(
       title,
-      style: textColor != null
-          ? TextStyle(fontSize: 16.0, color: textColor)
-          : TextStyle(fontSize: 16),
+      style: textColor != null ? TextStyle(fontSize: 16.0, color: textColor) : TextStyle(fontSize: 16),
     ),
     onPressed: onPressed,
   );
@@ -111,10 +96,12 @@ Widget buildAppBar(BuildContext context, {String title, List<Widget> actions}) {
   return AppBar(
     titleSpacing: -16.0,
     centerTitle: false,
-    title: title == null ? null : Text(
-      "$title",
-      style: titleStyle,
-    ),
+    title: title == null
+        ? null
+        : Text(
+            "$title",
+            style: titleStyle,
+          ),
     leading: buildBackButton(context),
     actions: actions,
   );

+ 8 - 6
lib/widgets/loading.dart

@@ -1,15 +1,17 @@
-import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
+import 'package:flutter_easyrefresh/easy_refresh.dart';
 import 'package:flutter_spinkit/flutter_spinkit.dart';
+import 'package:sport/widgets/misc.dart';
+import 'package:sport/widgets/refresh_header.dart' as loading;
 
 class RequestLoadingWidget extends StatelessWidget {
   @override
   Widget build(BuildContext context) {
-    return Padding(
-      padding: const EdgeInsets.symmetric(vertical: 50.0),
-      child: SpinKitWave(
-        color: Theme.of(context).accentColor,
-      ),
+    return Container(
+      height: 100.0,
+      // padding: const EdgeInsets.symmetric(vertical: 50.0),
+      child: loading.ClassicalHeaderWidget(refreshState: RefreshMode.refresh, pulledExtent: 120.0, refreshTriggerPullDistance: 100.0, refreshIndicatorExtent: 80.0, classicalHeader: buildClassicalHeader(),
+      axisDirection: AxisDirection.down,noMore: false, enableInfiniteRefresh: true,),
     );
   }
 }

+ 3 - 3
lib/widgets/menu_bar.dart

@@ -432,9 +432,9 @@ class _MenuBarState extends State<MenuBar>
                       maxLines: 3,
 //                              maxLength: 200,
                       onChanged: (value) {
-                        setState(() {
-//                                  _textFieldValue = value;
-                        });
+//                         setState(() {
+// //                                  _textFieldValue = value;
+//                         });
                       },
                       onTap: () {
                         setState(() {

+ 2 - 1
lib/widgets/misc.dart

@@ -217,7 +217,8 @@ header.ClassicalHeader buildClassicalHeader(
     double triggerDistance = 90.0,
     Color infoColor = REFRESH_INFO_COLOR,
     Color textColor = REFRESH_INFO_COLOR,
-    Color bgColor = Colors.transparent}) {
+    Color bgColor = Colors.transparent,
+    }) {
   return header.ClassicalHeader(
     extent: extent,
     triggerDistance: triggerDistance,

+ 4 - 4
lib/widgets/persistent_header.dart

@@ -1,9 +1,9 @@
 import 'package:flutter/material.dart';
 
 class PersistentHeader extends SliverPersistentHeaderDelegate {
-  double max;
-  double min;
-  Widget child;
+  final double max;
+  final double min;
+  final Widget child;
 
   PersistentHeader({this.max = 50.0, this.min = 50.0, @required this.child});
 
@@ -19,5 +19,5 @@ class PersistentHeader extends SliverPersistentHeaderDelegate {
   double get minExtent => min;
 
   @override
-  bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) => true;
+  bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) => oldDelegate != this;
 }

+ 4 - 0
pubspec.yaml

@@ -134,3 +134,7 @@ flutter:
   assets:
     - lib/assets/img/       # Base 1.0
     - lib/assets/json/
+  fonts:
+     - family: DIN
+       fonts:
+         - asset: fonts/DIN-BOLD.OTF