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:
7
frontend/lib/Grounded/see/splash/ConnectSplash.dart
Normal file
7
frontend/lib/Grounded/see/splash/ConnectSplash.dart
Normal file
@@ -0,0 +1,7 @@
|
||||
import '../../about/internal/application/MeDescription.dart';
|
||||
|
||||
abstract class ConnectSplash {
|
||||
void launchHome(MeDescription value);
|
||||
|
||||
void launchLogin();
|
||||
}
|
||||
10
frontend/lib/Grounded/see/splash/Splash.dart
Normal file
10
frontend/lib/Grounded/see/splash/Splash.dart
Normal file
@@ -0,0 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'SplashState.dart';
|
||||
|
||||
class Splash extends StatefulWidget {
|
||||
const Splash({super.key});
|
||||
|
||||
@override
|
||||
State<Splash> createState() => SplashState();
|
||||
}
|
||||
124
frontend/lib/Grounded/see/splash/SplashState.dart
Normal file
124
frontend/lib/Grounded/see/splash/SplashState.dart
Normal file
@@ -0,0 +1,124 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
import '../../about/internal/application/MeDescription.dart';
|
||||
import '../../about/internal/application/NavigatorType.dart';
|
||||
import '../../about/internal/application/TextType.dart';
|
||||
import '../../configs/Navigator.dart';
|
||||
import '../../designs/Responsive.dart';
|
||||
import '../../designs/text/Text.dart';
|
||||
import '../../utils/Colors.dart';
|
||||
import '../../utils/Images.dart';
|
||||
import '../home/Home.dart';
|
||||
import '../login/Login.dart';
|
||||
import 'ConnectSplash.dart';
|
||||
import 'Splash.dart';
|
||||
import 'ViewSplash.dart';
|
||||
|
||||
class SplashState extends State<Splash> implements ConnectSplash {
|
||||
ViewSplash? _model;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<ViewSplash>.reactive(
|
||||
viewModelBuilder: () => ViewSplash(context, this),
|
||||
onViewModelReady: (viewModel) {
|
||||
_model = viewModel;
|
||||
_initiate();
|
||||
},
|
||||
builder: (context, viewModel, child) => PopScope(
|
||||
canPop: false,
|
||||
child: Scaffold(
|
||||
backgroundColor: colorPrimaryDark,
|
||||
body: LayoutBuilder(
|
||||
builder: (BuildContext context, BoxConstraints constraints) {
|
||||
return Responsive(
|
||||
mobile: _mobileView(constraints),
|
||||
tablet: _mobileView(constraints),
|
||||
desktop: _mobileView(constraints),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _initiate() async {
|
||||
// A beat on the wordmark, then the session decides where we land.
|
||||
await Future.delayed(const Duration(milliseconds: 900));
|
||||
_model?.initialize();
|
||||
}
|
||||
|
||||
Widget _mobileView(BoxConstraints constraints) {
|
||||
return SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 28, vertical: 36),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
text("GROUNDED", 10, TextType.Bold,
|
||||
color: colorWhite.withValues(alpha: 0.45), letterSpacing: 2.0),
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// The same mark the native splash shows, so the handover from
|
||||
// the OS screen into the app is invisible.
|
||||
Image.asset(
|
||||
splashMark,
|
||||
width: 108,
|
||||
height: 108,
|
||||
errorBuilder: (context, error, stackTrace) =>
|
||||
const SizedBox(height: 108),
|
||||
),
|
||||
const SizedBox(height: 28),
|
||||
text("Grounded", 52, TextType.Light,
|
||||
color: colorWhite, height: 1.05),
|
||||
const SizedBox(height: 16),
|
||||
Container(
|
||||
width: 44,
|
||||
height: 2,
|
||||
color: colorWhite.withValues(alpha: 0.30),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
text(
|
||||
"A to-do app that does not believe you.",
|
||||
15,
|
||||
TextType.Regular,
|
||||
color: colorWhite.withValues(alpha: 0.60),
|
||||
height: 1.5,
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: 22,
|
||||
height: 22,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
backgroundColor: colorWhite.withValues(alpha: 0.12),
|
||||
color: colorWhite.withValues(alpha: 0.70),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void launchHome(MeDescription value) {
|
||||
GroundedNavigation()
|
||||
.navigateToPage(NavigatorType.makeNewMain, const Home(), context);
|
||||
}
|
||||
|
||||
@override
|
||||
void launchLogin() {
|
||||
GroundedNavigation()
|
||||
.navigateToPage(NavigatorType.makeNewMain, const Login(), context);
|
||||
}
|
||||
}
|
||||
29
frontend/lib/Grounded/see/splash/ViewSplash.dart
Normal file
29
frontend/lib/Grounded/see/splash/ViewSplash.dart
Normal file
@@ -0,0 +1,29 @@
|
||||
import '../parent/ParentViewModel.dart';
|
||||
import 'ConnectSplash.dart';
|
||||
|
||||
class ViewSplash extends ParentViewModel {
|
||||
ConnectSplash connection;
|
||||
|
||||
ViewSplash(super.context, this.connection);
|
||||
|
||||
void initialize() {
|
||||
// App opens feed the distress conjunction, so the count is bumped before
|
||||
// anything else happens.
|
||||
_recordEngagement();
|
||||
|
||||
getDataManager().getMyDescription().then((value) {
|
||||
if (value.token != "") {
|
||||
connection.launchHome(value);
|
||||
} else {
|
||||
connection.launchLogin();
|
||||
}
|
||||
}).onError((error, stackTrace) {
|
||||
connection.launchLogin();
|
||||
});
|
||||
}
|
||||
|
||||
void _recordEngagement() async {
|
||||
final int count = await getDataManager().getEngagementCount();
|
||||
await getDataManager().setEngagementCount(count + 1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user