Commit 7321fbce77baded0a69c73d6529ee593cb463640

Authored by 刘宏哲
1 parent 7fdb7fbc

feat(app): 非会员只能看当日活动消耗和睡眠报告

@@ -55,7 +55,11 @@ class ActivityBurnReportView extends StatelessWidget { @@ -55,7 +55,11 @@ class ActivityBurnReportView extends StatelessWidget {
55 ), 55 ),
56 ), 56 ),
57 const SizedBox(height: 8), 57 const SizedBox(height: 8),
58 - _DateSwitcher(logic: logic), 58 + _DateSwitcher(
  59 + logic: logic,
  60 + isVip: isVip,
  61 + onSubscribe: onSubscribe,
  62 + ),
59 ], 63 ],
60 ), 64 ),
61 ), 65 ),
@@ -144,20 +148,32 @@ class _DailyReportContent extends StatelessWidget { @@ -144,20 +148,32 @@ class _DailyReportContent extends StatelessWidget {
144 } 148 }
145 149
146 class _DateSwitcher extends StatelessWidget { 150 class _DateSwitcher extends StatelessWidget {
147 - const _DateSwitcher({required this.logic}); 151 + const _DateSwitcher({
  152 + required this.logic,
  153 + required this.isVip,
  154 + required this.onSubscribe,
  155 + });
148 156
149 final ActivityBurnReportLogic logic; 157 final ActivityBurnReportLogic logic;
  158 + final bool isVip;
  159 + final ValueChanged<String> onSubscribe;
150 160
151 @override 161 @override
152 Widget build(BuildContext context) { 162 Widget build(BuildContext context) {
153 return Obx( 163 return Obx(
154 () => ReportDateSwitcher( 164 () => ReportDateSwitcher(
155 label: logic.dateLabel, 165 label: logic.dateLabel,
156 - onPrevious: logic.previousDay,  
157 - onNext: logic.nextDay, 166 + onPrevious: isVip
  167 + ? logic.previousDay
  168 + : () => onSubscribe('非会员切换日期-活动消耗'),
  169 + onNext: isVip
  170 + ? logic.nextDay
  171 + : () => onSubscribe('非会员切换日期-活动消耗'),
158 canPrevious: logic.canGoPrevious, 172 canPrevious: logic.canGoPrevious,
159 canNext: logic.canGoNext, 173 canNext: logic.canGoNext,
160 - onTapLabel: () => _showDatePicker(context), 174 + onTapLabel: isVip
  175 + ? () => _showDatePicker(context)
  176 + : () => onSubscribe('非会员切换日期-活动消耗'),
161 ), 177 ),
162 ); 178 );
163 } 179 }
@@ -111,7 +111,11 @@ class _SleepReportViewState extends State<SleepReportView> { @@ -111,7 +111,11 @@ class _SleepReportViewState extends State<SleepReportView> {
111 ), 111 ),
112 ), 112 ),
113 const SizedBox(height: 8), 113 const SizedBox(height: 8),
114 - _DateSwitcher(logic: widget.logic), 114 + _DateSwitcher(
  115 + logic: widget.logic,
  116 + isVip: widget.isVip,
  117 + onSubscribe: widget.onSubscribe,
  118 + ),
115 ], 119 ],
116 ), 120 ),
117 ), 121 ),
@@ -208,20 +212,32 @@ class _DailyReportContent extends StatelessWidget { @@ -208,20 +212,32 @@ class _DailyReportContent extends StatelessWidget {
208 } 212 }
209 213
210 class _DateSwitcher extends StatelessWidget { 214 class _DateSwitcher extends StatelessWidget {
211 - const _DateSwitcher({required this.logic}); 215 + const _DateSwitcher({
  216 + required this.logic,
  217 + required this.isVip,
  218 + required this.onSubscribe,
  219 + });
212 220
213 final SleepReportLogic logic; 221 final SleepReportLogic logic;
  222 + final bool isVip;
  223 + final ValueChanged<String> onSubscribe;
214 224
215 @override 225 @override
216 Widget build(BuildContext context) { 226 Widget build(BuildContext context) {
217 return Obx( 227 return Obx(
218 () => ReportDateSwitcher( 228 () => ReportDateSwitcher(
219 label: logic.dateLabel, 229 label: logic.dateLabel,
220 - onPrevious: logic.previousDay,  
221 - onNext: logic.nextDay, 230 + onPrevious: isVip
  231 + ? logic.previousDay
  232 + : () => onSubscribe('非会员切换日期-睡眠报告'),
  233 + onNext: isVip
  234 + ? logic.nextDay
  235 + : () => onSubscribe('非会员切换日期-睡眠报告'),
222 canPrevious: logic.canGoPrevious, 236 canPrevious: logic.canGoPrevious,
223 canNext: logic.canGoNext, 237 canNext: logic.canGoNext,
224 - onTapLabel: () => _showDatePicker(context), 238 + onTapLabel: isVip
  239 + ? () => _showDatePicker(context)
  240 + : () => onSubscribe('非会员切换日期-睡眠报告'),
225 ), 241 ),
226 ); 242 );
227 } 243 }