Add app source and tests

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
alvocool
2026-10-11 10:15:30 +03:00
parent 7e246255c2
commit 38881d1fe1
135 changed files with 21057 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
import 'package:flutter/material.dart';
import 'package:page_transition/page_transition.dart';
import '../about/internal/application/NavigatorType.dart';
/// Every screen transition in the app funnels through here. Destinations are
/// widget instances, not route names — there is no route table. Keeping one
/// choke point means a guard (session, device, connectivity) can be applied to
/// all routing by editing a single method.
class PeachNavigation {
void navigateToPage(NavigatorType type, dynamic path, BuildContext context) {
_runSec(context, type, path);
}
Future _runSec(BuildContext context, NavigatorType type, dynamic path) async {
switch (type) {
case NavigatorType.openFully:
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (BuildContext context) => path),
);
break;
case NavigatorType.justOpen:
Navigator.push(
context,
PageTransition(
type: PageTransitionType.size,
alignment: Alignment.center,
opaque: true,
child: path,
),
);
break;
case NavigatorType.replaceCurrent:
Navigator.pushReplacement(
context,
PageTransition(
type: PageTransitionType.scale,
alignment: Alignment.center,
opaque: true,
curve: Curves.ease,
duration: const Duration(microseconds: 9000),
child: path,
),
);
break;
case NavigatorType.makeNewMain:
Navigator.pushAndRemoveUntil(
context,
PageTransition(
type: PageTransitionType.fade,
alignment: Alignment.center,
opaque: true,
child: path,
),
ModalRoute.withName('/'),
);
break;
}
}
/// Opens [path] and returns whatever it pops with — the reload-on-return
/// channel: a child calls `Navigator.pop(context, true)` and the parent
/// refreshes on a truthy result.
Future<dynamic> navigateToPageWithData(
dynamic path,
BuildContext context,
) async {
return await Navigator.push(
context,
MaterialPageRoute(builder: (context) => path),
);
}
}