added list of messages under 'Did you know?'

This commit is contained in:
ashilkn 2022-06-03 18:18:37 +05:30
parent 8f27a6f857
commit 4c01f14bb9
3 changed files with 56 additions and 19 deletions

View file

@ -47,6 +47,8 @@ extension CustomColorScheme on ColorScheme {
Color get bgColorForQuestions => brightness == Brightness.light
? Colors.white
: Color.fromRGBO(10, 15, 15, 1.0);
Color get greenText => Color.fromRGBO(40, 190, 92, 1);
}
OutlinedButtonThemeData buildOutlinedButtonThemeData(

View file

@ -252,7 +252,8 @@ class _HomeWidgetState extends State<HomeWidget> {
Widget _getBody() {
if (!Configuration.instance.hasConfiguredAccount()) {
return LandingPageWidget();
// return LandingPageWidget();
return LoadingPhotosWidget();
}
if (!LocalSyncService.instance.hasGrantedPermissions()) {
return GrantPermissionsWidget();

View file

@ -18,10 +18,20 @@ class LoadingPhotosWidget extends StatefulWidget {
class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> {
StreamSubscription<SyncStatusUpdate> _firstImportEvent;
// final int _currentPage = 0;
// final PageController _pageController = PageController(
// initialPage: 0,
// );
int _currentPage = 0;
final PageController _pageController = PageController(
initialPage: 0,
);
final List<String> _messages = [
"web.ente.io has a slick uploader",
"We have preserved over a million memories so far",
"All our apps are open source",
"Our encryption protocols have been reviewed by engineers at Google, Apple, Amazon, and Facebook",
"You can share files and folders with your loved ones, end-to-end encrypted",
"Our mobile apps run in the background to encrypt and backup new photos you take",
"We use Xchacha20Poly1305 to safely encrypt your data",
"One of our data centers is in a fall out shelter 25m underground",
];
@override
void initState() {
@ -42,6 +52,22 @@ class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> {
}
}
});
Timer.periodic(Duration(seconds: 5), (Timer timer) {
if (!mounted) {
return;
}
if (_currentPage < _messages.length - 1) {
_currentPage++;
} else {
_currentPage = 0;
}
_pageController.animateToPage(
_currentPage,
duration: Duration(milliseconds: 300),
curve: Curves.easeIn,
);
});
}
@override
@ -64,19 +90,28 @@ class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> {
Text("Did you know?",
style: Theme.of(context).textTheme.headline6.copyWith(
fontFamily: "Inter",
color: Theme.of(context)
.colorScheme
.defaultTextColor
.withOpacity(0.4))),
color: Theme.of(context).colorScheme.greenText)),
SizedBox(
height: 16,
),
Text(
"ente is amazing",
style: Theme.of(context).textTheme.headline6.copyWith(
fontFamily: "Inter",
color: Theme.of(context).colorScheme.defaultTextColor),
)
// Text(
// "ente is amazing",
// style: Theme.of(context).textTheme.headline6.copyWith(
// fontFamily: "Inter",
// color: Theme.of(context).colorScheme.defaultTextColor),
// )
SizedBox(
height: 80,
child: PageView.builder(
scrollDirection: Axis.vertical,
controller: _pageController,
itemBuilder: (context, index) {
return _getMessage(_messages[index]);
},
itemCount: _messages.length,
physics: NeverScrollableScrollPhysics(),
),
),
],
),
),
@ -89,10 +124,9 @@ class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> {
child: Text(
text,
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white.withOpacity(0.7),
height: 1.5,
),
style: Theme.of(context).textTheme.headline6.copyWith(
fontFamily: "Inter",
color: Theme.of(context).colorScheme.defaultTextColor),
),
);
}