refactor: Update Checkbox fill color handling and enhance agreement toggle interaction

This commit is contained in:
Vaibhav Surve 2025-05-31 16:46:10 +05:30
parent 706726c787
commit aca2722ee4
2 changed files with 34 additions and 17 deletions

View File

@ -123,7 +123,17 @@ class _LoginScreenState extends State<LoginScreen> with UIMixin {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4),
),
fillColor: WidgetStatePropertyAll(contentTheme.secondary),
fillColor: MaterialStateProperty
.resolveWith<Color>(
(Set<WidgetState> states) {
if (states
.contains(WidgetState.selected)) {
return Colors.blueAccent;
}
return Colors
.white;
},
),
checkColor: contentTheme.onPrimary,
visualDensity: getCompactDensity,
materialTapTargetSize:

View File

@ -147,22 +147,29 @@ class _OrganizationFormState extends State<_OrganizationForm> {
'Please select industry',
),
const SizedBox(height: 10),
Row(
children: [
Checkbox(
value: _agreed,
onChanged: (val) => setState(() => _agreed = val ?? false),
fillColor: MaterialStateProperty.all(Colors.white),
checkColor: Colors.white,
side: MaterialStateBorderSide.resolveWith(
(states) =>
BorderSide(color: Colors.blueAccent, width: 2),
),
),
const Expanded(
child: Text('I agree to privacy policy & terms')),
],
),
GestureDetector(
onTap: () => setState(() => _agreed = !_agreed),
child: Row(
children: [
Checkbox(
value: _agreed,
onChanged: (val) => setState(() => _agreed = val ?? false),
fillColor: MaterialStateProperty.resolveWith((states) {
if (states.contains(MaterialState.selected)) {
return Colors.blueAccent;
}
return Colors.white;
}),
checkColor: Colors.white,
side: const BorderSide(color: Colors.blueAccent, width: 2),
),
const Expanded(
child: Text('I agree to privacy policy & terms'),
),
],
),
),
const SizedBox(height: 10),
ElevatedButton(
style: ElevatedButton.styleFrom(