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( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4), 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, checkColor: contentTheme.onPrimary,
visualDensity: getCompactDensity, visualDensity: getCompactDensity,
materialTapTargetSize: materialTapTargetSize:

View File

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