-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathaccount_ownership_widget.dart
More file actions
99 lines (94 loc) · 2.71 KB
/
Copy pathaccount_ownership_widget.dart
File metadata and controls
99 lines (94 loc) · 2.71 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import 'package:bb_mobile/core/themes/app_theme.dart';
import 'package:bb_mobile/core/utils/build_context_x.dart';
import 'package:bb_mobile/core/widgets/text/text.dart' show BBText;
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
class AccountOwnershipWidget extends StatelessWidget {
const AccountOwnershipWidget({
super.key,
required this.formData,
required this.onFormDataChanged,
});
final Map<String, dynamic> formData;
final Function(String, String) onFormDataChanged;
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: .start,
children: [
BBText(
context.loc.withdrawOwnershipQuestion,
style: context.font.bodyLarge?.copyWith(
color: context.appColors.secondary,
fontWeight: .w500,
),
),
const Gap(8),
_buildRadioOption(
context,
context.loc.withdrawOwnershipMyAccount,
'isOwner',
true,
),
const Gap(8),
_buildRadioOption(
context,
context.loc.withdrawOwnershipOtherAccount,
'isOwner',
false,
),
],
);
}
Widget _buildRadioOption(
BuildContext context,
String label,
String key,
bool value,
) {
final isSelected = formData[key] == value;
return InkWell(
onTap: () => onFormDataChanged(key, value.toString()),
borderRadius: BorderRadius.circular(4),
child: SizedBox(
height: 56,
child: Material(
elevation: 4,
color: context.appColors.surface,
borderRadius: BorderRadius.circular(4),
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: isSelected
? context.appColors.primary
: context.appColors.surface,
width: 1,
),
),
child: RadioGroup<bool>(
groupValue: (formData[key] as String?) == 'true',
onChanged: (_) => onFormDataChanged(key, value.toString()),
child: Row(
children: [
Radio<bool>(
value: value,
activeColor: context.appColors.primary,
),
const Gap(8),
Expanded(
child: BBText(
label,
style: context.font.headlineSmall?.copyWith(
color: context.appColors.secondary,
),
),
),
],
),
),
),
),
),
);
}
}