mobile_skt/lib/screens/home/components/date_container.dart

47 lines
1.9 KiB
Dart
Raw Normal View History

2024-03-19 11:09:07 +08:00
import 'package:flutter/material.dart';
import 'package:get/get.dart';
2024-03-19 13:27:42 +08:00
import 'package:sk_base_mobile/app_theme.dart';
2024-03-19 11:09:07 +08:00
import 'package:sk_base_mobile/constants/bg_color.dart';
import 'package:sk_base_mobile/screens/home/home_controller.dart';
2024-03-19 13:27:42 +08:00
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
2024-03-19 11:09:07 +08:00
import 'dates.dart';
class DateContainer extends StatelessWidget {
final int index;
DateContainer({super.key, required this.index});
final controller = Get.put(HomeController());
@override
Widget build(BuildContext context) {
2024-03-19 13:27:42 +08:00
final size = MediaQuery.sizeOf(context);
2024-03-19 11:09:07 +08:00
return Obx(() => AnimatedContainer(
duration: const Duration(milliseconds: 200),
2024-03-19 13:27:42 +08:00
height: ScreenAdaper.height(120),
width: ScreenAdaper.width(100),
margin: EdgeInsets.only(left: ScreenAdaper.width(size.width) * 0.05),
2024-03-19 11:09:07 +08:00
decoration: BoxDecoration(
color: Colors.white,
2024-03-19 13:27:42 +08:00
borderRadius: BorderRadius.circular(ScreenAdaper.sp(20)),
2024-03-19 11:09:07 +08:00
gradient: controller.currentIndex.value == index
? const LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
2024-03-19 13:27:42 +08:00
colors: [
AppTheme.secondPrimaryColor,
AppTheme.secondPrimaryColorDark
])
2024-03-19 11:09:07 +08:00
: null,
boxShadow: [
controller.currentIndex.value == index
2024-03-19 13:27:42 +08:00
? BoxShadow(
color: AppTheme.secondPrimaryColorLight,
offset: Offset(0, ScreenAdaper.width(10)),
blurRadius: ScreenAdaper.sp(20))
: BoxShadow(
2024-03-19 11:09:07 +08:00
color: Colors.black12,
2024-03-19 13:27:42 +08:00
offset: Offset(0, ScreenAdaper.width(10)),
blurRadius: ScreenAdaper.sp(20))
2024-03-19 11:09:07 +08:00
]),
child: Dates(index: index)));
}
}