114 lines
3.4 KiB
Dart
114 lines
3.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:shadcn_ui/shadcn_ui.dart';
|
|
|
|
import '../theme/app_text.dart';
|
|
|
|
Future<bool?> showOutboundServiceSheet(
|
|
BuildContext context, {
|
|
String title = '即将打开外部服务',
|
|
String description = '你将离开金值,进入第三方服务页面。外部内容由对应服务提供。\n价格与资讯仅供参考,不构成投资建议。',
|
|
String cancelLabel = '取消',
|
|
String confirmLabel = '继续前往',
|
|
}) {
|
|
return showModalBottomSheet<bool>(
|
|
context: context,
|
|
isScrollControlled: true,
|
|
isDismissible: true,
|
|
enableDrag: true,
|
|
backgroundColor: Colors.transparent,
|
|
barrierColor: Colors.black.withValues(alpha: 0.45),
|
|
builder: (_) => OutboundServiceSheet(
|
|
title: title,
|
|
description: description,
|
|
cancelLabel: cancelLabel,
|
|
confirmLabel: confirmLabel,
|
|
),
|
|
);
|
|
}
|
|
|
|
class OutboundServiceSheet extends StatelessWidget {
|
|
const OutboundServiceSheet({
|
|
super.key,
|
|
this.title = '即将打开外部服务',
|
|
this.description = '你将离开金值,进入第三方服务页面。外部内容由对应服务提供。\n价格与资讯仅供参考,不构成投资建议。',
|
|
this.cancelLabel = '取消',
|
|
this.confirmLabel = '继续前往',
|
|
});
|
|
|
|
final String title;
|
|
final String description;
|
|
final String cancelLabel;
|
|
final String confirmLabel;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final cs = ShadTheme.of(context).colorScheme;
|
|
final bottomInset = MediaQuery.viewPaddingOf(context).bottom;
|
|
return Container(
|
|
width: double.infinity,
|
|
decoration: BoxDecoration(
|
|
color: cs.background,
|
|
borderRadius: const BorderRadius.only(
|
|
topLeft: Radius.circular(24),
|
|
topRight: Radius.circular(24),
|
|
),
|
|
border: Border.all(color: cs.border),
|
|
),
|
|
padding: EdgeInsets.fromLTRB(22, 12, 22, 22 + bottomInset),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Center(
|
|
child: Container(
|
|
width: 70,
|
|
height: 5,
|
|
decoration: BoxDecoration(
|
|
color: cs.border,
|
|
borderRadius: BorderRadius.circular(999),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 26),
|
|
Text(
|
|
title,
|
|
style: TextStyle(
|
|
fontSize: 22,
|
|
fontWeight: FontWeight.w700,
|
|
color: cs.foreground,
|
|
),
|
|
),
|
|
const SizedBox(height: 12),
|
|
Text(
|
|
description,
|
|
style: AppText.body.copyWith(
|
|
fontSize: 14,
|
|
height: 1.65,
|
|
color: cs.mutedForeground,
|
|
),
|
|
),
|
|
const SizedBox(height: 24),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: ShadButton.outline(
|
|
foregroundColor: cs.foreground,
|
|
onPressed: () => Navigator.of(context).pop(false),
|
|
child: Text(cancelLabel),
|
|
),
|
|
),
|
|
const SizedBox(width: 12),
|
|
Expanded(
|
|
child: ShadButton(
|
|
onPressed: () => Navigator.of(context).pop(true),
|
|
child: Text(confirmLabel),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|