95 lines
2.8 KiB
Dart
95 lines
2.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../../core/theme/tokens.dart';
|
|
import '../../../core/i18n/app_locale.dart';
|
|
|
|
/// iOS 식 하단 시트 한 줄.
|
|
class ActionSheetItem {
|
|
const ActionSheetItem(this.label, this.onTap, {this.destructive = true});
|
|
final String label;
|
|
final VoidCallback onTap;
|
|
|
|
/// 시안의 신고 · 숨기기는 모두 #ff203b.
|
|
final bool destructive;
|
|
}
|
|
|
|
/// 시안 `Frame 1984081055` — #2c2c2e r16 묶음(줄 58, 사이선 #6a6864) + 취소 줄 54,
|
|
/// 42dot Sans 20/500. 파괴 동작 #ff203b, 취소 #1895ff.
|
|
Future<void> showActionSheet(
|
|
BuildContext context,
|
|
List<ActionSheetItem> items,
|
|
) {
|
|
TextStyle style(Color c) => TextStyle(
|
|
fontFamily: AppFonts.body,
|
|
fontSize: 20,
|
|
fontWeight: FontWeight.w500,
|
|
height: 1.3,
|
|
letterSpacing: -0.5,
|
|
color: c,
|
|
);
|
|
Widget cell(String label, Color color, double height, VoidCallback onTap) =>
|
|
InkWell(
|
|
onTap: onTap,
|
|
child: SizedBox(
|
|
height: height,
|
|
width: double.infinity,
|
|
child: Center(child: Text(label, style: style(color))),
|
|
),
|
|
);
|
|
return showModalBottomSheet<void>(
|
|
context: context,
|
|
backgroundColor: Colors.transparent,
|
|
barrierColor: Colors.black.withValues(alpha: 0.6),
|
|
builder: (sheet) => SafeArea(
|
|
child: Padding(
|
|
padding: const EdgeInsets.fromLTRB(8, 0, 8, 0),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Material(
|
|
color: AppColors.cosmicSheet,
|
|
borderRadius: BorderRadius.circular(16),
|
|
clipBehavior: Clip.antiAlias,
|
|
child: Column(
|
|
children: [
|
|
for (final (i, item) in items.indexed) ...[
|
|
if (i > 0)
|
|
const Divider(
|
|
height: 1,
|
|
thickness: 1,
|
|
color: Color(0xFF6A6864),
|
|
),
|
|
cell(
|
|
item.label,
|
|
item.destructive
|
|
? const Color(0xFFFF203B)
|
|
: AppColors.onCosmic,
|
|
58,
|
|
() {
|
|
Navigator.of(sheet).pop();
|
|
item.onTap();
|
|
},
|
|
),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Material(
|
|
color: AppColors.cosmicSheet,
|
|
borderRadius: BorderRadius.circular(16),
|
|
clipBehavior: Clip.antiAlias,
|
|
child: cell(
|
|
context.l10n.commonCancel,
|
|
const Color(0xFF1895FF),
|
|
54,
|
|
() => Navigator.of(sheet).pop(),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|