You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.5 KiB

3 years ago
import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/widget/animated/animated_scale.dart';
import 'package:flutter/material.dart';
class BeeRadio<T> extends StatefulWidget {
final T value;
4 years ago
final List<T>? groupValues;
3 years ago
4 years ago
BeeRadio({Key? key, required this.value, required this.groupValues})
: super(key: key);
@override
_BeeRadioState createState() => _BeeRadioState();
}
class _BeeRadioState extends State<BeeRadio> {
bool get _selected {
4 years ago
if (widget.groupValues!.contains(widget.value)) return true;
return false;
}
@override
Widget build(BuildContext context) {
return AnimatedContainer(
height: 40.w,
width: 40.w,
decoration: BoxDecoration(
border: Border.all(
color: _selected ? kPrimaryColor : Color(0xFF979797),
width: 3.w,
),
borderRadius: BorderRadius.circular(20.w),
),
duration: Duration(milliseconds: 300),
curve: Curves.easeInOutCubic,
alignment: Alignment.center,
child: AnimatedOpacity(
duration: Duration(milliseconds: 300),
curve: Curves.easeInOutCubic,
opacity: _selected ? 1 : 0,
child: AnimatedScale(
scale: _selected ? 1 : 0,
child: Container(
height: 24.w,
width: 24.w,
decoration: BoxDecoration(
color: kPrimaryColor,
borderRadius: BorderRadius.circular(12.w),
),
),
),
),
);
}
}