2022-07-17 17:08:51 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
class SearchTitle extends StatelessWidget {
|
|
|
|
final String title;
|
|
|
|
final Widget icon;
|
|
|
|
final Widget? trailing;
|
|
|
|
final void Function()? onTap;
|
2022-08-30 20:24:36 +02:00
|
|
|
final Color? color;
|
2022-07-17 17:08:51 +02:00
|
|
|
|
|
|
|
const SearchTitle({
|
|
|
|
required this.title,
|
|
|
|
required this.icon,
|
|
|
|
this.trailing,
|
|
|
|
this.onTap,
|
2022-08-30 20:24:36 +02:00
|
|
|
this.color,
|
2022-07-17 17:08:51 +02:00
|
|
|
Key? key,
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) => Material(
|
|
|
|
shape: Border(
|
|
|
|
top: BorderSide(
|
|
|
|
color: Theme.of(context).dividerColor,
|
|
|
|
width: 1,
|
|
|
|
),
|
|
|
|
bottom: BorderSide(
|
|
|
|
color: Theme.of(context).dividerColor,
|
|
|
|
width: 1,
|
|
|
|
),
|
|
|
|
),
|
2022-08-30 20:24:36 +02:00
|
|
|
color: color ?? Theme.of(context).colorScheme.surface,
|
2022-07-17 17:08:51 +02:00
|
|
|
child: InkWell(
|
|
|
|
onTap: onTap,
|
|
|
|
splashColor: Theme.of(context).colorScheme.surface,
|
|
|
|
child: Align(
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
horizontal: 16,
|
|
|
|
vertical: 8,
|
|
|
|
),
|
|
|
|
child: IconTheme(
|
|
|
|
data: Theme.of(context).iconTheme.copyWith(size: 16),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
icon,
|
|
|
|
const SizedBox(width: 16),
|
|
|
|
Text(title,
|
|
|
|
textAlign: TextAlign.left,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Theme.of(context).colorScheme.onSurface,
|
|
|
|
fontSize: 12,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
)),
|
|
|
|
if (trailing != null)
|
|
|
|
Expanded(
|
|
|
|
child: Align(
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
child: trailing!,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|