add listView year dropdown

This commit is contained in:
2026-01-26 15:23:13 +01:00
parent 3990a8a34e
commit 78e27ac8d0
4 changed files with 73 additions and 3 deletions

View File

@@ -0,0 +1,35 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../controller/home_controller.dart';
import '../helper/helper.dart';
class MyDropDownYear extends StatelessWidget {
const MyDropDownYear({super.key, required this.homCtrl});
final HomeController homCtrl;
@override
Widget build(BuildContext context) {
return Obx(
() => DropdownButton<int>(
menuWidth: 150,
value: homCtrl.currentYear.value,
dropdownColor: Colors.blueGrey,
underline: Container(),
style: const TextStyle(color: Colors.white, fontSize: 16),
items: kListDropDownYear.map((year) {
return DropdownMenuItem<int>(
value: year,
child: Text(year.toString()),
);
}).toList(),
onChanged: (selectedYear) {
if (selectedYear != null) {
homCtrl.changeYear(selectedYear);
}
},
),
);
}
}