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.
61 lines
1.7 KiB
Dart
61 lines
1.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:fluffychat/config/app_config.dart';
|
|
import '../../../widgets/matrix.dart';
|
|
import '../../utils/bot_style.dart';
|
|
import '../common/bot_face_svg.dart';
|
|
|
|
class CardHeader extends StatelessWidget {
|
|
const CardHeader({
|
|
super.key,
|
|
required this.text,
|
|
required this.botExpression,
|
|
this.onClose,
|
|
});
|
|
|
|
final BotExpression botExpression;
|
|
final String text;
|
|
final void Function()? onClose;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: const EdgeInsets.only(bottom: 5.0),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.only(top: 3.0),
|
|
child: BotFace(
|
|
width: 50.0,
|
|
expression: botExpression,
|
|
),
|
|
),
|
|
const SizedBox(width: 5.0),
|
|
Expanded(
|
|
child: Text(
|
|
text,
|
|
style: BotStyle.text(context),
|
|
textAlign: TextAlign.left,
|
|
),
|
|
),
|
|
CircleAvatar(
|
|
backgroundColor: AppConfig.primaryColor.withOpacity(0.1),
|
|
child: IconButton(
|
|
icon: const Icon(Icons.close_outlined),
|
|
onPressed: () {
|
|
if (onClose != null) onClose!();
|
|
MatrixState.pAnyState.closeOverlay();
|
|
},
|
|
color: Theme.of(context).brightness == Brightness.dark
|
|
? AppConfig.primaryColorLight
|
|
: AppConfig.primaryColor,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|