Change PIN to 1451

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
ARCHITECT
2026-01-17 23:31:52 +00:00
parent c152cacb90
commit f199daf4ba
171 changed files with 10492 additions and 2 deletions

View File

@@ -0,0 +1,128 @@
import 'package:flutter/material.dart';
class ChatInput extends StatefulWidget {
final Function(String) onSend;
final bool isConnected;
final bool isLoading;
const ChatInput({
super.key,
required this.onSend,
this.isConnected = true,
this.isLoading = false,
});
@override
State<ChatInput> createState() => _ChatInputState();
}
class _ChatInputState extends State<ChatInput> {
final _controller = TextEditingController();
final _focusNode = FocusNode();
bool get _canSend =>
widget.isConnected &&
!widget.isLoading &&
_controller.text.trim().isNotEmpty;
void _send() {
if (!_canSend) return;
final text = _controller.text.trim();
_controller.clear();
widget.onSend(text);
}
@override
void dispose() {
_controller.dispose();
_focusNode.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.only(
left: 12,
right: 12,
top: 8,
bottom: MediaQuery.of(context).padding.bottom + 8,
),
decoration: BoxDecoration(
color: const Color(0xFF1A1A1A),
border: Border(
top: BorderSide(color: Colors.grey.shade800),
),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
// Input field
Expanded(
child: Container(
constraints: const BoxConstraints(maxHeight: 120),
decoration: BoxDecoration(
color: const Color(0xFF2D2D2D),
borderRadius: BorderRadius.circular(24),
border: Border.all(
color: widget.isConnected
? Colors.grey.shade700
: Colors.red.shade700,
),
),
child: TextField(
controller: _controller,
focusNode: _focusNode,
maxLines: null,
textInputAction: TextInputAction.newline,
onChanged: (_) => setState(() {}),
style: const TextStyle(
color: Colors.white,
fontSize: 15,
),
decoration: InputDecoration(
hintText: widget.isConnected
? 'Message Claude...'
: 'Disconnected',
hintStyle: TextStyle(
color: Colors.grey.shade500,
),
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 12,
),
border: InputBorder.none,
),
),
),
),
const SizedBox(width: 8),
// Send button
Container(
decoration: BoxDecoration(
color: _canSend ? Colors.orange.shade700 : Colors.grey.shade800,
shape: BoxShape.circle,
),
child: IconButton(
onPressed: _canSend ? _send : null,
icon: widget.isLoading
? SizedBox(
width: 20,
height: 20,
child: CircularProgressIndicator(
strokeWidth: 2,
color: Colors.grey.shade400,
),
)
: Icon(
Icons.send,
color: _canSend ? Colors.white : Colors.grey.shade600,
),
),
),
],
),
);
}
}

View File

@@ -0,0 +1,84 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_highlight/flutter_highlight.dart';
import 'package:flutter_highlight/themes/atom-one-dark.dart';
class CodeBlock extends StatelessWidget {
final String code;
final String? language;
const CodeBlock({
super.key,
required this.code,
this.language,
});
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.symmetric(vertical: 8),
decoration: BoxDecoration(
color: const Color(0xFF282C34),
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.grey.shade800),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
// Header with language and copy button
Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
decoration: BoxDecoration(
color: Colors.grey.shade900,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
language ?? 'code',
style: TextStyle(
color: Colors.grey.shade500,
fontSize: 12,
),
),
InkWell(
onTap: () {
Clipboard.setData(ClipboardData(text: code));
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Copied to clipboard'),
duration: Duration(seconds: 1),
),
);
},
child: Icon(
Icons.copy,
size: 16,
color: Colors.grey.shade500,
),
),
],
),
),
// Code content
Padding(
padding: const EdgeInsets.all(12),
child: HighlightView(
code,
language: language ?? 'plaintext',
theme: atomOneDarkTheme,
textStyle: const TextStyle(
fontFamily: 'JetBrainsMono',
fontSize: 13,
),
),
),
],
),
);
}
}

View File

@@ -0,0 +1,195 @@
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import '../models/message.dart';
import 'code_block.dart';
import 'tool_use_card.dart';
import 'thinking_indicator.dart';
class MessageBubble extends StatelessWidget {
final Message message;
const MessageBubble({super.key, required this.message});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
child: message.isUser ? _buildUserBubble() : _buildAssistantBubble(),
);
}
Widget _buildUserBubble() {
return Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(width: 48), // Spacing for alignment
Flexible(
child: Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.orange.shade700,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(16),
topRight: Radius.circular(16),
bottomLeft: Radius.circular(16),
bottomRight: Radius.circular(4),
),
),
child: Text(
message.content,
style: const TextStyle(
color: Colors.white,
fontSize: 15,
),
),
),
),
const SizedBox(width: 8),
CircleAvatar(
radius: 16,
backgroundColor: Colors.orange.shade800,
child: const Icon(Icons.person, size: 18, color: Colors.white),
),
],
);
}
Widget _buildAssistantBubble() {
return Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CircleAvatar(
radius: 16,
backgroundColor: const Color(0xFF2D2D2D),
child: Icon(Icons.auto_awesome, size: 18, color: Colors.orange.shade400),
),
const SizedBox(width: 8),
Flexible(
child: Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: const Color(0xFF2D2D2D),
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(4),
topRight: Radius.circular(16),
bottomLeft: Radius.circular(16),
bottomRight: Radius.circular(16),
),
),
child: _buildContent(),
),
),
const SizedBox(width: 48), // Spacing for alignment
],
);
}
Widget _buildContent() {
if (message.isThinking && message.content.isEmpty) {
return const ThinkingIndicator();
}
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Tool uses first
if (message.toolUses != null && message.toolUses!.isNotEmpty)
...message.toolUses!.map((tool) => ToolUseCard(toolUse: tool)),
// Then the text content with Markdown
if (message.content.isNotEmpty)
MarkdownBody(
data: message.content,
selectable: true,
styleSheet: MarkdownStyleSheet(
p: const TextStyle(
color: Colors.white,
fontSize: 15,
height: 1.5,
),
h1: const TextStyle(
color: Colors.white,
fontSize: 22,
fontWeight: FontWeight.bold,
),
h2: const TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.bold,
),
h3: const TextStyle(
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.bold,
),
code: TextStyle(
color: Colors.orange.shade300,
backgroundColor: Colors.black26,
fontFamily: 'JetBrainsMono',
fontSize: 13,
),
codeblockDecoration: BoxDecoration(
color: const Color(0xFF282C34),
borderRadius: BorderRadius.circular(8),
),
blockquote: const TextStyle(
color: Colors.white70,
fontStyle: FontStyle.italic,
),
blockquoteDecoration: BoxDecoration(
border: Border(
left: BorderSide(color: Colors.orange.shade400, width: 3),
),
),
listBullet: const TextStyle(color: Colors.white70),
a: TextStyle(color: Colors.orange.shade300),
),
builders: {
'code': _CodeBlockBuilder(),
},
),
// Streaming indicator
if (message.isStreaming && !message.isThinking)
Padding(
padding: const EdgeInsets.only(top: 8),
child: SizedBox(
width: 12,
height: 12,
child: CircularProgressIndicator(
strokeWidth: 2,
color: Colors.orange.shade400,
),
),
),
],
);
}
}
class _CodeBlockBuilder extends MarkdownElementBuilder {
@override
Widget? visitElementAfter(element, preferredStyle) {
// Check if it's a fenced code block
final content = element.textContent;
String? language;
// Try to detect language from class attribute
if (element.attributes.containsKey('class')) {
final classes = element.attributes['class']!;
if (classes.startsWith('language-')) {
language = classes.substring(9);
}
}
// For inline code, use default style
if (!content.contains('\n') && content.length < 50) {
return null; // Use default styling
}
return CodeBlock(
code: content,
language: language,
);
}
}

View File

@@ -0,0 +1,75 @@
import 'package:flutter/material.dart';
class ThinkingIndicator extends StatefulWidget {
const ThinkingIndicator({super.key});
@override
State<ThinkingIndicator> createState() => _ThinkingIndicatorState();
}
class _ThinkingIndicatorState extends State<ThinkingIndicator>
with SingleTickerProviderStateMixin {
late AnimationController _controller;
@override
void initState() {
super.initState();
_controller = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 1500),
)..repeat();
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
AnimatedBuilder(
animation: _controller,
builder: (context, child) {
return Row(
children: List.generate(3, (index) {
final delay = index * 0.2;
final value = (_controller.value + delay) % 1.0;
final opacity = (value < 0.5 ? value * 2 : 2 - value * 2);
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 2),
child: Opacity(
opacity: 0.3 + opacity * 0.7,
child: Container(
width: 8,
height: 8,
decoration: BoxDecoration(
color: Colors.orange.shade400,
shape: BoxShape.circle,
),
),
),
);
}),
);
},
),
const SizedBox(width: 8),
Text(
'Claude is thinking...',
style: TextStyle(
color: Colors.grey.shade400,
fontSize: 14,
fontStyle: FontStyle.italic,
),
),
],
),
);
}
}

View File

@@ -0,0 +1,165 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import '../models/message.dart';
class ToolUseCard extends StatefulWidget {
final ToolUse toolUse;
const ToolUseCard({super.key, required this.toolUse});
@override
State<ToolUseCard> createState() => _ToolUseCardState();
}
class _ToolUseCardState extends State<ToolUseCard> {
bool _isExpanded = false;
IconData get _toolIcon {
switch (widget.toolUse.tool.toLowerCase()) {
case 'bash':
return Icons.terminal;
case 'read':
return Icons.description;
case 'write':
case 'edit':
return Icons.edit_document;
case 'grep':
case 'glob':
return Icons.search;
default:
return Icons.build;
}
}
String get _inputDisplay {
final input = widget.toolUse.input;
if (input == null) return '';
if (input is String) return input;
if (input is Map) {
// For Bash tool, show command
if (input.containsKey('command')) {
return input['command'];
}
// For Read tool, show file path
if (input.containsKey('file_path')) {
return input['file_path'];
}
// Otherwise show JSON
try {
return const JsonEncoder.withIndent(' ').convert(input);
} catch (_) {
return input.toString();
}
}
return input.toString();
}
@override
Widget build(BuildContext context) {
final hasOutput = widget.toolUse.output != null &&
widget.toolUse.output!.isNotEmpty;
return Container(
margin: const EdgeInsets.symmetric(vertical: 4),
decoration: BoxDecoration(
color: const Color(0xFF2D2D2D),
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.orange.shade700.withOpacity(0.3)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
// Header
InkWell(
onTap: hasOutput
? () => setState(() => _isExpanded = !_isExpanded)
: null,
child: Padding(
padding: const EdgeInsets.all(12),
child: Row(
children: [
Icon(_toolIcon, size: 18, color: Colors.orange.shade400),
const SizedBox(width: 8),
Text(
widget.toolUse.tool,
style: TextStyle(
color: Colors.orange.shade400,
fontWeight: FontWeight.bold,
fontSize: 13,
),
),
const Spacer(),
if (hasOutput)
Icon(
_isExpanded ? Icons.expand_less : Icons.expand_more,
color: Colors.grey.shade500,
size: 20,
),
if (!hasOutput && widget.toolUse.output == null)
SizedBox(
width: 14,
height: 14,
child: CircularProgressIndicator(
strokeWidth: 2,
color: Colors.orange.shade400,
),
),
],
),
),
),
// Input/Command
if (_inputDisplay.isNotEmpty)
Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.2),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'',
style: TextStyle(
color: Colors.green.shade400,
fontFamily: 'JetBrainsMono',
fontSize: 12,
),
),
const SizedBox(width: 8),
Expanded(
child: Text(
_inputDisplay,
style: const TextStyle(
color: Colors.white70,
fontFamily: 'JetBrainsMono',
fontSize: 12,
),
maxLines: 3,
overflow: TextOverflow.ellipsis,
),
),
],
),
),
// Output (collapsible)
if (_isExpanded && hasOutput)
Container(
constraints: const BoxConstraints(maxHeight: 200),
padding: const EdgeInsets.all(12),
child: SingleChildScrollView(
child: Text(
widget.toolUse.output!,
style: const TextStyle(
color: Colors.white60,
fontFamily: 'JetBrainsMono',
fontSize: 11,
),
),
),
),
],
),
);
}
}