Initial commit: Grounded Flutter frontend
A to-do app that doesn't believe you — an enforcement layer rather than a
neutral ledger.
Architecture ported from Autoreceptives/Frontend/Receptive: stacked MVVM with
the mandatory 4-file screen pattern, one ParentViewModel owning the loading /
network / error overlays and the handleError decision tree, one AppDataManager
gateway, dio comms carrying the three identity headers, secure storage with
random-suffixed keys, and a single-chokepoint Navigator. Package root and Dart
package name are both Grounded; org is nya.
The enforcement engine, one unit per formula in utils/:
- DebtEngine w(class) x severity(d) x decay(t), sublinear severity so old
misses cannot swamp the score; abandonment 2x with 30-day
decay immunity; late complete retains 30%
- StandingEngine Good -> Warned -> Grounded -> Lockdown, derived not set;
Grounded replaces home with the overdue queue
- CapacityEngine blocks over-scheduling against p50 of historically completed
minutes, with a learned per-category estimation multiplier
- IntegrityEngine session integrity, weekly volume, plyometric contact ceiling
and enforced recovery gaps
- ExcuseAnalyser on-device excuse clustering plus the confrontation copy
- GuardrailEngine distress detection and rationed amnesty
- ToneEngine all enforcement copy, so the tone cap lives in one place
CommitmentEvent is append-only and is the source of truth rather than the
status field, which is what makes honest history and excuse analysis possible.
Goals contain commitments via parentId, and a task can be run from a
full-screen runner that derives elapsed time from wall-clock so screen-off
cannot lose time. Backgrounding pauses the clock and is counted. The runner is
mirrored into an ongoing notification, with alarm-class full-screen intents
reserved for non-negotiables.
Design language, fonts, icon and native splash are in place; Mason bricks are
retargeted to this project and verified end-to-end.
flutter analyze lib/ reports no errors.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mfu2gQLSFN21YRBcU2NrTt
This commit is contained in:
206
frontend/lib/Grounded/designs/input/InputFields.dart
Normal file
206
frontend/lib/Grounded/designs/input/InputFields.dart
Normal file
@@ -0,0 +1,206 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../../about/internal/application/TextType.dart';
|
||||
import '../../utils/Colors.dart';
|
||||
import '../Component.dart';
|
||||
import '../text/Text.dart';
|
||||
|
||||
/// The standard text field.
|
||||
Widget inputField(
|
||||
String label,
|
||||
TextEditingController controller, {
|
||||
String hint = "",
|
||||
String? Function(String?)? validator,
|
||||
TextInputType keyboard = TextInputType.text,
|
||||
bool obscure = false,
|
||||
int maxLines = 1,
|
||||
List<TextInputFormatter>? formatters,
|
||||
IconData? icon,
|
||||
ValueChanged<String>? onChanged,
|
||||
}) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
text(label.toUpperCase(), 10, TextType.Bold,
|
||||
color: colorGrey2, letterSpacing: 0.8),
|
||||
const SizedBox(height: 8),
|
||||
TextFormField(
|
||||
controller: controller,
|
||||
validator: validator,
|
||||
keyboardType: keyboard,
|
||||
obscureText: obscure,
|
||||
maxLines: obscure ? 1 : maxLines,
|
||||
inputFormatters: formatters,
|
||||
onChanged: onChanged,
|
||||
style: TextStyle(
|
||||
fontFamily: getTextType(TextType.Regular),
|
||||
fontSize: 14,
|
||||
color: colorPrimaryDark,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
hintText: hint,
|
||||
hintStyle: TextStyle(
|
||||
fontFamily: getTextType(TextType.Regular),
|
||||
fontSize: 13,
|
||||
color: colorGrey,
|
||||
),
|
||||
prefixIcon: icon == null
|
||||
? null
|
||||
: Icon(icon, size: 18, color: colorGrey2),
|
||||
filled: true,
|
||||
fillColor: colorWhite,
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 14, vertical: 14),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: colorBorder, width: 1),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: colorPrimaryDark, width: 1.4),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: colorNegative, width: 1),
|
||||
),
|
||||
focusedErrorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: colorNegative, width: 1.4),
|
||||
),
|
||||
errorStyle: TextStyle(
|
||||
fontFamily: getTextType(TextType.Regular),
|
||||
fontSize: 11,
|
||||
color: colorNegative,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/// The excuse field. Deliberately unadorned — no templates, no quick-picks, a
|
||||
/// live character count that shows the minimum, because the friction is the
|
||||
/// feature rather than an obstacle to route around.
|
||||
Widget excuseField(
|
||||
TextEditingController controller,
|
||||
int minimumLength, {
|
||||
String? Function(String?)? validator,
|
||||
ValueChanged<String>? onChanged,
|
||||
}) {
|
||||
final int length = controller.text.trim().length;
|
||||
final bool satisfied = length >= minimumLength;
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
text("WHY", 10, TextType.Bold, color: colorGrey2, letterSpacing: 0.8),
|
||||
text(
|
||||
satisfied ? "$length characters" : "$length / $minimumLength",
|
||||
10,
|
||||
TextType.Bold,
|
||||
color: satisfied ? colorPositive : colorGrey,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
TextFormField(
|
||||
controller: controller,
|
||||
validator: validator,
|
||||
onChanged: onChanged,
|
||||
maxLines: 4,
|
||||
style: TextStyle(
|
||||
fontFamily: getTextType(TextType.Regular),
|
||||
fontSize: 14,
|
||||
color: colorPrimaryDark,
|
||||
height: 1.5,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
hintText: "In your own words. No shortcuts here.",
|
||||
hintStyle: TextStyle(
|
||||
fontFamily: getTextType(TextType.Regular),
|
||||
fontSize: 13,
|
||||
color: colorGrey,
|
||||
),
|
||||
filled: true,
|
||||
fillColor: colorWhite,
|
||||
contentPadding: const EdgeInsets.all(14),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: colorBorder, width: 1),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: colorPrimaryDark, width: 1.4),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: colorNegative, width: 1),
|
||||
),
|
||||
focusedErrorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: colorNegative, width: 1.4),
|
||||
),
|
||||
errorStyle: TextStyle(
|
||||
fontFamily: getTextType(TextType.Regular),
|
||||
fontSize: 11,
|
||||
color: colorNegative,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/// A read-only field that loads its options on tap rather than pre-loading
|
||||
/// them — the ViewModel fetches, then calls back to open the picker.
|
||||
Widget selectField(
|
||||
String label,
|
||||
String value,
|
||||
VoidCallback onTap, {
|
||||
String hint = "Select",
|
||||
IconData icon = Icons.expand_more_rounded,
|
||||
}) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
text(label.toUpperCase(), 10, TextType.Bold,
|
||||
color: colorGrey2, letterSpacing: 0.8),
|
||||
const SizedBox(height: 8),
|
||||
GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: colorWhite,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: colorBorder, width: 1),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: text(
|
||||
value.isEmpty ? hint : value,
|
||||
14,
|
||||
value.isEmpty ? TextType.Regular : TextType.Bold,
|
||||
color: value.isEmpty ? colorGrey : colorPrimaryDark,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
Icon(icon, size: 20, color: colorGrey2),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user