mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-04-21 22:39:11 +00:00
53 lines
No EOL
1.6 KiB
Dart
53 lines
No EOL
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class OptionBox extends StatelessWidget {
|
|
final dynamic optionsValue;
|
|
final dynamic itemValue;
|
|
final void Function(dynamic) onTap;
|
|
final String label;
|
|
|
|
const OptionBox({
|
|
super.key,
|
|
required this.optionsValue,
|
|
required this.itemValue,
|
|
required this.onTap,
|
|
required this.label,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Material(
|
|
color: Colors.transparent,
|
|
borderRadius: BorderRadius.circular(50),
|
|
child: InkWell(
|
|
borderRadius: BorderRadius.circular(50),
|
|
onTap: () => onTap(itemValue),
|
|
child: AnimatedContainer(
|
|
duration: const Duration(milliseconds: 250),
|
|
curve: Curves.easeInOut,
|
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(50),
|
|
color: optionsValue == itemValue
|
|
? Theme.of(context).colorScheme.primary
|
|
: Theme.of(context).colorScheme.primaryContainer,
|
|
),
|
|
child: AnimatedDefaultTextStyle(
|
|
duration: const Duration(milliseconds: 250),
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.w500,
|
|
fontSize: 14,
|
|
color: optionsValue == itemValue
|
|
? Theme.of(context).colorScheme.onInverseSurface
|
|
: Theme.of(context).colorScheme.onSurface
|
|
),
|
|
child: Text(
|
|
label,
|
|
textAlign: TextAlign.center,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |