-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Open
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectp: pigeonrelated to pigeon messaging codegen toolrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem team
Description
For macOS file_selector I wanted to define panel options that followed the macOS panel class structure, which is that NSOpenPanel is an NSSavePanel so inherits its properties. I tried:
class SavePanelOptions {
SavePanelOptions({
this.directoryPath,
this.nameFieldStringValue,
this.prompt,
});
String? directoryPath;
String? nameFieldStringValue;
String? prompt;
}
class OpenPanelOptions extends SavePanelOptions {
OpenPanelOptions({
super.directoryPath,
super.nameFieldStringValue,
super.prompt,
this.allowsMultipleSelection = false,
this.canChooseDirectories = false,
this.canChooseFiles = true,
});
bool allowsMultipleSelection;
bool canChooseDirectories;
bool canChooseFiles;
}
The resulting output only has the direct properties though, not the inherited properties. For instance, the Dart is:
class SavePanelOptions {
SavePanelOptions({
this.directoryPath,
this.nameFieldStringValue,
this.prompt,
});
String? directoryPath;
String? nameFieldStringValue;
String? prompt;
Object encode() {...}
static SavePanelOptions decode(Object result) {...}
}
class OpenPanelOptions {
OpenPanelOptions({
required this.allowsMultipleSelection,
required this.canChooseDirectories,
required this.canChooseFiles,
});
bool allowsMultipleSelection;
bool canChooseDirectories;
bool canChooseFiles;
Object encode() {...}
static OpenPanelOptions decode(Object result) {...}
}
I can work around it by using composition instead of inheritance but it makes it more clunky to use on both sides.
mateominato, andreasgangso, mpp-konrado, KoheiKanagu, Robert-SD and 16 more
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectp: pigeonrelated to pigeon messaging codegen toolrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem team