2022-01-18 21:26:52 +00:00
|
|
|
import 'package:cwtch/models/appstate.dart';
|
2021-06-24 23:10:45 +00:00
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
2021-12-17 23:23:18 +00:00
|
|
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
2021-06-24 23:10:45 +00:00
|
|
|
|
2022-02-08 21:54:17 +00:00
|
|
|
import '../main.dart';
|
2021-06-24 23:10:45 +00:00
|
|
|
import '../settings.dart';
|
|
|
|
|
2021-12-17 23:23:18 +00:00
|
|
|
class SplashView extends StatefulWidget {
|
|
|
|
@override
|
|
|
|
_SplashViewState createState() => _SplashViewState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _SplashViewState extends State<SplashView> {
|
2021-06-24 23:10:45 +00:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2022-02-08 21:54:17 +00:00
|
|
|
var cwtch = Provider.of<FlwtchState>(context, listen: false).cwtch;
|
|
|
|
if (!cwtch.isL10nInit()) {
|
2022-02-14 19:03:28 +00:00
|
|
|
if (AppLocalizations.of(context) != null && AppLocalizations.of(context)!.newMessageNotificationSimple.isNotEmpty) {
|
2022-02-08 21:54:17 +00:00
|
|
|
cwtch.l10nInit(AppLocalizations.of(context)!.newMessageNotificationSimple, AppLocalizations.of(context)!.newMessageNotificationConversationInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-24 23:10:45 +00:00
|
|
|
return Consumer<AppState>(
|
|
|
|
builder: (context, appState, child) => Scaffold(
|
2022-02-05 00:37:25 +00:00
|
|
|
key: Key("SplashView"),
|
2021-06-24 23:10:45 +00:00
|
|
|
body: Center(
|
|
|
|
child: Column(mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [
|
|
|
|
Image(
|
|
|
|
image: AssetImage("assets/core/knott-white.png"),
|
|
|
|
filterQuality: FilterQuality.medium,
|
|
|
|
isAntiAlias: true,
|
|
|
|
width: 200,
|
|
|
|
height: 200,
|
|
|
|
),
|
|
|
|
Image(
|
|
|
|
image: AssetImage("assets/cwtch_title.png"),
|
|
|
|
filterQuality: FilterQuality.medium,
|
|
|
|
isAntiAlias: true,
|
|
|
|
),
|
|
|
|
Padding(
|
2021-12-17 23:23:18 +00:00
|
|
|
padding: const EdgeInsets.all(20.0),
|
|
|
|
child: Column(children: [
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.all(6.0),
|
|
|
|
child: Text(
|
|
|
|
appState.appError != ""
|
|
|
|
? appState.appError
|
|
|
|
: appState.modalState == ModalState.none
|
|
|
|
? AppLocalizations.of(context)!.loadingCwtch
|
2022-03-21 16:18:17 +00:00
|
|
|
: appState.modalState == ModalState.storageMigration
|
|
|
|
? AppLocalizations.of(context)!.storageMigrationModalMessage
|
|
|
|
: AppLocalizations.of(context)!.shuttingDownApp, // Todo l10n AppLocalizations.of(context)!.storageMigrationModalMessage
|
2021-12-17 23:23:18 +00:00
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16.0, color: appState.appError == "" ? Provider.of<Settings>(context).theme.mainTextColor : Provider.of<Settings>(context).theme.textfieldErrorColor))),
|
|
|
|
Visibility(
|
2022-03-11 00:10:28 +00:00
|
|
|
visible: appState.modalState == ModalState.storageMigration || appState.modalState == ModalState.shutdown,
|
2021-12-17 23:23:18 +00:00
|
|
|
child: LinearProgressIndicator(
|
|
|
|
color: Provider.of<Settings>(context).theme.defaultButtonActiveColor,
|
|
|
|
))
|
|
|
|
])),
|
2021-06-24 23:10:45 +00:00
|
|
|
Image(image: AssetImage("assets/Open_Privacy_Logo_lightoutline.png")),
|
|
|
|
])),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|