2022-08-04 03:45:32 +03:00
|
|
|
import 'package:flutter/material.dart';
|
2022-08-04 17:52:06 +03:00
|
|
|
import 'package:flutter/services.dart';
|
2022-08-04 03:45:32 +03:00
|
|
|
import 'package:info_tren/pages/about/about_page.dart';
|
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
|
2022-11-19 06:01:58 +01:00
|
|
|
class AboutPageMaterial extends AboutPageShared {
|
2022-10-31 03:44:29 +01:00
|
|
|
const AboutPageMaterial({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<AboutPageShared> createState() => AboutPageStateMaterial();
|
|
|
|
}
|
|
|
|
|
2022-11-19 06:01:58 +01:00
|
|
|
class AboutPageStateMaterial extends AboutPageState<AboutPageMaterial> {
|
2022-08-04 03:45:32 +03:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
appBar: AppBar(
|
|
|
|
title: Text(pageTitle),
|
|
|
|
centerTitle: true,
|
|
|
|
),
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
child: Column(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
children: [
|
|
|
|
Center(
|
|
|
|
child: Text(
|
|
|
|
'Info Tren',
|
|
|
|
style: Theme.of(context).textTheme.displayMedium,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (packageInfo != null)
|
|
|
|
Center(
|
|
|
|
child: Text(
|
|
|
|
packageInfo!.packageName,
|
2022-10-31 01:30:29 +01:00
|
|
|
style: Theme.of(context).textTheme.bodySmall,
|
2022-08-04 03:45:32 +03:00
|
|
|
),
|
|
|
|
),
|
|
|
|
// ListTile(
|
|
|
|
// title: Text(versionTitleText),
|
|
|
|
// subtitle: localChangelog.isEmpty ? null : Text(localChangelog.first.title),
|
|
|
|
// ),
|
2022-10-31 01:30:29 +01:00
|
|
|
const Divider(),
|
2022-08-04 03:45:32 +03:00
|
|
|
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: Theme.of(context).textTheme.headlineMedium,
|
2022-08-04 03:45:32 +03:00
|
|
|
),
|
|
|
|
),
|
|
|
|
if (localChangelog.isNotEmpty && log.version == localChangelog.first.version)
|
|
|
|
Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border.all(
|
|
|
|
color: Theme.of(context).colorScheme.onBackground,
|
|
|
|
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: Colors.green,
|
|
|
|
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: Colors.green,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2022-10-31 01:49:11 +01:00
|
|
|
if (AboutPageState.download == 'apk' && log.apkLink != null)
|
2022-08-04 17:52:06 +03:00
|
|
|
GestureDetector(
|
|
|
|
onSecondaryTap: () {
|
|
|
|
Clipboard.setData(ClipboardData(text: log.apkLink!.toString()));
|
2022-10-31 01:30:29 +01:00
|
|
|
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
2022-08-04 17:52:06 +03:00
|
|
|
content: Text('Link copied to clipboard'),
|
|
|
|
));
|
|
|
|
},
|
|
|
|
onLongPress: () {
|
|
|
|
Clipboard.setData(ClipboardData(text: log.apkLink!.toString()));
|
2022-10-31 01:30:29 +01:00
|
|
|
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
2022-08-04 17:52:06 +03:00
|
|
|
content: Text('Link copied to clipboard'),
|
|
|
|
));
|
|
|
|
},
|
|
|
|
onTap: () {
|
|
|
|
launchUrl(
|
|
|
|
log.apkLink!,
|
|
|
|
mode: LaunchMode.externalApplication,
|
|
|
|
);
|
2022-08-04 03:45:32 +03:00
|
|
|
},
|
2022-08-04 17:52:06 +03:00
|
|
|
behavior: HitTestBehavior.translucent,
|
2022-10-31 01:30:29 +01:00
|
|
|
child: const Tooltip(
|
2022-08-04 17:52:06 +03:00
|
|
|
message: 'Download APK',
|
|
|
|
child: Padding(
|
2022-10-31 01:30:29 +01:00
|
|
|
padding: EdgeInsets.all(4),
|
2022-08-04 17:52:06 +03:00
|
|
|
child: Icon(Icons.download),
|
|
|
|
),
|
|
|
|
),
|
2022-08-04 03:45:32 +03:00
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
child: RichText(
|
|
|
|
text: TextSpan(
|
|
|
|
text: log.description,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
2022-11-19 06:01:58 +01:00
|
|
|
}
|