mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 22:09:06 +00:00
[linting_tool] Implement exporting profiles (#869)
This commit is contained in:
committed by
GitHub
parent
a46327ef80
commit
9986fe2f2c
@@ -45,7 +45,7 @@ class SavedLintsPage extends StatelessWidget {
|
||||
),
|
||||
itemCount: profilesStore.savedProfiles.length,
|
||||
cacheExtent: 5,
|
||||
itemBuilder: (context, index) {
|
||||
itemBuilder: (itemBuilderContext, index) {
|
||||
var profile = profilesStore.savedProfiles[index];
|
||||
return ListTile(
|
||||
title: Text(
|
||||
@@ -74,10 +74,21 @@ class SavedLintsPage extends StatelessWidget {
|
||||
),
|
||||
PopupMenuButton<String>(
|
||||
icon: const Icon(Icons.more_vert),
|
||||
onSelected: (value) {
|
||||
onSelected: (value) async {
|
||||
switch (value) {
|
||||
case 'Export file':
|
||||
// TODO(abd99): Implement exporting files.
|
||||
// TODO(abd99): Add option to select formatting style.
|
||||
|
||||
var saved = await profilesStore
|
||||
.exportProfileFile(profile);
|
||||
|
||||
if (!saved) {
|
||||
_showSnackBar(
|
||||
context,
|
||||
profilesStore.error ?? 'Failed to save file.',
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
case 'Delete':
|
||||
profilesStore.deleteProfile(profile);
|
||||
@@ -123,4 +134,12 @@ class SavedLintsPage extends StatelessWidget {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void _showSnackBar(BuildContext context, String data) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(data),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user