- Add devbox.json pinning Flutter 3.35.7, Android SDK (Nix flake), openjdk17, just, openssl - Add android/nix-android-sdk/ Nix flake + flake.lock + Android Studio config script - Add justfile with build/get/upgrade/icons/analyze/rebuild recipes - flutter pub upgrade --major-versions: file_picker ^11, google_fonts ^8, permission_handler ^12, share_plus ^12, flutter_lints ^6 (+71 transitive) - Fix file_picker v11 API: FilePicker.platform → FilePicker.getDirectoryPath() - Fix all 37 analyzer issues: deprecated APIs (window, WillPopScope, Share, SvgPicture color), async BuildContext guards, key constructors, private createState() return types, unused locals, print → debugPrint, etc. - Hook _handleCommand into onSubmitted for : prefix commands - Android: Gradle 8.3→8.11.1, AGP 8.2.2→8.9.1, KGP 1.8.22→2.2.20, compileSdk/targetSdk 34→36, namespace auto-derivation for library modules, kotlin.compiler.execution.strategy=in-process Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
72 lines
1.9 KiB
Dart
Executable file
72 lines
1.9 KiB
Dart
Executable file
import 'package:flutter/material.dart';
|
|
import 'package:flutter_code_editor/flutter_code_editor.dart';
|
|
|
|
class WrappedCodeField extends StatefulWidget {
|
|
final CodeController controller;
|
|
final bool expands;
|
|
final bool wrap;
|
|
final TextStyle? textStyle;
|
|
final Color? cursorColor;
|
|
final EdgeInsets padding;
|
|
final bool readOnly;
|
|
final FocusNode? focusNode;
|
|
|
|
const WrappedCodeField({
|
|
super.key,
|
|
required this.controller,
|
|
this.expands = false,
|
|
this.wrap = true, // ✅ Enable wrapping by default
|
|
this.textStyle,
|
|
this.cursorColor,
|
|
this.padding = EdgeInsets.zero,
|
|
this.readOnly = false,
|
|
this.focusNode,
|
|
});
|
|
|
|
@override
|
|
State<WrappedCodeField> createState() => _WrappedCodeFieldState();
|
|
}
|
|
|
|
class _WrappedCodeFieldState extends State<WrappedCodeField> {
|
|
late FocusNode _focusNode;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_focusNode = widget.focusNode ?? FocusNode();
|
|
_focusNode.attach(context, onKeyEvent: _onKeyEvent);
|
|
}
|
|
|
|
KeyEventResult _onKeyEvent(FocusNode node, KeyEvent event) {
|
|
return widget.controller.onKey(event);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_focusNode.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
padding: widget.padding,
|
|
child: TextField(
|
|
focusNode: _focusNode,
|
|
controller: widget.controller,
|
|
expands: widget.expands,
|
|
minLines: widget.expands ? null : 1,
|
|
maxLines: widget.expands ? null : null, // Allows text to grow dynamically
|
|
scrollPhysics: widget.wrap ? const NeverScrollableScrollPhysics() : null,
|
|
style: widget.textStyle ?? const TextStyle(fontSize: 16),
|
|
cursorColor: widget.cursorColor ?? Colors.white,
|
|
decoration: const InputDecoration(
|
|
isCollapsed: true,
|
|
border: InputBorder.none,
|
|
contentPadding: EdgeInsets.symmetric(vertical: 16),
|
|
),
|
|
readOnly: widget.readOnly,
|
|
),
|
|
);
|
|
}
|
|
}
|