All checks were successful
Build CI / AMD64 Build (push) Successful in 1m54s
50 lines
1.5 KiB
Dart
50 lines
1.5 KiB
Dart
import "package:flutter/material.dart";
|
|
import "package:prod/models/editor.dart";
|
|
import "package:prod/models/globalModel.dart";
|
|
import "package:prod/models/project.dart";
|
|
import "package:provider/provider.dart";
|
|
|
|
class EditorSelector extends StatelessWidget {
|
|
const EditorSelector(this.turns, this.id, {super.key});
|
|
final int id;
|
|
final int turns;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
GlobalModel gm = Provider.of<GlobalModel>(context);
|
|
Project prj = gm.nthPrj(id);
|
|
return DropdownMenu(
|
|
enableSearch: true,
|
|
enableFilter: true,
|
|
initialSelection: prj.getEditor(turns),
|
|
leadingIcon: RotatedBox(
|
|
child: Icon(Icons.rounded_corner_rounded),
|
|
quarterTurns: turns,
|
|
),
|
|
onSelected: (a) {
|
|
prj.setEditor(turns, a ?? "");
|
|
gm.updatePrj(id, prj);
|
|
},
|
|
|
|
dropdownMenuEntries:
|
|
[
|
|
const Editor("", "None", "", "", ""),
|
|
...Provider.of<GlobalModel>(context).editors,
|
|
].map((a) {
|
|
return DropdownMenuEntry(
|
|
label: a.name,
|
|
labelWidget: Column(
|
|
crossAxisAlignment: .start,
|
|
mainAxisAlignment: .center,
|
|
children: [
|
|
Text("${a.name}", style: TextStyle(fontSize: 20)),
|
|
Text("${a.commandTemplate}", style: TextStyle(fontSize: 12)),
|
|
],
|
|
),
|
|
value: a.id,
|
|
);
|
|
}).toList(),
|
|
);
|
|
}
|
|
}
|