feat: ability to copy about information.

This commit is contained in:
Aunali321 2022-08-21 18:36:28 +05:30
parent fba96fde9c
commit 519a6d25e6
2 changed files with 44 additions and 18 deletions

View File

@ -1,7 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_i18n/widgets/I18nText.dart'; import 'package:flutter_i18n/widgets/I18nText.dart';
import 'package:revanced_manager/constants.dart'; import 'package:revanced_manager/constants.dart';
import 'package:revanced_manager/theme.dart';
import 'package:revanced_manager/utils/about_info.dart'; import 'package:revanced_manager/utils/about_info.dart';
import 'package:flutter/services.dart';
class AboutWidget extends StatefulWidget { class AboutWidget extends StatefulWidget {
const AboutWidget({Key? key}) : super(key: key); const AboutWidget({Key? key}) : super(key: key);
@ -27,20 +29,47 @@ class _AboutWidgetState extends State<AboutWidget> {
future: AboutInfo.getInfo(), future: AboutInfo.getInfo(),
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.hasData) { if (snapshot.hasData) {
return Column( return GestureDetector(
crossAxisAlignment: CrossAxisAlignment.start, onLongPress: () {
children: [ Clipboard.setData(
Text('Version: ${snapshot.data!['version']}', ClipboardData(
style: kSettingItemSubtitleTextStyle), text: """
Text('Build: ${snapshot.data!['buildNumber']}', Version: ${snapshot.data!['version']} \n
style: kSettingItemSubtitleTextStyle), Build: ${snapshot.data!['buildNumber']} \n
Text('Model: ${snapshot.data!['model']}', Model: ${snapshot.data!['model']} \n
style: kSettingItemSubtitleTextStyle), Android Version: ${snapshot.data!['androidVersion']} \n
Text('Android Version: ${snapshot.data!['androidVersion']}', Arch: ${snapshot.data!['arch']}
style: kSettingItemSubtitleTextStyle), """,
Text('Arch: ${snapshot.data!['arch']}', ),
style: kSettingItemSubtitleTextStyle), );
], 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),
],
),
); );
} else { } else {
return Container(); return Container();

View File

@ -15,10 +15,7 @@ class CustomSwitch extends StatelessWidget {
Color? activeColor = Theme.of(context).colorScheme.tertiary; Color? activeColor = Theme.of(context).colorScheme.tertiary;
Color? inactiveColor = Theme.of(context).colorScheme.secondary; Color? inactiveColor = Theme.of(context).colorScheme.secondary;
return GestureDetector( return GestureDetector(
onTap: () { onTap: () => onChanged(!value),
onChanged(!value);
Fluttertoast.showToast(msg: 'Rooted: ${!value}');
},
child: SizedBox( child: SizedBox(
height: 25, height: 25,
width: 50, width: 50,