Line data Source code
1 : import 'package:cwtch/config.dart'; 2 : import 'package:cwtch/models/appstate.dart'; 3 : import 'package:cwtch/themes/opaque.dart'; 4 : import 'package:flutter/material.dart'; 5 : import 'package:provider/provider.dart'; 6 : import 'package:flutter_gen/gen_l10n/app_localizations.dart'; 7 : 8 : import '../main.dart'; 9 : import '../settings.dart'; 10 : 11 : class SplashView extends StatefulWidget { 12 0 : @override 13 0 : _SplashViewState createState() => _SplashViewState(); 14 : } 15 : 16 : class _SplashViewState extends State<SplashView> { 17 0 : @override 18 : Widget build(BuildContext context) { 19 0 : EnvironmentConfig.debugLog("building splash screen..."); 20 0 : var cwtch = Provider.of<FlwtchState>(context, listen: false).cwtch; 21 0 : if (!cwtch.isL10nInit()) { 22 0 : if (AppLocalizations.of(context) != null && AppLocalizations.of(context)!.newMessageNotificationSimple.isNotEmpty) { 23 0 : cwtch.l10nInit(AppLocalizations.of(context)!.newMessageNotificationSimple, AppLocalizations.of(context)!.newMessageNotificationConversationInfo); 24 : } 25 : } 26 : 27 0 : return Consumer<AppState>( 28 0 : builder: (context, appState, child) => Scaffold( 29 0 : key: Key("SplashView"), 30 0 : body: Center( 31 0 : child: Column(mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ 32 0 : Image( 33 0 : image: AssetImage("assets/core/knott-white.png"), 34 : filterQuality: FilterQuality.medium, 35 : isAntiAlias: true, 36 : width: 200, 37 : height: 200, 38 : ), 39 0 : Image( 40 0 : image: AssetImage("assets/cwtch_title.png"), 41 : filterQuality: FilterQuality.medium, 42 : isAntiAlias: true, 43 : ), 44 0 : Padding( 45 : padding: const EdgeInsets.all(20.0), 46 0 : child: Column(children: [ 47 0 : Padding( 48 0 : padding: EdgeInsets.all(6.0), 49 0 : child: Text( 50 0 : appState.appError != "" 51 0 : ? appState.appError 52 0 : : appState.modalState == ModalState.none 53 0 : ? AppLocalizations.of(context)!.loadingCwtch 54 0 : : appState.modalState == ModalState.storageMigration 55 0 : ? AppLocalizations.of(context)!.storageMigrationModalMessage 56 0 : : AppLocalizations.of(context)!.shuttingDownApp, // Todo l10n AppLocalizations.of(context)!.storageMigrationModalMessage 57 0 : style: defaultTextButtonStyle.copyWith( 58 0 : fontSize: 16.0, color: appState.appError == "" ? Provider.of<Settings>(context).theme.mainTextColor : Provider.of<Settings>(context).theme.textfieldErrorColor))), 59 0 : Visibility( 60 0 : visible: appState.modalState == ModalState.storageMigration || appState.modalState == ModalState.shutdown, 61 0 : child: LinearProgressIndicator( 62 0 : color: Provider.of<Settings>(context).theme.defaultButtonActiveColor, 63 : )) 64 : ])), 65 0 : Image(image: AssetImage("assets/Open_Privacy_Logo_lightoutline.png")), 66 : ])), 67 : )); 68 : } 69 : }