Skip to content

Commit

Permalink
Add copy to clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernthedev committed Jul 19, 2024
1 parent f3aee87 commit ded9632
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/pages/main/package_list.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:desktop_adb_file_browser/riverpod/package_list.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:freezed_annotation/freezed_annotation.dart';

Expand Down Expand Up @@ -51,6 +52,7 @@ class _PackageListState extends ConsumerState<PackageList> {
return packageMetadataFuture.when(
data: (packageMetadata) => ListTile(
title: Text(packageMetadata.packageName),
subtitle:
Text("${packageMetadata.packageId} - ${packageMetadata.version}"),
leading: const Icon(Icons.apps),
dense: true,
Expand All @@ -59,6 +61,18 @@ class _PackageListState extends ConsumerState<PackageList> {
children: [
IconButton(onPressed: () {}, icon: const Icon(Icons.download)),
IconButton(onPressed: () {}, icon: const Icon(Icons.delete)),
IconButton(
onPressed: () async {
await Clipboard.setData(
ClipboardData(text: packageMetadata.packageId));

if (!context.mounted) return;
const snackBar = SnackBar(
content: Text('Copied package id to clipboard'),
);
ScaffoldMessenger.of(context).showSnackBar(snackBar);
},
icon: const Icon(Icons.copy))
],
),
),
Expand Down

0 comments on commit ded9632

Please sign in to comment.