Add app source and tests
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
70
lib/Peach/designs/OutputSheet.dart
Normal file
70
lib/Peach/designs/OutputSheet.dart
Normal file
@@ -0,0 +1,70 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../about/internal/application/TextType.dart';
|
||||
import '../utils/Colors.dart';
|
||||
import 'text/Text.dart';
|
||||
|
||||
/// A scrollable, copyable console sheet for one-shot command output — docker
|
||||
/// logs, a kafka describe, a redis value. Raised from a screen rather than
|
||||
/// pushed, because the output is a peek, not a destination.
|
||||
void showOutputSheet(BuildContext context, String title, String output) {
|
||||
final jp = context.jp;
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
backgroundColor: jp.surface,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
|
||||
),
|
||||
builder: (sheetContext) => SizedBox(
|
||||
height: MediaQuery.of(sheetContext).size.height * 0.7,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(child: text(title, 16, TextType.Bold, color: jp.text)),
|
||||
IconButton(
|
||||
tooltip: 'Copy',
|
||||
onPressed: () {
|
||||
Clipboard.setData(ClipboardData(text: output));
|
||||
ScaffoldMessenger.of(
|
||||
sheetContext,
|
||||
).showSnackBar(const SnackBar(content: Text('Copied.')));
|
||||
},
|
||||
icon: const Icon(Icons.copy_all, size: 18),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: jp.consoleBg,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: ConsoleColors.frame),
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: SelectableText(
|
||||
output,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'monospace',
|
||||
fontSize: 12.5,
|
||||
height: 1.4,
|
||||
color: ConsoleColors.body,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user