-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustom_radio_button.dart
More file actions
81 lines (76 loc) · 2.42 KB
/
Copy pathcustom_radio_button.dart
File metadata and controls
81 lines (76 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import 'package:flutter/material.dart';
import 'package:plantstore/commons/navigator_key.dart';
import 'package:plantstore/constants/app_colors.dart';
class CustomRadioButtonWidget extends StatelessWidget {
const CustomRadioButtonWidget({
super.key,
required this.isSelected,
this.dimension = 20,
});
final bool isSelected;
final double dimension;
SizedBox get gapH3 => SizedBox(
height: MediaQuery.sizeOf(navigatorkey.currentContext!).height * .03,
);
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
gapH3,
if (isSelected) ...{
SizedBox.square(
dimension: dimension,
child: TweenAnimationBuilder(
tween: Tween<double>(
begin: 1.0,
end: 5.0,
),
duration: const Duration(milliseconds: 500),
builder: (BuildContext _, double widthVal, Widget? __) {
return TweenAnimationBuilder(
tween: ColorTween(
begin: const Color(0xFF4CAF50),
end: const Color(0xFF2196F3),
),
duration: const Duration(milliseconds: 1400),
builder: (BuildContext __, Color? colorVal, Widget? _) {
return Container(
decoration: BoxDecoration(
border: Border.all(
color: colorVal as Color,
width: widthVal,
),
shape: BoxShape.circle,
),
child: const CircleAvatar(
backgroundColor: AppColorsLightMode.basicWhite,
radius: 6,
),
);
},
);
},
),
),
} else ...{
SizedBox.square(
dimension: dimension,
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color: Colors.grey,
width: 1.5,
),
),
child: const CircleAvatar(
radius: 6,
backgroundColor: AppColorsLightMode.basicWhite,
),
),
),
},
],
);
}
}