You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
2.8 KiB
Dart
89 lines
2.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:mc_common_app/extensions/int_extensions.dart';
|
|
import 'package:mc_common_app/extensions/string_extensions.dart';
|
|
import 'package:mc_common_app/theme/colors.dart';
|
|
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
|
|
|
|
class CheckBoxWithTitleDescription extends StatelessWidget {
|
|
final bool isSelected;
|
|
final String title, description;
|
|
final Function(bool) onSelection;
|
|
|
|
const CheckBoxWithTitleDescription({required this.isSelected, required this.title, required this.description, required this.onSelection, Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SizedBox(
|
|
width: double.infinity,
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
Checkbox(
|
|
value: isSelected,
|
|
onChanged: (bool? v) {
|
|
onSelection(v ?? false);
|
|
},
|
|
),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
title.toText(fontSize: 14, isBold: true),
|
|
description.toText(fontSize: 12, color: MyColors.lightTextColor),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class CircleCheckBoxWithTitle extends StatelessWidget {
|
|
final bool isChecked;
|
|
final String title;
|
|
final Function() onSelected;
|
|
final Color selectedColor;
|
|
|
|
const CircleCheckBoxWithTitle({super.key, required this.title, required this.isChecked, required this.onSelected, required this.selectedColor});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SizedBox(
|
|
width: double.infinity,
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
Container(
|
|
height: 20,
|
|
width: 20,
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
color: isChecked ? selectedColor : Colors.transparent,
|
|
border: Border.all(
|
|
color: isChecked ? Colors.transparent : MyColors.darkTextColor,
|
|
),
|
|
),
|
|
child: const Center(child: Icon(Icons.check_rounded, size: 16, color: MyColors.white)),
|
|
),
|
|
5.width,
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
title.toText(fontSize: 14, isBold: false),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
).onPress((){
|
|
onSelected();
|
|
}),
|
|
);
|
|
}
|
|
}
|