12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- import 'package:flutter/material.dart';
- import 'package:vitalapp/consts/styles.dart';
- class ExamCardRadioSelect extends StatelessWidget {
- const ExamCardRadioSelect({
- super.key,
- this.title,
- required this.content,
- this.clickCard,
- this.titleText,
- this.topPadding = 20,
- this.required,
- });
- final String? title;
- final Widget content;
- final Widget? titleText;
- final Function? clickCard;
- final double topPadding;
- final bool? required;
- @override
- Widget build(BuildContext context) {
- return Card(
- elevation: 6,
- shape: RoundedRectangleBorder(
- borderRadius: GlobalStyles.borderRadius,
- ),
- child: Material(
- color: Colors.white,
- borderRadius: GlobalStyles.borderRadius,
- child: InkWell(
- borderRadius: GlobalStyles.borderRadius,
- onTap: clickCard != null ? () => clickCard!.call() : null,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- _buildTitle(),
- content,
- ],
- ),
- ),
- ),
- );
- }
- Widget _buildTitle() {
- Widget titleContent = const SizedBox();
- if (title?.isNotEmpty ?? false) {
- titleContent = RichText(
- text: TextSpan(
- text: '',
- children: [
- if (required ?? false)
- TextSpan(
- text: "* ",
- style: const TextStyle(color: Colors.red, fontSize: 35),
- ),
- TextSpan(
- text: title ?? '',
- style: TextStyle(
- fontSize: 24,
- color: Colors.black,
- fontFamily: "NotoSansSC",
- fontFamilyFallback: const ["NotoSansSC"],
- ),
- ),
- ],
- ),
- );
- }
- return titleText ??
- Container(
- padding: EdgeInsets.only(
- top: topPadding,
- left: 30,
- bottom: 15,
- ),
- child: titleContent,
- );
- }
- }
|