import 'package:flutter/material.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/item_title.dart'; import 'package:huixiang/view_widget/login_tips_dialog.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; class SignView extends StatelessWidget { final bool isSigned; final Function setSigned; SignView( this.isSigned, this.setSigned, ); @override Widget build(BuildContext context) { return Column( children: [ SizedBox( height: 10.h, ), ItemTitle( text: S.of(context).jinrihuiyuanrenwu, imgPath: "assets/image/icon_today_task.webp", moreText: S.of(context).renwuzhongxin, onTap: () { SharedPreferences.getInstance().then((value) { if (value.getString('token') == null || value.getString('token') == "") { LoginTipsDialog().show(context); } else { Navigator.of(context).pushNamed('/router/integral_page'); } }); }, ), InkWell( onTap: () { SharedPreferences.getInstance().then((value) { if (value.getString('token') == null || value.getString('token') == "") { LoginTipsDialog().show(context); } else { Navigator.of(context).pushNamed('/router/integral_page') .then((value) => { if (value != null) setSigned(value), }); } }); }, child: signIn(context), ), SizedBox( height: 12.h, ), ], ); } ///签到view Widget signIn(BuildContext context) { return Container( padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 8.h), margin: EdgeInsets.all(16), decoration: BoxDecoration( color: Colors.white, boxShadow: [ BoxShadow( color: Colors.black.withAlpha(12), offset: Offset(0, 3), blurRadius: 14, spreadRadius: 0, ) ], borderRadius: BorderRadius.circular(4), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Image.asset( "assets/image/icon_calendar_today_sharp.webp", width: 20.w, height: 20.h, ), SizedBox( width: 8.w, ), Text( S.of(context).qiandaolingqujinfen, style: TextStyle( color: Colors.black, fontSize: 14.sp, fontWeight: MyFontWeight.regular, ), ), ], ), Text( isSigned ? S.of(context).yiqiandao : S.of(context).quqiandao, style: TextStyle( color: Color(0xFF727272), fontSize: 12.sp, fontWeight: MyFontWeight.regular, ), ), ], ), ); } }