2022-08-19 15:04:40 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2022-09-02 15:35:25 +02:00
|
|
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
2022-08-19 15:04:40 +02:00
|
|
|
import 'package:revanced_manager/utils/about_info.dart';
|
2022-08-21 15:06:28 +02:00
|
|
|
import 'package:flutter/services.dart';
|
2022-08-19 15:04:40 +02:00
|
|
|
|
|
|
|
class AboutWidget extends StatefulWidget {
|
2022-09-19 10:39:25 +02:00
|
|
|
const AboutWidget({Key? key, this.padding}) : super(key: key);
|
|
|
|
|
|
|
|
final EdgeInsetsGeometry? padding;
|
2022-08-19 15:04:40 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
State<AboutWidget> createState() => _AboutWidgetState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _AboutWidgetState extends State<AboutWidget> {
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2022-09-19 10:39:25 +02:00
|
|
|
return FutureBuilder<Map<String, dynamic>>(
|
|
|
|
future: AboutInfo.getInfo(),
|
|
|
|
builder: (context, snapshot) {
|
|
|
|
return Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
|
|
|
child: ListTile(
|
|
|
|
contentPadding: widget.padding ?? EdgeInsets.zero,
|
|
|
|
onLongPress: snapshot.hasData
|
|
|
|
? () {
|
2022-08-21 15:06:28 +02:00
|
|
|
Clipboard.setData(
|
|
|
|
ClipboardData(
|
2022-08-21 16:23:55 +02:00
|
|
|
text: 'Version: ${snapshot.data!['version']}\n'
|
|
|
|
'Model: ${snapshot.data!['model']}\n'
|
|
|
|
'Android Version: ${snapshot.data!['androidVersion']}\n'
|
|
|
|
'Arch: ${snapshot.data!['arch']}\n',
|
2022-08-21 15:06:28 +02:00
|
|
|
),
|
|
|
|
);
|
|
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
|
|
SnackBar(
|
2022-09-14 13:25:35 +02:00
|
|
|
content: I18nText('settingsView.snackbarMessage'),
|
2022-09-05 04:32:36 +02:00
|
|
|
backgroundColor:
|
|
|
|
Theme.of(context).colorScheme.secondary,
|
2022-08-21 15:06:28 +02:00
|
|
|
),
|
|
|
|
);
|
2022-09-19 10:39:25 +02:00
|
|
|
}
|
|
|
|
: null,
|
|
|
|
title: I18nText(
|
|
|
|
'settingsView.aboutLabel',
|
|
|
|
child: const Text(
|
|
|
|
'',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 20,
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
subtitle: snapshot.hasData
|
|
|
|
? Column(
|
2022-08-21 15:06:28 +02:00
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
2022-09-02 15:35:25 +02:00
|
|
|
children: <Widget>[
|
2022-08-21 15:06:28 +02:00
|
|
|
Text(
|
2022-09-05 04:32:36 +02:00
|
|
|
'Version: ${snapshot.data!['version']}',
|
|
|
|
style: const TextStyle(
|
|
|
|
fontSize: 13,
|
|
|
|
fontWeight: FontWeight.w300,
|
|
|
|
),
|
|
|
|
),
|
2022-09-16 17:39:57 +02:00
|
|
|
Text(
|
|
|
|
'Build: ${snapshot.data!['flavor']}',
|
|
|
|
style: const TextStyle(
|
|
|
|
fontSize: 13,
|
|
|
|
fontWeight: FontWeight.w300,
|
|
|
|
),
|
|
|
|
),
|
2022-09-05 04:32:36 +02:00
|
|
|
Text(
|
|
|
|
'Model: ${snapshot.data!['model']}',
|
|
|
|
style: const TextStyle(
|
|
|
|
fontSize: 13,
|
|
|
|
fontWeight: FontWeight.w300,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
'Android Version: ${snapshot.data!['androidVersion']}',
|
|
|
|
style: const TextStyle(
|
|
|
|
fontSize: 13,
|
|
|
|
fontWeight: FontWeight.w300,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
'Arch: ${snapshot.data!['arch']}',
|
|
|
|
style: const TextStyle(
|
|
|
|
fontSize: 13,
|
|
|
|
fontWeight: FontWeight.w300,
|
|
|
|
),
|
|
|
|
),
|
2022-08-21 15:06:28 +02:00
|
|
|
],
|
2022-09-19 10:39:25 +02:00
|
|
|
)
|
|
|
|
: const SizedBox(),
|
2022-08-19 15:04:40 +02:00
|
|
|
),
|
2022-09-19 10:39:25 +02:00
|
|
|
);
|
|
|
|
},
|
2022-08-19 15:04:40 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|