-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathdevtools_tab.dart
More file actions
92 lines (80 loc) · 2.46 KB
/
devtools_tab.dart
File metadata and controls
92 lines (80 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import 'package:flex_tabs/flex_tabs.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:fluent_ui/fluent_ui.dart';
import 'package:terminal_studio/src/core/state/database.dart';
import 'package:terminal_studio/src/ui/tabs/playground.dart';
import 'package:xterm/xterm.dart';
class DevToolsTab extends TabItem {
DevToolsTab() {
title.value = const Text('DevTools');
content.value = DevToolsTabView(this);
}
final terminal = Terminal();
}
class DevToolsTabView extends ConsumerStatefulWidget {
const DevToolsTabView(this.tab, {super.key});
final DevToolsTab tab;
@override
ConsumerState<ConsumerStatefulWidget> createState() =>
_DevToolsTabViewState();
}
class _DevToolsTabViewState extends ConsumerState<DevToolsTabView> {
DevToolsTab get tab => widget.tab;
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(
child: Container(
constraints: const BoxConstraints.expand(),
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Wrap(
spacing: 8,
children: [
Button(
onPressed: _openAddHostTab,
child: const Text('Add SSH host'),
),
Button(
onPressed: _clearHosts,
child: const Text('Clear SSH hosts'),
),
Button(
onPressed: () => tab.replace(PlaygroundTab()),
child: const Text('Playground'),
),
],
),
const SizedBox(height: 16),
Expanded(
child: TerminalView(tab.terminal),
),
// const PlayGround(),
],
),
),
);
}
void _openAddHostTab() {
// ref.openTab(AddHostTab());
}
void _clearHosts() async {
final sshHosts = await ref.read(sshHostBoxProvider.future);
await sshHosts.clear();
tab.terminal.write('Cleared SSH hosts\r\n');
}
}
class PlayGround extends ConsumerWidget {
const PlayGround({Key? key}) : super(key: key);
@override
Widget build(BuildContext context, WidgetRef ref) {
return Container(
constraints: const BoxConstraints(maxWidth: 500),
padding: const EdgeInsets.all(16),
color: const Color.fromARGB(255, 251, 251, 251),
// child:
);
}
}