You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
flutter_custom_calendar/lib/widget/default_combine_day_view.dart

135 lines
3.6 KiB

6 years ago
import 'package:flutter/material.dart';
5 years ago
import 'package:flutter_custom_calendar/flutter_custom_calendar.dart';
6 years ago
import 'package:flutter_custom_calendar/style/style.dart';
5 years ago
import 'base_day_view.dart';
6 years ago
/**
* widgetitem
*/
//class DefaultCombineDayWidget extends StatelessWidget {
// DateModel dateModel;
//
// DefaultCombineDayWidget(this.dateModel);
//
// @override
// Widget build(BuildContext context) {
// return Container(
// margin: EdgeInsets.only(top: 5, bottom: 5),
// decoration: dateModel.isSelected
// ? new BoxDecoration(color: Colors.red, shape: BoxShape.circle)
// : null,
// child: new Stack(
// alignment: Alignment.center,
// children: <Widget>[
// new Column(
// mainAxisSize: MainAxisSize.max,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: <Widget>[
// //公历
// new Expanded(
// child: Center(
// child: new Text(
// dateModel.day.toString(),
// style: currentMonthTextStyle,
// ),
// ),
// ),
//
// //农历
// new Expanded(
// child: Center(
// child: new Text(
// "${dateModel.lunarString}",
// style: lunarTextStyle,
// ),
// ),
// ),
// ],
// )
// ],
// ),
// );
// }
//}
class DefaultCombineDayWidget extends BaseCombineDayWidget {
DefaultCombineDayWidget(DateModel dateModel) : super(dateModel);
@override
Widget getNormalWidget(DateModel dateModel) {
return Container(
margin: EdgeInsets.all(8),
child: new Stack(
alignment: Alignment.center,
children: <Widget>[
new Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
//公历
new Expanded(
child: Center(
child: new Text(
dateModel.day.toString(),
style: currentMonthTextStyle,
),
),
),
//农历
new Expanded(
child: Center(
child: new Text(
"${dateModel.lunarString}",
style: lunarTextStyle,
),
),
),
],
)
],
),
);
}
@override
Widget getSelectedWidget(DateModel dateModel) {
return Container(
margin: EdgeInsets.all(8),
foregroundDecoration:
new BoxDecoration(border: Border.all(width: 2, color: Colors.blue)),
child: new Stack(
alignment: Alignment.center,
children: <Widget>[
new Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
//公历
new Expanded(
child: Center(
child: new Text(
dateModel.day.toString(),
style: currentMonthTextStyle,
),
),
),
//农历
new Expanded(
child: Center(
child: new Text(
"${dateModel.lunarString}",
style: lunarTextStyle,
),
),
),
],
)
],
),
);
}
}