After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 7.8 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 848 B |
@ -0,0 +1,88 @@
|
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:table_calendar/table_calendar.dart'; |
||||
|
||||
class CalendarPage extends StatefulWidget { |
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _CalendarPage(); |
||||
} |
||||
} |
||||
|
||||
class _CalendarPage extends State<CalendarPage> with TickerProviderStateMixin { |
||||
AnimationController _animationController; |
||||
CalendarController _calendarController; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
|
||||
_calendarController = CalendarController(); |
||||
|
||||
_animationController = AnimationController( |
||||
vsync: this, |
||||
duration: const Duration(milliseconds: 400), |
||||
); |
||||
|
||||
_animationController.forward(); |
||||
} |
||||
|
||||
@override |
||||
void dispose() { |
||||
_animationController.dispose(); |
||||
_calendarController.dispose(); |
||||
super.dispose(); |
||||
} |
||||
|
||||
void _onDaySelected(DateTime day, List events, List holidays) { |
||||
print('CALLBACK: _onDaySelected'); |
||||
} |
||||
|
||||
void _onVisibleDaysChanged(DateTime first, DateTime last, CalendarFormat format) { |
||||
print('CALLBACK: _onVisibleDaysChanged'); |
||||
} |
||||
|
||||
void _onCalendarCreated(DateTime first, DateTime last, CalendarFormat format) { |
||||
print('CALLBACK: _onCalendarCreated'); |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Container( |
||||
child: Column( |
||||
mainAxisSize: MainAxisSize.max, |
||||
children: [ |
||||
_buildTableCalendar(), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget _buildTableCalendar() { |
||||
return TableCalendar( |
||||
calendarController: _calendarController, |
||||
startingDayOfWeek: StartingDayOfWeek.monday, |
||||
availableGestures: AvailableGestures.none, |
||||
headerStyle: HeaderStyle( |
||||
centerHeaderTitle: false, |
||||
leftChevronVisible: false, |
||||
rightChevronVisible: false, |
||||
formatButtonVisible: false, |
||||
), |
||||
calendarStyle: CalendarStyle( |
||||
outsideDaysVisible: false, |
||||
selectedColor: Color(0xFF32A060), |
||||
weekendStyle: TextStyle().copyWith(color: Color(0xFF333333)), |
||||
todayColor: Color(0xFFD5EBDE), |
||||
), |
||||
daysOfWeekStyle: DaysOfWeekStyle( |
||||
weekendStyle: TextStyle().copyWith(color: Color(0xFF4D4D4D)), |
||||
), |
||||
onDaySelected: _onDaySelected, |
||||
onVisibleDaysChanged: _onVisibleDaysChanged, |
||||
onCalendarCreated: _onCalendarCreated, |
||||
); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,193 @@
|
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:huixiang/retrofit/data/rank.dart'; |
||||
import 'package:huixiang/retrofit/data/user_info.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/login_tips_dialog.dart'; |
||||
import 'package:shared_preferences/shared_preferences.dart'; |
||||
|
||||
class MineVipEntry extends StatelessWidget { |
||||
int vipLevel; |
||||
int curLevel; |
||||
final int rankMax; |
||||
final int rank; |
||||
final String createTime; |
||||
final String tag; |
||||
final double padding; |
||||
final UserInfo userInfo; |
||||
final List<Rank> ranks; |
||||
|
||||
MineVipEntry( |
||||
{this.vipLevel = 1, |
||||
this.ranks, |
||||
this.tag, |
||||
this.userInfo, |
||||
this.padding = 16, |
||||
this.curLevel = 1, |
||||
this.rankMax = 0, |
||||
this.rank = 0, |
||||
this.createTime = ""}); |
||||
|
||||
String topLeft = ""; |
||||
String levelText = "普通用户"; |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
if (userInfo != null && |
||||
userInfo.memberRankVo != null && |
||||
ranks != null && |
||||
ranks.length > 0) { |
||||
curLevel = (ranks.indexWhere((element) => element.id == userInfo.memberRankVo.id) + 1); |
||||
vipLevel = curLevel; |
||||
} |
||||
|
||||
if (curLevel == vipLevel) { |
||||
topLeft = S.of(context).dangqiandengji; |
||||
} else if (vipLevel < curLevel) { |
||||
topLeft = S.of(context).shangyidengji; |
||||
} else { |
||||
topLeft = S.of(context).zanweikaitong; |
||||
} |
||||
switch (vipLevel) { |
||||
case 1: |
||||
{ |
||||
levelText = "${S.of(context).yinkahuiyuan}"; |
||||
break; |
||||
} |
||||
case 2: |
||||
{ |
||||
levelText = "${S.of(context).jinkahuiyuan}"; |
||||
break; |
||||
} |
||||
case 3: |
||||
{ |
||||
levelText = "${S.of(context).gongchuanghuiyuan}"; |
||||
break; |
||||
} |
||||
} |
||||
|
||||
Widget widget = Container( |
||||
width: double.infinity, |
||||
padding: EdgeInsets.only(top: 12.h, bottom: 25.h, left: 12, right: 12), |
||||
// margin: EdgeInsets.symmetric(horizontal: 14), |
||||
margin: EdgeInsets.only(top: 15,left: 14,right: 14), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFF3D3D5D), |
||||
borderRadius: BorderRadius.only( |
||||
topLeft: Radius.circular(6), |
||||
topRight: Radius.circular(6), |
||||
), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Row( |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/vip_logo.webp", |
||||
width: 24, |
||||
height: 24, |
||||
), |
||||
SizedBox( |
||||
width: 4, |
||||
), |
||||
Expanded( |
||||
child: Text( |
||||
levelText, |
||||
style: TextStyle( |
||||
fontSize: 16, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFFFFEAD2)), |
||||
)), |
||||
Container( |
||||
padding: EdgeInsets.fromLTRB(9.w, 4.h, 8.w, 4.h), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFFFECD2), |
||||
borderRadius: BorderRadius.circular(10), |
||||
), |
||||
child: Text( |
||||
S.of(context).chakanquanyi, |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF92755D), |
||||
), |
||||
), |
||||
) |
||||
], |
||||
), |
||||
SizedBox( |
||||
height: 14, |
||||
), |
||||
Container( |
||||
height: 8.h, |
||||
child: ClipRRect( |
||||
borderRadius: BorderRadius.circular(6.5), |
||||
child: LinearProgressIndicator( |
||||
value: rankMax > (rank ?? 0) |
||||
? ((vipLevel < curLevel) |
||||
? rankMax / rankMax |
||||
: (rank ?? 0) / rankMax) |
||||
: 0, |
||||
backgroundColor: Color(0xFF222233), |
||||
color: Color(0xFFFFECD2), |
||||
), |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 8, |
||||
), |
||||
Text( |
||||
rank > rankMax |
||||
? S.of(context).dangqiandengji |
||||
: "消费金额¥${rank.toStringAsFixed(2).toString()} 距${S.of(context).xiayidengji}还需¥${(rankMax - (rank ?? 0)).toStringAsFixed(2)}", |
||||
style: TextStyle( |
||||
color: Color(0xFFFFEAD2), |
||||
fontWeight: MyFontWeight.regular, |
||||
fontSize: 14.sp, |
||||
), |
||||
) |
||||
], |
||||
)); |
||||
|
||||
return GestureDetector( |
||||
onTap: () { |
||||
if (userInfo != null) { |
||||
SharedPreferences.getInstance().then((value) { |
||||
if (value.getString("token") == null || |
||||
value.getString("token") == "") { |
||||
LoginTipsDialog().show(context); |
||||
return; |
||||
} |
||||
// Navigator.of(context) |
||||
// .pushNamed('/router/mine_vip_level_page', arguments: { |
||||
// "rankLevel": curLevel, |
||||
// "createTime": (userInfo != null) ? "${userInfo.createTime}" : "", |
||||
// "points": (userInfo != null) ? int.tryParse(userInfo.points) : 0, |
||||
// }); |
||||
Navigator.of(context) |
||||
.pushNamed('/router/mine_vip_core', arguments: { |
||||
"rankLevel": curLevel, |
||||
"userInfo": userInfo.masterCardRankName, |
||||
"createTime": (userInfo != null) ? "${userInfo.createTime}" : "", |
||||
"expendAmount": |
||||
double.tryParse(userInfo?.expendAmount ?? "0").toInt(), |
||||
}); |
||||
}); |
||||
} |
||||
}, |
||||
child: widget, |
||||
); |
||||
} |
||||
} |