53 lines
1.3 KiB
Dart
53 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class SearchText extends StatelessWidget {
|
|
final String? searchText;
|
|
final Function? onSelect;
|
|
final int? searchTextIdx;
|
|
final Function? onLongSelect;
|
|
final bool isSelect;
|
|
const SearchText({
|
|
super.key,
|
|
this.searchText,
|
|
this.onSelect,
|
|
this.searchTextIdx,
|
|
this.onLongSelect,
|
|
this.isSelect = false,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Material(
|
|
color: Theme.of(context)
|
|
.colorScheme
|
|
.surfaceContainerHighest
|
|
.withOpacity(0.5),
|
|
borderRadius: BorderRadius.circular(6),
|
|
child: Padding(
|
|
padding: EdgeInsets.zero,
|
|
child: InkWell(
|
|
onTap: () {
|
|
onSelect!(searchText);
|
|
},
|
|
onLongPress: () {
|
|
onLongSelect!(searchText);
|
|
},
|
|
borderRadius: BorderRadius.circular(6),
|
|
child: Padding(
|
|
padding:
|
|
const EdgeInsets.only(top: 5, bottom: 5, left: 11, right: 11),
|
|
child: Text(
|
|
searchText!,
|
|
style: TextStyle(
|
|
color: isSelect
|
|
? Theme.of(context).colorScheme.primary
|
|
: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|