Files
zh-chat-flutter/lib/views/home/widgets/action_item.dart
2022-10-20 14:21:39 +08:00

77 lines
2.0 KiB
Dart

import 'package:chat/configs/app_colors.dart';
import 'package:flutter/material.dart';
class ActionItem extends StatelessWidget {
final String title;
final String? extend;
final Widget? rightWidget;
final String? bottom;
final VoidCallback? onTap;
const ActionItem(
this.title, {
this.extend,
this.rightWidget,
this.bottom,
this.onTap,
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
onTap?.call();
},
child: Container(
color: AppColors.white,
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
title,
style: const TextStyle(
fontSize: 16,
),
),
Expanded(child: Container()),
if (extend != null)
Text(
extend!,
style: const TextStyle(
color: AppColors.unactive,
),
),
rightWidget ??
const Icon(
Icons.arrow_forward_ios,
size: 16,
color: AppColors.unactive,
),
],
),
if (bottom != null && bottom!.isNotEmpty)
Padding(
padding: const EdgeInsets.only(top: 4),
child: Text(
bottom!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle(
color: AppColors.unactive,
fontSize: 12,
),
),
),
],
),
),
);
}
}