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