ChalonaApp<T extends ChalonaSession> constructor
ChalonaApp<T extends ChalonaSession> ({
- required String name,
- required String title,
- required String host,
- required T session,
- required Future<
ChalonaSocketIO> wsConnect(), - Widget splash(
- BuildContext context
- Widget login(
- BuildContext context
- Widget onErrorLoading(
- BuildContext context
- void onSuccess(
- BuildContext context,
- String msg
- void onError(
- BuildContext context,
- String msg
- Map<
String, Widget Function(BuildContext)> routes = const {},
Implementation
ChalonaApp({
required this.name,
required this.title,
required String host,
required T this.session,
required super.wsConnect,
Widget Function(BuildContext context)? splash,
Widget Function(BuildContext context)? login,
Widget Function(BuildContext context)? onErrorLoading,
void Function(BuildContext context, String msg)? onSuccess,
void Function(BuildContext context, String msg)? onError,
Map<String, Widget Function(BuildContext)> routes = const {},
}) : _splashScreen = splash ?? _defaultSplash,
_loginScreen = login ?? _defaultLogin,
_errorLoadingScreen = onErrorLoading ?? _errorLoadingDefault,
_success = onSuccess ?? _handleSuccess,
_error = onError ?? _handleError,
super(host: ChalonaHttp(host: host), newStates: [
initializeApp,
sessionIsRecoveringState,
sessionIsRecoveredState,
]) {
ChalonaApp._current = this;
_routes = {
'/home': (context) => const Scaffold(
body: Center(
child: Text('Home'),
),
),
};
for (var k in routes.keys) {
_routes[k] = routes[k]!;
}
}