2022-08-04 03:45:32 +03:00
|
|
|
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';
|
|
|
|
|
2022-10-31 03:44:29 +01:00
|
|
|
class AboutPageCupertino extends StatefulWidget {
|
|
|
|
const AboutPageCupertino({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<AboutPageShared> createState() => AboutPageStateCupertino();
|
|
|
|
}
|
|
|
|
|
2022-08-04 03:45:32 +03:00
|
|
|
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,
|
2022-10-31 01:30:29 +01:00
|
|
|
style: const TextStyle(
|
2022-08-04 03:45:32 +03:00
|
|
|
inherit: true,
|
|
|
|
fontSize: 14,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2022-10-31 01:30:29 +01:00
|
|
|
const Padding(
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 8.0),
|
2022-08-04 03:45:32 +03:00
|
|
|
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(),
|
2022-10-31 01:30:29 +01:00
|
|
|
style: const TextStyle(
|
2022-08-04 03:45:32 +03:00
|
|
|
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,
|
2022-10-31 01:30:29 +01:00
|
|
|
style: const TextStyle(
|
2022-08-04 03:45:32 +03:00
|
|
|
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,
|
2022-10-31 01:30:29 +01:00
|
|
|
style: const TextStyle(
|
2022-08-04 03:45:32 +03:00
|
|
|
inherit: true,
|
|
|
|
color: CupertinoColors.activeGreen,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2022-10-31 01:49:11 +01:00
|
|
|
if (AboutPageState.download == 'apk' && log.apkLink != null)
|
2022-08-04 03:45:32 +03:00
|
|
|
CupertinoButton(
|
2022-10-31 01:30:29 +01:00
|
|
|
padding: const EdgeInsets.all(4),
|
2022-08-04 03:45:32 +03:00
|
|
|
minSize: 0,
|
|
|
|
onPressed: () {
|
2022-08-04 17:52:06 +03:00
|
|
|
launchUrl(
|
|
|
|
log.apkLink!,
|
|
|
|
mode: LaunchMode.externalApplication,
|
|
|
|
);
|
2022-08-04 03:45:32 +03:00
|
|
|
},
|
2022-10-31 01:30:29 +01:00
|
|
|
child: const Icon(CupertinoIcons.arrow_down_circle),
|
2022-08-04 03:45:32 +03:00
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
child: RichText(
|
|
|
|
text: TextSpan(
|
|
|
|
text: log.description,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2022-10-31 01:30:29 +01:00
|
|
|
const CupertinoDivider(),
|
2022-08-04 03:45:32 +03:00
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|