mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 11:08:03 +08:00
* opt: sized * fix: self send * feat: ctrl enter to send * opt: checked * opt: download notifier * opt: Future.syncValue * mod: account * mod: loading state * opt: DebounceStreamMixin * opt: report * opt: enum map * opt: file handler * opt: dyn color * opt: Uint8List subview * opt: FileExt * opt: computeLuminance * opt: isNullOrEmpty * opt: Get context * update [skip ci] Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * opt dynamicColor [skip ci] Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * fixes [skip ci] * update Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * update Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> --------- Signed-off-by: My-Responsitories <107370289+My-Responsitories@users.noreply.github.com> Co-authored-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
60 lines
1.6 KiB
Dart
60 lines
1.6 KiB
Dart
import 'package:PiliPlus/utils/platform_utils.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class SearchText extends StatelessWidget {
|
|
final String text;
|
|
final ValueChanged<String>? onTap;
|
|
final ValueChanged<String>? onLongPress;
|
|
final double? fontSize;
|
|
final Color? bgColor;
|
|
final Color? textColor;
|
|
final TextAlign? textAlign;
|
|
final EdgeInsetsGeometry? padding;
|
|
final double? height;
|
|
|
|
const SearchText({
|
|
super.key,
|
|
required this.text,
|
|
this.onTap,
|
|
this.onLongPress,
|
|
this.fontSize,
|
|
this.bgColor,
|
|
this.textColor,
|
|
this.textAlign,
|
|
this.padding,
|
|
this.height,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
late final colorScheme = Theme.of(context).colorScheme;
|
|
final hasLongPress = onLongPress != null;
|
|
return Material(
|
|
color: bgColor ?? colorScheme.onInverseSurface,
|
|
borderRadius: const BorderRadius.all(Radius.circular(6)),
|
|
child: InkWell(
|
|
onTap: () => onTap?.call(text),
|
|
onLongPress: hasLongPress ? () => onLongPress!(text) : null,
|
|
onSecondaryTap: hasLongPress && !PlatformUtils.isMobile
|
|
? () => onLongPress!(text)
|
|
: null,
|
|
borderRadius: const BorderRadius.all(Radius.circular(6)),
|
|
child: Padding(
|
|
padding:
|
|
padding ??
|
|
const EdgeInsets.symmetric(horizontal: 11, vertical: 5),
|
|
child: Text(
|
|
text,
|
|
textAlign: textAlign,
|
|
style: TextStyle(
|
|
fontSize: fontSize,
|
|
height: height,
|
|
color: textColor ?? colorScheme.onSurfaceVariant,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|