mirror of
https://github.com/foss42/apidash.git
synced 2025-05-31 14:23:45 +08:00
Merge branch 'main' into form_data_imp
This commit is contained in:
41
lib/widgets/checkbox.dart
Normal file
41
lib/widgets/checkbox.dart
Normal file
@ -0,0 +1,41 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CheckBox extends StatelessWidget {
|
||||
final String keyId;
|
||||
final bool value;
|
||||
final ValueChanged<bool?> onChanged;
|
||||
final ColorScheme? colorScheme;
|
||||
const CheckBox({
|
||||
super.key,
|
||||
required this.keyId,
|
||||
required this.value,
|
||||
required this.onChanged,
|
||||
this.colorScheme,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var colorScheme = this.colorScheme ?? Theme.of(context).colorScheme;
|
||||
return Checkbox(
|
||||
key: Key(keyId),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(3),
|
||||
),
|
||||
side: BorderSide(
|
||||
color: colorScheme.surfaceVariant,
|
||||
width: 1.5,
|
||||
),
|
||||
splashRadius: 0,
|
||||
value: value,
|
||||
onChanged: onChanged,
|
||||
checkColor: colorScheme.onPrimary,
|
||||
fillColor: MaterialStateProperty.resolveWith<Color?>(
|
||||
(Set<MaterialState> states) {
|
||||
if (states.contains(MaterialState.selected)) {
|
||||
return colorScheme.primary;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
));
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
export 'buttons.dart';
|
||||
export 'cards.dart';
|
||||
export 'checkbox.dart';
|
||||
export 'code_previewer.dart';
|
||||
export 'codegen_previewer.dart';
|
||||
export 'dropdowns.dart';
|
||||
|
Reference in New Issue
Block a user