summaryrefslogtreecommitdiff
path: root/lib/widgets/common/basic/link_chip.dart
diff options
context:
space:
mode:
authormirror <mirror@localhost>2026-11-22 08:41:00 +0900
committermirror <mirror@localhost>2026-11-22 08:41:00 +0900
commit449d8b74bd6d9dae98a07254cdfad677b920e7b0 (patch)
treec131c3528c4d517f56e19b854a7453fedb097d40 /lib/widgets/common/basic/link_chip.dart
downloadaves-src-master.tar.gz
aves-src-master.zip
snapshot of aves v1.13.12 (secrets removed: android/app/google-services.json)HEADv1.13.12master
Diffstat (limited to 'lib/widgets/common/basic/link_chip.dart')
-rw-r--r--lib/widgets/common/basic/link_chip.dart63
1 files changed, 63 insertions, 0 deletions
diff --git a/lib/widgets/common/basic/link_chip.dart b/lib/widgets/common/basic/link_chip.dart
new file mode 100644
index 0000000..53ddc65
--- /dev/null
+++ b/lib/widgets/common/basic/link_chip.dart
@@ -0,0 +1,63 @@
+import 'package:aves/theme/icons.dart';
+import 'package:aves/widgets/aves_app.dart';
+import 'package:flutter/material.dart';
+
+class LinkChip extends StatelessWidget {
+ final Widget? leading;
+ final String text;
+ final String? urlString;
+ final Color? color;
+ final TextStyle? textStyle;
+ final VoidCallback? onTap;
+
+ static const borderRadius = BorderRadius.all(Radius.circular(8));
+
+ const LinkChip({
+ super.key,
+ this.leading,
+ required this.text,
+ this.urlString,
+ this.color,
+ this.textStyle,
+ this.onTap,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ return DefaultTextStyle.merge(
+ style: (textStyle ?? const TextStyle()).copyWith(color: color),
+ child: InkWell(
+ borderRadius: borderRadius,
+ onTap: onTap ?? () => AvesApp.launchUrl(urlString),
+ child: Padding(
+ padding: const EdgeInsets.all(8),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ if (leading != null) ...[
+ leading!,
+ const SizedBox(width: 8),
+ ],
+ Flexible(
+ child: Text(
+ text,
+ softWrap: false,
+ overflow: TextOverflow.fade,
+ maxLines: 1,
+ ),
+ ),
+ const SizedBox(width: 8),
+ Builder(
+ builder: (context) => Icon(
+ AIcons.openOutside,
+ size: DefaultTextStyle.of(context).style.fontSize,
+ color: color,
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+}