50 lines
1.3 KiB
Dart
50 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class DidvanToggleButtonTime extends StatelessWidget {
|
|
final bool active;
|
|
final String title;
|
|
final VoidCallback onTap;
|
|
|
|
const DidvanToggleButtonTime({
|
|
Key? key,
|
|
required this.title,
|
|
required this.active,
|
|
required this.onTap,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
final colorScheme = theme.colorScheme;
|
|
|
|
return InkWell(
|
|
onTap: onTap,
|
|
borderRadius: BorderRadius.circular(16),
|
|
child: AnimatedContainer(
|
|
duration: const Duration(milliseconds: 200),
|
|
width: 80,
|
|
height: 48,
|
|
decoration: BoxDecoration(
|
|
color: active ? colorScheme.primary : colorScheme.surface,
|
|
borderRadius: BorderRadius.circular(16),
|
|
border: Border.all(
|
|
color: active
|
|
? colorScheme.primary
|
|
: colorScheme.outline.withOpacity(0.2),
|
|
width: 2,
|
|
),
|
|
),
|
|
child: Center(
|
|
child: Text(
|
|
title,
|
|
style: theme.textTheme.titleLarge?.copyWith(
|
|
color: active ? colorScheme.onPrimary : colorScheme.onSurface,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|