| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- import 'package:fast/constants.dart';
- import 'package:fast/model/model.dart';
- import 'package:fast/utils/size_fit.dart';
- import 'package:flutter/material.dart';
- // GlobalKey todayKey = GlobalKey();
- // ignore: must_be_immutable
- class CalendarItem extends StatelessWidget {
- CalendarItemBean bean;
- CalendarItem({Key? key, required this.bean}) : super(key: key);
- @override
- Widget build(BuildContext context) {
- SizeFit.initialize(context);
- return Opacity(
- opacity: (bean.isHighlight || bean.isToday) ? 1.0 : 0.5,
- child: Container(
- // key: bean.isToday ? todayKey : null,
- alignment: Alignment.center,
- width: 50.px,
- height: 50.px,
- decoration: BoxDecoration(
- border: Border.all(
- color: bean.isToday ? Colors.white : Colors.transparent,
- width: 2.px),
- borderRadius: BorderRadius.all(Radius.circular(25.px))),
- child: bean.day != null ? dayContent() : const Text('')));
- }
- dayContent() {
- return Stack(
- children: [
- if (bean.isIng && bean.finishDayBean == null)
- Container(
- width: 36.px,
- height: 36.px,
- margin: EdgeInsets.only(left: 5.px, top: 5.px),
- decoration: BoxDecoration(
- color: Colors.transparent,
- border: Border.all(color: kThemeColor, width: 2.px),
- borderRadius: BorderRadius.all(Radius.circular(18.px))),
- ),
- if (bean.showCircle)
- Container(
- width: 36.px,
- height: 36.px,
- margin: EdgeInsets.only(left: 5.px, top: 5.px),
- decoration: const BoxDecoration(
- image: DecorationImage(
- image: AssetImage('assets/images/dash_circle.png'),
- fit: BoxFit.cover)),
- ),
- if (bean.finishDayBean != null)
- Container(
- width: 36.px,
- height: 36.px,
- margin: EdgeInsets.only(left: 5.px, top: 5.px),
- decoration: BoxDecoration(
- color: kThemeColor,
- borderRadius: BorderRadius.all(Radius.circular(18.px))),
- ),
- if (bean.finishDayBean != null && bean.isIng)
- Stack(
- children: [
- Container(
- width: 36.px,
- height: 36.px,
- margin: EdgeInsets.only(left: 2.px, top: 5.px),
- decoration: BoxDecoration(
- color: kThemeColor,
- borderRadius: BorderRadius.all(Radius.circular(18.px))),
- ),
- Container(
- width: 36.px,
- height: 36.px,
- margin: EdgeInsets.only(left: 6.px, top: 5.px),
- decoration: BoxDecoration(
- color: const Color(0xFF000D1F),
- border: Border.all(color: kThemeColor, width: 2.px),
- boxShadow: [
- BoxShadow(
- offset: Offset(-2.px, 0.px),
- blurRadius: 4.px,
- color: const Color(0x80000D1F))
- ],
- borderRadius: BorderRadius.all(Radius.circular(18.px))),
- )
- ],
- ),
- if (bean.finishDayBean != null && bean.finishDayBean!.challenge_count + bean.finishDayBean!.single_count > 1 && bean.isIng==false)
- Stack(
- children: [
- Container(
- width: 36.px,
- height: 36.px,
- margin: EdgeInsets.only(left: 3.px, top: 5.px),
- decoration: BoxDecoration(
- color: kThemeColor,
- borderRadius: BorderRadius.all(Radius.circular(18.px))),
- ),
- Container(
- width: 36.px,
- height: 36.px,
- margin: EdgeInsets.only(left: 7.px, top: 5.px),
- decoration: BoxDecoration(
- color: kThemeColor,
- boxShadow: [
- BoxShadow(
- offset: Offset(-2.px, 0.px),
- blurRadius: 4.px,
- color: const Color(0x80000D1F))
- ],
- borderRadius: BorderRadius.all(Radius.circular(18.px))),
- )
- ],
- ),
- Container(
- width: 46.px,
- height: 46.px,
- alignment: Alignment.center,
- padding: EdgeInsets.only(
- bottom: (bean.finishDayBean != null &&
- bean.finishDayBean!.win_stone > 0)
- ? 5.px
- : 0,
- left: ((bean.finishDayBean != null && bean.isIng) ||
- (bean.finishDayBean != null &&
- bean.finishDayBean!.challenge_count +
- bean.finishDayBean!.single_count >
- 0))
- ? 2.px
- : 0),
- child: Text(
- bean.day.toString(),
- style: TextStyle(
- shadows: [
- Shadow(
- offset: Offset(0.0, 2.px),
- blurRadius: 4.px,
- color: kBgColor)
- ],
- color: Colors.white,
- fontSize: 16.px,
- fontWeight: FontWeight.w600,
- height: 1.0,
- fontFamily: 'Exo2'),
- ),
- ),
- if (bean.finishDayBean != null && bean.finishDayBean!.win_stone > 0)
- Positioned(
- bottom: 2.px,
- left: 9.px,
- child: Container(
- width: 28.px,
- height: 14.px,
- alignment: Alignment.center,
- decoration: BoxDecoration(
- color: const Color(0xFF050F1A),
- borderRadius: BorderRadius.all(Radius.circular(7.px))),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- '+${bean.finishDayBean!.win_stone}',
- style: TextStyle(
- color: Colors.white,
- fontFamily: 'Exo2',
- fontWeight: FontWeight.w600,
- fontSize: 8.px),
- ),
- SizedBox(
- width: 2.px,
- ),
- Image.asset(
- 'assets/images/stone.png',
- width: 10.px,
- height: 10.px,
- )
- ],
- ),
- ))
- ],
- );
- }
- }
|