feat(divination): 为解卦结果的断卦要点添加复制按钮
This commit is contained in:
@@ -547,6 +547,7 @@ class _FocusPointsCard extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final colors = Theme.of(context).colorScheme;
|
final colors = Theme.of(context).colorScheme;
|
||||||
|
final l10n = AppLocalizations.of(context)!;
|
||||||
final languageCode = Localizations.localeOf(context).languageCode;
|
final languageCode = Localizations.localeOf(context).languageCode;
|
||||||
final title = languageCode == 'en' ? 'Focus Points' : '断卦要点';
|
final title = languageCode == 'en' ? 'Focus Points' : '断卦要点';
|
||||||
if (points.isEmpty) {
|
if (points.isEmpty) {
|
||||||
@@ -563,6 +564,8 @@ class _FocusPointsCard extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.all(AppSpacing.lg),
|
padding: const EdgeInsets.all(AppSpacing.lg),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
title,
|
title,
|
||||||
@@ -571,6 +574,25 @@ class _FocusPointsCard extends StatelessWidget {
|
|||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const Spacer(),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
final content = points
|
||||||
|
.asMap()
|
||||||
|
.entries
|
||||||
|
.map((e) => '${e.key + 1}. ${e.value}')
|
||||||
|
.join('\n');
|
||||||
|
Clipboard.setData(ClipboardData(text: content));
|
||||||
|
Toast.show(
|
||||||
|
context,
|
||||||
|
l10n.toastContentCopiedWithTitle(title),
|
||||||
|
type: ToastType.success,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Text(l10n.resultCopy),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
const SizedBox(height: AppSpacing.sm),
|
const SizedBox(height: AppSpacing.sm),
|
||||||
...List<Widget>.generate(points.length, (index) {
|
...List<Widget>.generate(points.length, (index) {
|
||||||
return Padding(
|
return Padding(
|
||||||
|
|||||||
Reference in New Issue
Block a user