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.

51 lines
1.5 KiB

4 years ago
// Flutter imports:
import 'package:flutter/material.dart';
4 years ago
// Project imports:
3 years ago
import 'package:aku_new_community_manager/style/app_style.dart';
4 years ago
class AkuRadio extends StatefulWidget {
final double? size;
final int grouvalue;
final int value;
final AkuValueChange? onchanged;
AkuRadio({Key? key, this.size, required this.grouvalue, required this.value, this.onchanged})
: super(key: key);
@override
_AkuRadioState createState() => _AkuRadioState();
}
class _AkuRadioState extends State<AkuRadio> {
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
widget.onchanged!(widget.value);
},
child: Container(
alignment: Alignment.center,
width: widget.size,
height: widget.size,
decoration: BoxDecoration(
4 years ago
border: Border.all(color: Color(0xFFE8E8E8), width: 2.w),
borderRadius: BorderRadius.circular(widget.size! / 2),
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: widget.grouvalue == widget.value
? [Color(0xFFFFE080), Color(0xFFFFC40C)]
: [Color(0xFFFFFFFF), Color(0xFFFFFFFF)])),
child: widget.grouvalue == widget.value
? Icon(
Icons.check,
size: widget.size! * 0.8,
)
: SizedBox(),
),
);
}
}
typedef AkuValueChange = void Function(int);