import 'package:flutter/cupertino.dart'; import 'package:info_tren/components/cupertino_divider.dart'; import 'package:info_tren/pages/about/about_page.dart'; import 'package:url_launcher/url_launcher.dart'; class AboutPageCupertino extends AboutPageShared { const AboutPageCupertino({super.key}); @override State createState() => AboutPageStateCupertino(); } class AboutPageStateCupertino extends AboutPageState { @override Widget build(BuildContext context) { return CupertinoPageScaffold( navigationBar: CupertinoNavigationBar( middle: Text(pageTitle), ), child: Builder( builder: (context) { final topPadding = MediaQuery.of(context).padding.top; return SingleChildScrollView( child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ SizedBox( height: topPadding, ), Center( child: Text( 'Info Tren', style: CupertinoTheme.of(context).textTheme.navLargeTitleTextStyle, ), ), if (packageInfo != null) Center( child: Text( packageInfo!.packageName, style: const TextStyle( inherit: true, fontSize: 14, ), ), ), const Padding( padding: EdgeInsets.symmetric(vertical: 8.0), child: CupertinoDivider(), ), for (final log in mergedChangelogs) ...[ Padding( padding: const EdgeInsets.fromLTRB(8, 8, 8, 0), child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( child: Text( log.version.toString(), style: const TextStyle( inherit: true, fontSize: 24, ), ), ), if (localChangelog.isNotEmpty && log.version == localChangelog.first.version) Container( decoration: BoxDecoration( border: Border.all( color: CupertinoTheme.of(context).textTheme.textStyle.color ?? CupertinoColors.inactiveGray, width: 1, ), borderRadius: BorderRadius.circular(20), ), child: Padding( padding: const EdgeInsets.all(4), child: Text( currentVersionText, style: const TextStyle( inherit: true, ), ), ), ), if (remoteChangelog.isNotEmpty && log.version == remoteChangelog.first.version && (localChangelog.isEmpty || localChangelog.first.version != log.version)) Container( decoration: BoxDecoration( border: Border.all( color: CupertinoColors.activeGreen, width: 1, ), borderRadius: BorderRadius.circular(20), ), child: Padding( padding: const EdgeInsets.all(4), child: Text( latestVersionText, style: const TextStyle( inherit: true, color: CupertinoColors.activeGreen, ), ), ), ), if (AboutPageState.download == 'apk' && log.apkLink != null) CupertinoButton( padding: const EdgeInsets.all(4), minSize: 0, onPressed: () { launchUrl( log.apkLink!, mode: LaunchMode.externalApplication, ); }, child: const Icon(CupertinoIcons.arrow_down_circle), ), ], ), ), Padding( padding: const EdgeInsets.all(8.0), child: RichText( text: TextSpan( text: log.description, ), ), ), const CupertinoDivider(), ], ], ), ); } ), ); } }