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 : 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(mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ 34 0 : Image( 35 0 : image: AssetImage("assets/core/knott-white.png"), 36 : filterQuality: FilterQuality.medium, 37 : isAntiAlias: true, 38 : width: 200, 39 : height: 200, 40 : ), 41 0 : Image( 42 0 : image: AssetImage("assets/cwtch_title.png"), 43 : filterQuality: FilterQuality.medium, 44 : isAntiAlias: true, 45 : ), 46 0 : Padding( 47 : padding: const EdgeInsets.all(20.0), 48 0 : child: Column(children: [ 49 0 : Padding( 50 0 : padding: EdgeInsets.all(6.0), 51 0 : child: Text( 52 0 : appState.appError != "" 53 0 : ? appState.appError 54 0 : : appState.modalState == ModalState.none 55 0 : ? AppLocalizations.of(context)!.loadingCwtch 56 0 : : appState.modalState == ModalState.storageMigration 57 0 : ? AppLocalizations.of(context)!.storageMigrationModalMessage 58 0 : : AppLocalizations.of(context)!.shuttingDownApp, // Todo l10n AppLocalizations.of(context)!.storageMigrationModalMessage 59 0 : style: defaultTextButtonStyle.copyWith( 60 0 : fontSize: 16.0, fontFamily: "Inter", color: appState.appError == "" ? whiteishPurple : hotPink))), 61 0 : Visibility( 62 0 : visible: appState.modalState == ModalState.storageMigration || appState.modalState == ModalState.shutdown, 63 0 : child: LinearProgressIndicator( 64 0 : color: Provider.of<Settings>(context).theme.defaultButtonActiveColor, 65 : )) 66 : ])), 67 0 : Image(image: AssetImage("assets/Open_Privacy_Logo_lightoutline.png")), 68 : ])), 69 : )); 70 : } 71 : }