2024-06-08 05:28:49 +00:00
import ' package:flutter/material.dart ' ;
2024-09-07 09:45:44 +00:00
import ' package:gap/gap.dart ' ;
2024-09-19 12:34:04 +00:00
import ' package:get/get.dart ' ;
2024-09-24 14:10:45 +00:00
import ' package:intl/intl.dart ' ;
2024-06-08 05:28:49 +00:00
import ' package:package_info_plus/package_info_plus.dart ' ;
2024-09-24 14:10:45 +00:00
import ' package:shared_preferences/shared_preferences.dart ' ;
2024-10-06 09:37:07 +00:00
import ' package:solian/widgets/root_container.dart ' ;
2024-09-19 12:39:09 +00:00
import ' package:solian/widgets/sized_container.dart ' ;
2024-06-08 05:28:49 +00:00
import ' package:url_launcher/url_launcher_string.dart ' ;
class AboutScreen extends StatelessWidget {
const AboutScreen ( { super . key } ) ;
@ override
Widget build ( BuildContext context ) {
const denseButtonStyle =
ButtonStyle ( visualDensity: VisualDensity ( vertical: - 4 ) ) ;
2024-10-06 09:37:07 +00:00
return RootContainer (
2024-06-27 06:56:09 +00:00
child: SizedBox (
width: double . infinity ,
child: Column (
mainAxisAlignment: MainAxisAlignment . center ,
children: [
2024-08-03 09:44:36 +00:00
ClipRRect (
borderRadius: const BorderRadius . all ( Radius . circular ( 16 ) ) ,
child: Image . asset ( ' assets/logo.png ' , width: 120 , height: 120 ) ,
) ,
2024-09-07 09:45:44 +00:00
const Gap ( 8 ) ,
2024-06-27 06:56:09 +00:00
Text (
' Solian ' ,
style: Theme . of ( context ) . textTheme . headlineMedium ,
) ,
const Text (
' The Solar Network ' ,
style: TextStyle ( fontWeight: FontWeight . bold , fontSize: 16 ) ,
) ,
2024-09-07 09:45:44 +00:00
const Gap ( 8 ) ,
2024-06-27 06:56:09 +00:00
FutureBuilder (
future: PackageInfo . fromPlatform ( ) ,
builder: ( context , snapshot ) {
if ( ! snapshot . hasData ) {
2024-09-07 09:48:07 +00:00
return const SizedBox . shrink ( ) ;
2024-06-27 06:56:09 +00:00
}
2024-06-08 05:28:49 +00:00
2024-06-27 06:56:09 +00:00
return Text (
' v ${ snapshot . data ! . version } · ${ snapshot . data ! . buildNumber } ' ,
style: const TextStyle ( fontFamily: ' monospace ' ) ,
) ;
} ,
) ,
Text ( ' Copyright © ${ DateTime . now ( ) . year } Solsynth LLC ' ) ,
2024-09-07 09:45:44 +00:00
const Gap ( 16 ) ,
2024-09-19 12:39:09 +00:00
CenteredContainer (
maxWidth: 280 ,
child: Wrap (
2024-09-24 14:10:45 +00:00
spacing: 4 ,
runSpacing: 4 ,
2024-09-23 14:43:13 +00:00
alignment: WrapAlignment . center ,
2024-09-19 12:39:09 +00:00
children: [
TextButton (
style: denseButtonStyle ,
child: Text ( ' appDetails ' . tr ) ,
onPressed: ( ) async {
final info = await PackageInfo . fromPlatform ( ) ;
2024-08-01 16:41:12 +00:00
2024-09-19 12:39:09 +00:00
showAboutDialog (
context: context ,
applicationVersion:
' ${ info . version } ( ${ info . buildNumber } ) ' ,
applicationLegalese:
' The Solar Network App is an intuitive and open-source social network and computing platform. Experience the freedom of a user-friendly design that empowers you to create and connect with communities on your own terms. Embrace the future of social networking with a platform that prioritizes your independence and privacy. ' ,
applicationIcon: ClipRRect (
borderRadius:
const BorderRadius . all ( Radius . circular ( 16 ) ) ,
child: Image . asset ( ' assets/logo.png ' ,
width: 60 , height: 60 ) ,
) ,
) ;
} ,
2024-08-01 16:41:12 +00:00
) ,
2024-09-19 12:39:09 +00:00
TextButton (
style: denseButtonStyle ,
child: Text ( ' projectWebsite ' . tr ) ,
onPressed: ( ) {
launchUrlString (
' https://solsynth.dev/products/solar-network ' ) ;
} ,
) ,
TextButton (
style: denseButtonStyle ,
child: Text ( ' termRelated ' . tr ) ,
onPressed: ( ) {
launchUrlString ( ' https://solsynth.dev/terms ' ) ;
} ,
) ,
2024-09-24 14:10:45 +00:00
TextButton (
style: denseButtonStyle ,
child: Text ( ' serviceStatus ' . tr ) ,
onPressed: ( ) {
launchUrlString ( ' https://status.solsynth.dev ' ) ;
} ,
) ,
2024-09-19 12:39:09 +00:00
] ,
) ,
2024-09-19 12:34:04 +00:00
) ,
2024-09-07 09:45:44 +00:00
const Gap ( 16 ) ,
2024-06-27 06:56:09 +00:00
const Text (
' Open-sourced under AGPLv3 ' ,
style: TextStyle (
fontWeight: FontWeight . w300 ,
fontSize: 12 ,
) ,
2024-06-08 05:28:49 +00:00
) ,
2024-09-24 14:10:45 +00:00
FutureBuilder (
future: SharedPreferences . getInstance ( ) ,
builder: ( context , snapshot ) {
const textStyle = TextStyle (
fontWeight: FontWeight . w300 ,
fontSize: 12 ,
) ;
if ( ! snapshot . hasData | |
! snapshot . data ! . containsKey ( ' first_boot_time ' ) ) {
return Text (
' firstBootTime ' . trParams ( { ' time ' : ' unknown ' . tr } ) ,
style: textStyle ,
) ;
} else {
return Text (
' firstBootTime ' . trParams ( {
' time ' : DateFormat ( ' yyyy-MM-dd ' ) . format (
DateTime . tryParse (
snapshot . data ! . getString ( ' first_boot_time ' ) ! ,
) ? . toLocal ( ) ? ?
DateTime . now ( ) ,
) ,
} ) ,
style: textStyle ,
) ;
}
} ,
) ,
2024-06-27 06:56:09 +00:00
] ,
) ,
2024-06-08 05:28:49 +00:00
) ,
) ;
}
}