|
@@ -10,6 +10,7 @@ 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/utils/date.dart';
|
|
|
+import 'package:sport/utils/toast.dart';
|
|
|
import 'package:sport/widgets/appbar.dart';
|
|
|
import 'package:sport/widgets/chart.dart';
|
|
|
import 'package:sport/widgets/decoration.dart';
|
|
@@ -54,128 +55,128 @@ class _PageState extends State<ConsumePage> with InjectApi {
|
|
|
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
- final double tabHeader = 100.0;
|
|
|
+ final double tabHeader = 80.0;
|
|
|
final double statusBarHeight = MediaQuery.of(context).padding.top;
|
|
|
- final double pinnedHeaderHeight = tabHeader + statusBarHeight;
|
|
|
+ final double pinnedHeaderHeight = tabHeader;
|
|
|
final double headerHeight = 240.0;
|
|
|
return Scaffold(
|
|
|
backgroundColor: Colors.white,
|
|
|
- body: Stack(
|
|
|
- children: <Widget>[
|
|
|
- extended.NestedScrollView(
|
|
|
- controller: _scrollController,
|
|
|
- pinnedHeaderSliverHeightBuilder: () {
|
|
|
- return pinnedHeaderHeight;
|
|
|
- },
|
|
|
- innerScrollPositionKeyBuilder: () {
|
|
|
- PageController controller = _pageController;
|
|
|
- String index = 'Tab${controller.page}';
|
|
|
- return Key(index);
|
|
|
- },
|
|
|
- headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
|
|
- return <Widget>[
|
|
|
- SliverToBoxAdapter(
|
|
|
- child: Container(
|
|
|
- width: 240.0,
|
|
|
- height: headerHeight,
|
|
|
- child: Align(
|
|
|
- alignment: Alignment.bottomCenter,
|
|
|
- child: CustomPaint(
|
|
|
- painter: _Bg(),
|
|
|
- child: Container(
|
|
|
- width: 180.0,
|
|
|
- height: 180.0,
|
|
|
- child: Center(
|
|
|
- child: Column(
|
|
|
- children: <Widget>[
|
|
|
- Text("消耗卡路里", style: Theme.of(context).textTheme.subtitle1),
|
|
|
- SizedBox(
|
|
|
- height: 26.0,
|
|
|
- ),
|
|
|
- Row(
|
|
|
- children: <Widget>[
|
|
|
- ValueListenableBuilder(
|
|
|
- builder: (BuildContext context, value, Widget child) => FutureBuilder(
|
|
|
- future: createFutureType(0, _valueNotifierNow.value),
|
|
|
- builder: (BuildContext context, AsyncSnapshot<SportDetail> snapshot) => Text(
|
|
|
- "${snapshot?.data?.recordsTodaySum?.consume ?? 0}",
|
|
|
- style: Theme.of(context).textTheme.headline1.copyWith(fontSize: 40.0),
|
|
|
- strutStyle: fixedLine,
|
|
|
- ),
|
|
|
- ),
|
|
|
- valueListenable: _valueNotifierNow,
|
|
|
- ),
|
|
|
- Text(" 卡", style: Theme.of(context).textTheme.subtitle2),
|
|
|
- ],
|
|
|
- mainAxisSize: MainAxisSize.min,
|
|
|
- crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
- ),
|
|
|
- SizedBox(
|
|
|
- height: 8,
|
|
|
- ),
|
|
|
- GestureDetector(
|
|
|
- onTap: () async {
|
|
|
- var result = await showDatePicker(
|
|
|
- context: context,
|
|
|
- initialDate: _valueNotifierNow.value,
|
|
|
- lastDate: DateTime.now(),
|
|
|
- firstDate: DateTime(2020),
|
|
|
- );
|
|
|
- if (result != null) {
|
|
|
- var diff = DateTime.now().difference(result);
|
|
|
- _valueNotifierDate.value = result;
|
|
|
- _valueNotifierNow.value = result;
|
|
|
- int type = toType();
|
|
|
- // if (type == 0) {
|
|
|
- // _pageController.jumpToPage(diff.inDays);
|
|
|
- // } else {
|
|
|
- // _pageController = PageController(initialPage: diff.inDays);
|
|
|
- // }
|
|
|
-
|
|
|
- _tab.value = TABS.first;
|
|
|
- _pageController.jumpToPage(diff.inDays);
|
|
|
- print("$type -- ${diff.inDays}");
|
|
|
- }
|
|
|
- },
|
|
|
- child: Row(
|
|
|
+ body: SafeArea(
|
|
|
+ child: Stack(
|
|
|
+ children: <Widget>[
|
|
|
+ extended.NestedScrollView(
|
|
|
+ controller: _scrollController,
|
|
|
+ pinnedHeaderSliverHeightBuilder: () {
|
|
|
+ return pinnedHeaderHeight;
|
|
|
+ },
|
|
|
+ innerScrollPositionKeyBuilder: () {
|
|
|
+ PageController controller = _pageController;
|
|
|
+ String index = 'Tab${controller.page}';
|
|
|
+ return Key(index);
|
|
|
+ },
|
|
|
+ headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
|
|
+ return <Widget>[
|
|
|
+ SliverToBoxAdapter(
|
|
|
+ child: Container(
|
|
|
+ width: 240.0,
|
|
|
+ height: headerHeight,
|
|
|
+ child: Align(
|
|
|
+ alignment: Alignment.center,
|
|
|
+ child: CustomPaint(
|
|
|
+ painter: _Bg(),
|
|
|
+ child: Container(
|
|
|
+ width: 180.0,
|
|
|
+ height: 180.0,
|
|
|
+ child: Center(
|
|
|
+ child: Column(
|
|
|
+ children: <Widget>[
|
|
|
+ Text("消耗卡路里", style: Theme.of(context).textTheme.subtitle1),
|
|
|
+ SizedBox(
|
|
|
+ height: 26.0,
|
|
|
+ ),
|
|
|
+ Row(
|
|
|
children: <Widget>[
|
|
|
ValueListenableBuilder(
|
|
|
+ builder: (BuildContext context, value, Widget child) => FutureBuilder(
|
|
|
+ future: createFutureType(0, _valueNotifierNow.value),
|
|
|
+ builder: (BuildContext context, AsyncSnapshot<SportDetail> snapshot) => Text(
|
|
|
+ "${snapshot?.data?.recordsTodaySum?.consume ?? 0}",
|
|
|
+ style: Theme.of(context).textTheme.headline1.copyWith(fontSize: 40.0),
|
|
|
+ strutStyle: fixedLine,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
valueListenable: _valueNotifierNow,
|
|
|
- builder: (BuildContext context, DateTime value, Widget child) =>
|
|
|
- Text("${value.month}.${value.day}", style: Theme.of(context).textTheme.subtitle1),
|
|
|
- ),
|
|
|
- SizedBox(
|
|
|
- width: 12.0,
|
|
|
),
|
|
|
- Image.asset("lib/assets/img/setgoals_icon_date.png"),
|
|
|
+ Text(" 卡", style: Theme.of(context).textTheme.subtitle2),
|
|
|
],
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
),
|
|
|
- behavior: HitTestBehavior.opaque,
|
|
|
- )
|
|
|
- ],
|
|
|
- mainAxisSize: MainAxisSize.min,
|
|
|
+ SizedBox(
|
|
|
+ height: 8,
|
|
|
+ ),
|
|
|
+ GestureDetector(
|
|
|
+ onTap: () async {
|
|
|
+ var result = await showDatePicker(
|
|
|
+ context: context,
|
|
|
+ initialDate: _valueNotifierNow.value,
|
|
|
+ lastDate: DateTime.now(),
|
|
|
+ firstDate: DateTime(2020),
|
|
|
+ );
|
|
|
+ if (result != null) {
|
|
|
+ var diff = DateTime.now().difference(result);
|
|
|
+ _valueNotifierDate.value = result;
|
|
|
+ _valueNotifierNow.value = result;
|
|
|
+ int type = toType();
|
|
|
+ // if (type == 0) {
|
|
|
+ // _pageController.jumpToPage(diff.inDays);
|
|
|
+ // } else {
|
|
|
+ // _pageController = PageController(initialPage: diff.inDays);
|
|
|
+ // }
|
|
|
+
|
|
|
+ _tab.value = TABS.first;
|
|
|
+ _pageController.jumpToPage(diff.inDays);
|
|
|
+ print("$type -- ${diff.inDays}");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ child: Row(
|
|
|
+ children: <Widget>[
|
|
|
+ ValueListenableBuilder(
|
|
|
+ valueListenable: _valueNotifierNow,
|
|
|
+ builder: (BuildContext context, DateTime value, Widget child) =>
|
|
|
+ Text("${value.month}.${value.day}", style: Theme.of(context).textTheme.subtitle1),
|
|
|
+ ),
|
|
|
+ SizedBox(
|
|
|
+ width: 12.0,
|
|
|
+ ),
|
|
|
+ Image.asset("lib/assets/img/setgoals_icon_date.png"),
|
|
|
+ ],
|
|
|
+ mainAxisSize: MainAxisSize.min,
|
|
|
+ ),
|
|
|
+ behavior: HitTestBehavior.opaque,
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ mainAxisSize: MainAxisSize.min,
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
- ),
|
|
|
- SliverPersistentHeader(
|
|
|
- pinned: true,
|
|
|
- delegate: PersistentHeader(
|
|
|
- min: pinnedHeaderHeight,
|
|
|
- max: pinnedHeaderHeight,
|
|
|
- child: Container(
|
|
|
- color: Colors.white,
|
|
|
- child: ValueListenableBuilder(
|
|
|
- valueListenable: _tab,
|
|
|
- builder: (BuildContext context, String value, Widget child) {
|
|
|
- return Column(
|
|
|
- children: <Widget>[
|
|
|
- SafeArea(
|
|
|
- child: Padding(
|
|
|
+ SliverPersistentHeader(
|
|
|
+ pinned: true,
|
|
|
+ delegate: PersistentHeader(
|
|
|
+ min: pinnedHeaderHeight,
|
|
|
+ max: pinnedHeaderHeight,
|
|
|
+ child: Container(
|
|
|
+ color: Colors.white,
|
|
|
+ child: ValueListenableBuilder(
|
|
|
+ valueListenable: _tab,
|
|
|
+ builder: (BuildContext context, String value, Widget child) {
|
|
|
+ return Column(
|
|
|
+ children: <Widget>[
|
|
|
+ Padding(
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 5.0),
|
|
|
child: Row(
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
@@ -212,313 +213,312 @@ class _PageState extends State<ConsumePage> with InjectApi {
|
|
|
.toList(),
|
|
|
),
|
|
|
),
|
|
|
- ),
|
|
|
- Center(
|
|
|
- child: ValueListenableBuilder<DateTime>(
|
|
|
- valueListenable: _valueNotifierDate,
|
|
|
- builder: (_, time, ___) {
|
|
|
- int type = toType();
|
|
|
- String text = "";
|
|
|
- if (type == 0) {
|
|
|
- text = "${time.year}.${'${time.month}'.padLeft(2, '0')}.${'${time.day}'.padLeft(2, '0')} 6:00 - 24:00 ";
|
|
|
- } else if (type == 1) {
|
|
|
- DateTime start = DateTime(time.year, time.month, time.day - time.weekday + 1);
|
|
|
- DateTime end = DateTime(time.year, time.month, time.day + 6 - time.weekday + 1);
|
|
|
- print("$time ${time.weekday} == $start $end");
|
|
|
- text =
|
|
|
- "${start.year}.${'${start.month}'.padLeft(2, '0')}.${'${start.day}'.padLeft(2, '0')} ~ ${end.year}.${'${end.month}'.padLeft(2, '0')}.${'${end.day}'.padLeft(2, '0')}";
|
|
|
- } else if (type == 2) {
|
|
|
- text = ("${time.year}年${'${time.month}'.padLeft(2, '0')}月");
|
|
|
- } else if (type == 3) {
|
|
|
- text = ("${time.year}年");
|
|
|
- }
|
|
|
- return Row(
|
|
|
- mainAxisSize: MainAxisSize.min,
|
|
|
- children: <Widget>[
|
|
|
- GestureDetector(
|
|
|
- behavior: HitTestBehavior.opaque,
|
|
|
- onTap: () {
|
|
|
- _pageController?.nextPage(duration: Duration(milliseconds: 500), curve: Curves.linear);
|
|
|
- },
|
|
|
- child: Padding(
|
|
|
- padding: const EdgeInsets.all(18.0),
|
|
|
- child: arrowLeft(),
|
|
|
+ Center(
|
|
|
+ child: ValueListenableBuilder<DateTime>(
|
|
|
+ valueListenable: _valueNotifierDate,
|
|
|
+ builder: (_, time, ___) {
|
|
|
+ int type = toType();
|
|
|
+ String text = "";
|
|
|
+ if (type == 0) {
|
|
|
+ text = "${time.year}.${'${time.month}'.padLeft(2, '0')}.${'${time.day}'.padLeft(2, '0')} 6:00 - 24:00 ";
|
|
|
+ } else if (type == 1) {
|
|
|
+ DateTime start = DateTime(time.year, time.month, time.day - time.weekday + 1);
|
|
|
+ DateTime end = DateTime(time.year, time.month, time.day + 6 - time.weekday + 1);
|
|
|
+ print("$time ${time.weekday} == $start $end");
|
|
|
+ text =
|
|
|
+ "${start.year}.${'${start.month}'.padLeft(2, '0')}.${'${start.day}'.padLeft(2, '0')} ~ ${end.year}.${'${end.month}'.padLeft(2, '0')}.${'${end.day}'.padLeft(2, '0')}";
|
|
|
+ } else if (type == 2) {
|
|
|
+ text = ("${time.year}年${'${time.month}'.padLeft(2, '0')}月");
|
|
|
+ } else if (type == 3) {
|
|
|
+ text = ("${time.year}年");
|
|
|
+ }
|
|
|
+ return Row(
|
|
|
+ mainAxisSize: MainAxisSize.min,
|
|
|
+ children: <Widget>[
|
|
|
+ GestureDetector(
|
|
|
+ behavior: HitTestBehavior.opaque,
|
|
|
+ onTap: () {
|
|
|
+ _pageController?.nextPage(duration: Duration(milliseconds: 500), curve: Curves.linear);
|
|
|
+ },
|
|
|
+ child: Padding(
|
|
|
+ padding: const EdgeInsets.symmetric(horizontal: 18.0, vertical: 10.0),
|
|
|
+ child: arrowLeft(),
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- Text(
|
|
|
- text,
|
|
|
- style: Theme.of(context).textTheme.bodyText2.copyWith(color: Color(0xff333333)),
|
|
|
- strutStyle: fixedLine,
|
|
|
- ),
|
|
|
- GestureDetector(
|
|
|
- behavior: HitTestBehavior.opaque,
|
|
|
- onTap: () {
|
|
|
- if (_pageController?.page == 0.0) {
|
|
|
- return;
|
|
|
- }
|
|
|
- _pageController?.previousPage(duration: Duration(milliseconds: 500), curve: Curves.linear);
|
|
|
- },
|
|
|
- child: Padding(
|
|
|
- padding: const EdgeInsets.all(18.0),
|
|
|
- child: arrowRight(),
|
|
|
+ Text(
|
|
|
+ text,
|
|
|
+ style: Theme.of(context).textTheme.bodyText2.copyWith(color: Color(0xff333333)),
|
|
|
+ strutStyle: fixedLine,
|
|
|
),
|
|
|
- ),
|
|
|
- ],
|
|
|
- );
|
|
|
- }),
|
|
|
- ),
|
|
|
- ],
|
|
|
- );
|
|
|
- },
|
|
|
+ GestureDetector(
|
|
|
+ behavior: HitTestBehavior.opaque,
|
|
|
+ onTap: () {
|
|
|
+ if (_pageController?.page == 0.0) {
|
|
|
+ ToastUtil.show("没有数据了");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ _pageController?.previousPage(duration: Duration(milliseconds: 500), curve: Curves.linear);
|
|
|
+ },
|
|
|
+ child: Padding(
|
|
|
+ padding: const EdgeInsets.symmetric(horizontal: 18.0, vertical: 10.0),
|
|
|
+ child: arrowRight(),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ },
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
- ),
|
|
|
- ];
|
|
|
- },
|
|
|
- body: ValueListenableBuilder(
|
|
|
- valueListenable: _tab,
|
|
|
- builder: (BuildContext context, String value, Widget child) => PageView.builder(
|
|
|
- reverse: true,
|
|
|
- itemCount: 10240,
|
|
|
- controller: _pageController,
|
|
|
- onPageChanged: (page) {
|
|
|
- rollDate(-page);
|
|
|
- },
|
|
|
- itemBuilder: (context, index) {
|
|
|
- int type = toType();
|
|
|
- DateTime time = offsetDate(type, -index);
|
|
|
- print("$index $type --2222 ${time}");
|
|
|
- return extended.NestedScrollViewInnerScrollPositionKeyWidget(
|
|
|
- Key('Tab$index'),
|
|
|
- FutureBuilder<SportDetail>(
|
|
|
- future: createFuture(time),
|
|
|
- builder: (BuildContext context, AsyncSnapshot<SportDetail> snapshot) {
|
|
|
- var _value = snapshot?.data;
|
|
|
- var _items = _createItems(type, _value?.recordsTodaySum);
|
|
|
- return snapshot.connectionState != ConnectionState.done
|
|
|
- ? RequestLoadingWidget()
|
|
|
- : Padding(
|
|
|
- padding: const EdgeInsets.fromLTRB(12.0, 12.0, 12.0, 0),
|
|
|
- child: SingleChildScrollView(
|
|
|
- child: Column(
|
|
|
- children: <Widget>[
|
|
|
- SizedBox(
|
|
|
- height: 10.0,
|
|
|
- ),
|
|
|
- Padding(
|
|
|
- padding: const EdgeInsets.only(right: 12.0),
|
|
|
- child: CustomPaint(
|
|
|
- painter: Chart(
|
|
|
- type: TABS.indexOf(_tab.value),
|
|
|
- records: _value?.recordsToday
|
|
|
- ?.map((e) => ChartItem(type == 3 ? "${e.month}" : e.createdAt, e.consume))
|
|
|
- ?.toList() ??
|
|
|
- [],
|
|
|
- dateTime: time,
|
|
|
- drawMax: true,
|
|
|
- unit: "kal")
|
|
|
- ..initData(maxValue: 3500.0 * (type + 1), valueSplit: 500),
|
|
|
- child: Container(
|
|
|
- height: 200,
|
|
|
+ ];
|
|
|
+ },
|
|
|
+ body: ValueListenableBuilder(
|
|
|
+ valueListenable: _tab,
|
|
|
+ builder: (BuildContext context, String value, Widget child) => PageView.builder(
|
|
|
+ reverse: true,
|
|
|
+ itemCount: 10240,
|
|
|
+ controller: _pageController,
|
|
|
+ onPageChanged: (page) {
|
|
|
+ rollDate(-page);
|
|
|
+ },
|
|
|
+ itemBuilder: (context, index) {
|
|
|
+ int type = toType();
|
|
|
+ DateTime time = offsetDate(type, -index);
|
|
|
+ print("$index $type --2222 ${time}");
|
|
|
+ return extended.NestedScrollViewInnerScrollPositionKeyWidget(
|
|
|
+ Key('Tab$index'),
|
|
|
+ FutureBuilder<SportDetail>(
|
|
|
+ future: createFuture(time),
|
|
|
+ builder: (BuildContext context, AsyncSnapshot<SportDetail> snapshot) {
|
|
|
+ var _value = snapshot?.data;
|
|
|
+ var _items = _createItems(type, _value?.recordsTodaySum);
|
|
|
+ return snapshot.connectionState != ConnectionState.done
|
|
|
+ ? RequestLoadingWidget()
|
|
|
+ : Padding(
|
|
|
+ padding: const EdgeInsets.fromLTRB(12.0, 12.0, 12.0, 0),
|
|
|
+ child: SingleChildScrollView(
|
|
|
+ child: Column(
|
|
|
+ children: <Widget>[
|
|
|
+ SizedBox(
|
|
|
+ height: 10.0,
|
|
|
+ ),
|
|
|
+ Padding(
|
|
|
+ padding: const EdgeInsets.only(right: 12.0),
|
|
|
+ child: CustomPaint(
|
|
|
+ painter: Chart(
|
|
|
+ type: TABS.indexOf(_tab.value),
|
|
|
+ records: _value?.recordsToday
|
|
|
+ ?.map((e) => ChartItem(type == 3 ? "${e.month}" : e.createdAt, e.consume))
|
|
|
+ ?.toList() ??
|
|
|
+ [],
|
|
|
+ dateTime: time,
|
|
|
+ drawMax: true,
|
|
|
+ unit: "kal")
|
|
|
+ ..initData(maxValue: 3500.0 * (type + 1), valueSplit: 500),
|
|
|
+ child: Container(
|
|
|
+ height: 200,
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
- ),
|
|
|
- const SizedBox(
|
|
|
- width: 12.0,
|
|
|
- ),
|
|
|
- Padding(
|
|
|
- padding: const EdgeInsets.fromLTRB(8, 8, 8, 4),
|
|
|
- child: StaggeredGridView.extent(
|
|
|
- maxCrossAxisExtent: (MediaQuery.of(context).size.width - 32.0) / 2,
|
|
|
- padding: EdgeInsets.zero,
|
|
|
- shrinkWrap: true,
|
|
|
- physics: NeverScrollableScrollPhysics(),
|
|
|
- mainAxisSpacing: 12.0,
|
|
|
- crossAxisSpacing: 12.0,
|
|
|
- children: _items
|
|
|
- .map((e) => Container(
|
|
|
- decoration: card(),
|
|
|
- padding: const EdgeInsets.fromLTRB(20.0, 20.0, 0, 20.0),
|
|
|
- child: Row(
|
|
|
+ const SizedBox(
|
|
|
+ width: 12.0,
|
|
|
+ ),
|
|
|
+ Padding(
|
|
|
+ padding: const EdgeInsets.fromLTRB(8, 8, 8, 4),
|
|
|
+ child: StaggeredGridView.extent(
|
|
|
+ maxCrossAxisExtent: (MediaQuery.of(context).size.width - 32.0) / 2,
|
|
|
+ padding: EdgeInsets.zero,
|
|
|
+ shrinkWrap: true,
|
|
|
+ physics: NeverScrollableScrollPhysics(),
|
|
|
+ mainAxisSpacing: 12.0,
|
|
|
+ crossAxisSpacing: 12.0,
|
|
|
+ children: _items
|
|
|
+ .map((e) => Container(
|
|
|
+ decoration: card(),
|
|
|
+ padding: const EdgeInsets.fromLTRB(20.0, 20.0, 0, 20.0),
|
|
|
+ child: Row(
|
|
|
+ children: <Widget>[
|
|
|
+ Image.asset(
|
|
|
+ e.icon,
|
|
|
+ width: 36.0,
|
|
|
+ ),
|
|
|
+ const SizedBox(
|
|
|
+ width: 10.0,
|
|
|
+ ),
|
|
|
+ Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: <Widget>[
|
|
|
+ Row(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
+ children: <Widget>[
|
|
|
+ Text(
|
|
|
+ e.title,
|
|
|
+ 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),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ const SizedBox(
|
|
|
+ width: 4.0,
|
|
|
+ ),
|
|
|
+ Text(e.subtitle, style: Theme.of(context).textTheme.bodyText1)
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ))
|
|
|
+ .toList(),
|
|
|
+ staggeredTiles: _items.map((e) => StaggeredTile.fit(1)).toList()),
|
|
|
+ ),
|
|
|
+ if (type != 0 && _value?.recordsTodayAvg != null)
|
|
|
+ Padding(
|
|
|
+ padding: const EdgeInsets.fromLTRB(8.0, 0, 8.0, 20.0),
|
|
|
+ child: Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: <Widget>[
|
|
|
+ Text(
|
|
|
+ "日均数据",
|
|
|
+ style: Theme.of(context).textTheme.headline1.copyWith(fontSize: 16.0),
|
|
|
+ ),
|
|
|
+ SizedBox(
|
|
|
+ height: 16.0,
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ padding: const EdgeInsets.fromLTRB(14.0, 21.0, 14.0, 21.0),
|
|
|
+ decoration: card(),
|
|
|
+ child: Column(
|
|
|
+ children: <Widget>[
|
|
|
+ Row(
|
|
|
children: <Widget>[
|
|
|
Image.asset(
|
|
|
- e.icon,
|
|
|
- width: 36.0,
|
|
|
+ "lib/assets/img/day_icon_duration.png",
|
|
|
+ width: 19.0,
|
|
|
),
|
|
|
const SizedBox(
|
|
|
- width: 10.0,
|
|
|
+ width: 8.0,
|
|
|
+ ),
|
|
|
+ Expanded(
|
|
|
+ child: Text(
|
|
|
+ "日均时长",
|
|
|
+ style: Theme.of(context).textTheme.subtitle1,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ SizedBox(
|
|
|
+ width: 60.0,
|
|
|
+ child: Text(
|
|
|
+ "${_value?.recordsTodayAvg?.durationMinute ?? 0}分钟",
|
|
|
+ style: Theme.of(context).textTheme.subtitle1,
|
|
|
+ ),
|
|
|
),
|
|
|
- Column(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children: <Widget>[
|
|
|
- Row(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
- children: <Widget>[
|
|
|
- Text(
|
|
|
- e.title,
|
|
|
- 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),
|
|
|
- ],
|
|
|
- ),
|
|
|
- const SizedBox(
|
|
|
- width: 4.0,
|
|
|
- ),
|
|
|
- Text(e.subtitle, style: Theme.of(context).textTheme.bodyText1)
|
|
|
- ],
|
|
|
- )
|
|
|
],
|
|
|
),
|
|
|
- ))
|
|
|
- .toList(),
|
|
|
- staggeredTiles: _items.map((e) => StaggeredTile.fit(1)).toList()),
|
|
|
- ),
|
|
|
- if (type != 0 && _value?.recordsTodayAvg != null)
|
|
|
- Padding(
|
|
|
- padding: const EdgeInsets.fromLTRB(8.0, 0, 8.0, 20.0),
|
|
|
- child: Column(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children: <Widget>[
|
|
|
- Text(
|
|
|
- "日均数据",
|
|
|
- style: Theme.of(context).textTheme.headline1.copyWith(fontSize: 16.0),
|
|
|
- ),
|
|
|
- SizedBox(
|
|
|
- height: 16.0,
|
|
|
- ),
|
|
|
- Container(
|
|
|
- padding: const EdgeInsets.fromLTRB(14.0, 21.0, 14.0, 21.0),
|
|
|
- decoration: card(),
|
|
|
- child: Column(
|
|
|
- children: <Widget>[
|
|
|
- Row(
|
|
|
- children: <Widget>[
|
|
|
- Image.asset(
|
|
|
- "lib/assets/img/day_icon_duration.png",
|
|
|
- width: 19.0,
|
|
|
- ),
|
|
|
- const SizedBox(
|
|
|
- width: 8.0,
|
|
|
- ),
|
|
|
- Expanded(
|
|
|
- child: Text(
|
|
|
- "日均时长",
|
|
|
- style: Theme.of(context).textTheme.subtitle1,
|
|
|
+ const SizedBox(
|
|
|
+ height: 20.0,
|
|
|
+ ),
|
|
|
+ Row(
|
|
|
+ children: <Widget>[
|
|
|
+ Image.asset(
|
|
|
+ "lib/assets/img/day_icon_consume.png",
|
|
|
+ width: 19.0,
|
|
|
),
|
|
|
- ),
|
|
|
- SizedBox(
|
|
|
- width: 60.0,
|
|
|
- child: Text(
|
|
|
- "${_value?.recordsTodayAvg?.durationMinute ?? 0}分钟",
|
|
|
- style: Theme.of(context).textTheme.subtitle1,
|
|
|
+ const SizedBox(
|
|
|
+ width: 8.0,
|
|
|
),
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
- const SizedBox(
|
|
|
- height: 20.0,
|
|
|
- ),
|
|
|
- Row(
|
|
|
- children: <Widget>[
|
|
|
- Image.asset(
|
|
|
- "lib/assets/img/day_icon_consume.png",
|
|
|
- width: 19.0,
|
|
|
- ),
|
|
|
- const SizedBox(
|
|
|
- width: 8.0,
|
|
|
- ),
|
|
|
- Expanded(
|
|
|
- child: Text(
|
|
|
- "日均消耗",
|
|
|
- style: Theme.of(context).textTheme.subtitle1,
|
|
|
+ Expanded(
|
|
|
+ child: Text(
|
|
|
+ "日均消耗",
|
|
|
+ style: Theme.of(context).textTheme.subtitle1,
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- SizedBox(
|
|
|
- width: 60.0,
|
|
|
- child: Text(
|
|
|
- "${_value?.recordsTodayAvg?.consume ?? 0}卡",
|
|
|
- style: Theme.of(context).textTheme.subtitle1,
|
|
|
+ SizedBox(
|
|
|
+ width: 60.0,
|
|
|
+ child: Text(
|
|
|
+ "${_value?.recordsTodayAvg?.consume ?? 0}卡",
|
|
|
+ style: Theme.of(context).textTheme.subtitle1,
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
- const SizedBox(
|
|
|
- height: 20.0,
|
|
|
- ),
|
|
|
- Row(
|
|
|
- children: <Widget>[
|
|
|
- Image.asset(
|
|
|
- "lib/assets/img/day_icon_frequency.png",
|
|
|
- width: 19.0,
|
|
|
- ),
|
|
|
- const SizedBox(
|
|
|
- width: 8.0,
|
|
|
- ),
|
|
|
- Expanded(
|
|
|
- child: Text(
|
|
|
- "日均运动次数",
|
|
|
- style: Theme.of(context).textTheme.subtitle1,
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ const SizedBox(
|
|
|
+ height: 20.0,
|
|
|
+ ),
|
|
|
+ Row(
|
|
|
+ children: <Widget>[
|
|
|
+ Image.asset(
|
|
|
+ "lib/assets/img/day_icon_frequency.png",
|
|
|
+ width: 19.0,
|
|
|
),
|
|
|
- ),
|
|
|
- SizedBox(
|
|
|
- width: 60.0,
|
|
|
- child: Text(
|
|
|
- "${_value?.recordsTodayAvg?.times ?? 0}次",
|
|
|
- style: Theme.of(context).textTheme.subtitle1,
|
|
|
+ const SizedBox(
|
|
|
+ width: 8.0,
|
|
|
),
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
- const SizedBox(
|
|
|
- height: 20.0,
|
|
|
- ),
|
|
|
- Row(
|
|
|
- children: <Widget>[
|
|
|
- Image.asset(
|
|
|
- "lib/assets/img/day_icon_steps.png",
|
|
|
- width: 19.0,
|
|
|
- ),
|
|
|
- const SizedBox(
|
|
|
- width: 8.0,
|
|
|
- ),
|
|
|
- Expanded(
|
|
|
- child: Text(
|
|
|
- "游戏步数",
|
|
|
- style: Theme.of(context).textTheme.subtitle1,
|
|
|
+ Expanded(
|
|
|
+ child: Text(
|
|
|
+ "日均运动次数",
|
|
|
+ style: Theme.of(context).textTheme.subtitle1,
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- SizedBox(
|
|
|
- width: 60.0,
|
|
|
- child: Text(
|
|
|
- "${_value?.recordsTodayAvg?.stepCount ?? 0}",
|
|
|
- style: Theme.of(context).textTheme.subtitle1,
|
|
|
+ SizedBox(
|
|
|
+ width: 60.0,
|
|
|
+ child: Text(
|
|
|
+ "${_value?.recordsTodayAvg?.times ?? 0}次",
|
|
|
+ style: Theme.of(context).textTheme.subtitle1,
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- ],
|
|
|
- )
|
|
|
- ],
|
|
|
- ),
|
|
|
- )
|
|
|
- ],
|
|
|
- ),
|
|
|
- )
|
|
|
- ],
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ const SizedBox(
|
|
|
+ height: 20.0,
|
|
|
+ ),
|
|
|
+ Row(
|
|
|
+ children: <Widget>[
|
|
|
+ Image.asset(
|
|
|
+ "lib/assets/img/day_icon_steps.png",
|
|
|
+ width: 19.0,
|
|
|
+ ),
|
|
|
+ const SizedBox(
|
|
|
+ width: 8.0,
|
|
|
+ ),
|
|
|
+ Expanded(
|
|
|
+ child: Text(
|
|
|
+ "游戏步数",
|
|
|
+ style: Theme.of(context).textTheme.subtitle1,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ SizedBox(
|
|
|
+ width: 60.0,
|
|
|
+ child: Text(
|
|
|
+ "${_value?.recordsTodayAvg?.stepCount ?? 0}",
|
|
|
+ style: Theme.of(context).textTheme.subtitle1,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- );
|
|
|
- }));
|
|
|
- },
|
|
|
+ );
|
|
|
+ }));
|
|
|
+ },
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
- ),
|
|
|
- Positioned(
|
|
|
- child: SafeArea(child: buildBackButton(context)),
|
|
|
- ),
|
|
|
- Positioned(
|
|
|
- right: 0,
|
|
|
- child: SafeArea(
|
|
|
+ Positioned(
|
|
|
+ child: buildBackButton(context),
|
|
|
+ ),
|
|
|
+ Positioned(
|
|
|
+ right: 0,
|
|
|
child: IconButton(
|
|
|
icon: Image.asset("lib/assets/img/bbs_icon_share.png"),
|
|
|
onPressed: () async {
|
|
@@ -541,8 +541,8 @@ class _PageState extends State<ConsumePage> with InjectApi {
|
|
|
},
|
|
|
),
|
|
|
),
|
|
|
- ),
|
|
|
- ],
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
);
|
|
|
}
|