2022-08-19 15:04:40 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_i18n/widgets/I18nText.dart';
|
|
|
|
import 'package:revanced_manager/constants.dart';
|
2022-08-21 15:06:28 +02:00
|
|
|
import 'package:revanced_manager/theme.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 {
|
|
|
|
const AboutWidget({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<AboutWidget> createState() => _AboutWidgetState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _AboutWidgetState extends State<AboutWidget> {
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
I18nText(
|
|
|
|
'settingsView.aboutLabel',
|
|
|
|
child: Text('', style: kSettingItemTextStyle),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 4),
|
|
|
|
FutureBuilder<Map<String, dynamic>>(
|
|
|
|
future: AboutInfo.getInfo(),
|
|
|
|
builder: (context, snapshot) {
|
|
|
|
if (snapshot.hasData) {
|
2022-08-21 15:06:28 +02:00
|
|
|
return GestureDetector(
|
|
|
|
onLongPress: () {
|
|
|
|
Clipboard.setData(
|
|
|
|
ClipboardData(
|
2022-08-21 16:23:55 +02:00
|
|
|
text: 'Version: ${snapshot.data!['version']}\n'
|
|
|
|
'Build: ${snapshot.data!['buildNumber']}\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(
|
|
|
|
content: Text(
|
|
|
|
'Copied to clipboard',
|
|
|
|
style: TextStyle(
|
|
|
|
color: isDark ? Colors.white : Colors.grey[300],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
backgroundColor: Theme.of(context).colorScheme.tertiary,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text('Version: ${snapshot.data!['version']}',
|
|
|
|
style: kSettingItemSubtitleTextStyle),
|
|
|
|
Text('Build: ${snapshot.data!['buildNumber']}',
|
|
|
|
style: kSettingItemSubtitleTextStyle),
|
|
|
|
Text('Model: ${snapshot.data!['model']}',
|
|
|
|
style: kSettingItemSubtitleTextStyle),
|
|
|
|
Text(
|
|
|
|
'Android Version: ${snapshot.data!['androidVersion']}',
|
|
|
|
style: kSettingItemSubtitleTextStyle),
|
|
|
|
Text('Arch: ${snapshot.data!['arch']}',
|
|
|
|
style: kSettingItemSubtitleTextStyle),
|
|
|
|
],
|
|
|
|
),
|
2022-08-19 15:04:40 +02:00
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return Container();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|