2022-09-20 16:32:46 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import '../extensions/widget.dart';
|
|
|
|
import '../flutter_login_view.dart';
|
|
|
|
import '../plugins/login/choose_login.dart';
|
|
|
|
|
|
|
|
class ScreenService with NavigateWidgetMixin {
|
|
|
|
late bool shouldShowIntroductionScreen;
|
|
|
|
late bool shouldShowPolicyPage;
|
|
|
|
|
|
|
|
Widget getAppshellScreenWrapper(
|
|
|
|
BuildContext context, {
|
|
|
|
required Widget child,
|
|
|
|
String? backgroundImg,
|
|
|
|
}) {
|
|
|
|
var bgImage =
|
2022-09-21 10:03:08 +02:00
|
|
|
backgroundImg ?? context.login().config.appOptions.backgroundImage;
|
2022-09-20 16:32:46 +02:00
|
|
|
if (bgImage.isNotEmpty) {
|
|
|
|
late AssetImage image;
|
|
|
|
var split = bgImage.split(';');
|
|
|
|
|
|
|
|
image = split.length < 2
|
|
|
|
? AssetImage(bgImage)
|
|
|
|
: AssetImage(
|
|
|
|
split.first,
|
|
|
|
package: split.last,
|
|
|
|
);
|
|
|
|
|
|
|
|
return Container(
|
|
|
|
height: MediaQuery.of(context).size.height,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
image: DecorationImage(
|
|
|
|
image: image,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: child,
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return child;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void openLoginScreen(BuildContext context) => navigateFadeTo(
|
|
|
|
context,
|
|
|
|
(ctx) => (FlutterLogin.of(context)
|
|
|
|
.config
|
|
|
|
.loginOptions
|
|
|
|
.loginMethod
|
|
|
|
.contains(LoginMethod.LoginInteractiveWithSocial) ||
|
|
|
|
FlutterLogin.of(context)
|
|
|
|
.config
|
|
|
|
.loginOptions
|
|
|
|
.loginMethod
|
|
|
|
.contains(LoginMethod.LoginInteractiveWithPhoneNumber))
|
|
|
|
? ChooseLogin(
|
|
|
|
allowExit: true,
|
2022-09-21 10:03:08 +02:00
|
|
|
child: context.login().app,
|
2022-09-20 16:32:46 +02:00
|
|
|
)
|
|
|
|
: EmailPasswordLogin(
|
|
|
|
allowExit: true,
|
2022-09-21 10:03:08 +02:00
|
|
|
child: context.login().app,
|
2022-09-20 16:32:46 +02:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|