new project stable version
This commit is contained in:
37
lib/presentation/components/period_selector.dart
Normal file
37
lib/presentation/components/period_selector.dart
Normal file
@@ -0,0 +1,37 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class PeriodSelector extends StatelessWidget {
|
||||
final List<String> periods;
|
||||
final int currentIndex;
|
||||
final Function(int) onSelect;
|
||||
|
||||
PeriodSelector({required this.currentIndex, required this.onSelect, required this.periods});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: List.generate(periods.length, (index) {
|
||||
bool isSelected = currentIndex == index;
|
||||
return GestureDetector(
|
||||
onTap: () => onSelect(index),
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? const Color(0xFF80FFD1) : const Color(0xFF1E2652),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Text(
|
||||
periods[index],
|
||||
style: TextStyle(
|
||||
color: isSelected ? Colors.black : Colors.white.withOpacity(0.5),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user