Skip to content

Commit

Permalink
💄 Use NavView
Browse files Browse the repository at this point in the history
  • Loading branch information
H2Sxxa committed Jul 29, 2024
1 parent 1f8817c commit 57f6916
Showing 1 changed file with 96 additions and 79 deletions.
175 changes: 96 additions & 79 deletions lib/views/pages/manage_distro.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,97 +48,114 @@ class _DistroManagePageState extends State<DistroManagePage>

@override
Widget build(BuildContext context) {
return AnimationLimiter(
child: ListView(
children: [
Card.filled(
child: Padding(
padding: const EdgeInsets.all(8),
child: Column(
children: [
FilledButton(
onPressed: () =>
WindowsSubSystemLinux.start(distro: widget.distro),
child: WidthInfCenterWidget(
child: context.i18nText("manage.terminal"),
return NavigationView(
backgroundColor: Colors.transparent,
labelType: NavigationLabelType.selected,
items: [
NavigationItem(
icon: Icon(Icons.terminal),
label: "Manage",
page: AnimationLimiter(
child: ListView(
children: [
Card.filled(
child: Padding(
padding: const EdgeInsets.all(8),
child: Column(
children: [
FilledButton(
onPressed: () => WindowsSubSystemLinux.start(
distro: widget.distro),
child: WidthInfCenterWidget(
child: context.i18nText("manage.terminal"),
),
),
FilledButton(
onPressed: () => WindowsSubSystemLinux.start(
distro: widget.distro,
user: "root",
),
child: WidthInfCenterWidget(
child: Text(
context.i18n.getOrKey("manage.terminal") +
context.i18n.getOrKey("manage.root")),
),
)
].eachPadding(),
),
),
FilledButton(
onPressed: () => WindowsSubSystemLinux.start(
distro: widget.distro,
user: "root",
),
child: WidthInfCenterWidget(
child: Text(context.i18n.getOrKey("manage.terminal") +
context.i18n.getOrKey("manage.root")),
),
Card.filled(
child: Padding(
padding: const EdgeInsets.all(8),
child: Column(
children: [
TextField(
controller: exec,
decoration: const InputDecoration(
border: OutlineInputBorder()),
),
FilledButton(
onPressed: () => WindowsSubSystemLinux.exec(
distro: widget.distro,
commands: exec.text.split(" "),
).then(
(value) => refreshMountedFn(() => process = value),
),
child: WidthInfCenterWidget(
child: context.i18nText("manage.execute"),
),
),
FilledButton(
onPressed: () => WindowsSubSystemLinux.exec(
distro: widget.distro,
commands: exec.text.split(" "),
).then(
(value) => refreshMountedFn(() => process = value),
),
child: WidthInfCenterWidget(
child: Text(
context.i18n.getOrKey("manage.execute") +
context.i18n.getOrKey("manage.root")),
),
),
process != null
? ProcessText(
key: ValueKey(process),
process: process!,
codec: utf8,
)
: const SizedBox.shrink(),
].eachPadding(),
),
)
].eachPadding(),
),
),
),
Card.filled(
child: Padding(
padding: const EdgeInsets.all(8),
child: Column(
children: [
TextField(
controller: exec,
decoration:
const InputDecoration(border: OutlineInputBorder()),
),
FilledButton(
onPressed: () => WindowsSubSystemLinux.exec(
distro: widget.distro,
commands: exec.text.split(" "),
).then(
(value) => refreshMountedFn(() => process = value),
),
child: WidthInfCenterWidget(
child: context.i18nText("manage.execute"),
),
].enumerate(
(index, widget) => AnimationConfiguration.staggeredList(
position: index,
child: SlideAnimation(
child: Padding(
padding: const EdgeInsets.all(4),
child: widget,
),
),
FilledButton(
onPressed: () => WindowsSubSystemLinux.exec(
distro: widget.distro,
commands: exec.text.split(" "),
).then(
(value) => refreshMountedFn(() => process = value),
),
child: WidthInfCenterWidget(
child: Text(context.i18n.getOrKey("manage.execute") +
context.i18n.getOrKey("manage.root")),
),
),
process != null
? ProcessText(
key: ValueKey(process),
process: process!,
codec: utf8,
)
: const SizedBox.shrink(),
].eachPadding(),
),
),
),
),
Card.filled(
child: Padding(
),
NavigationItem(
icon: const Icon(Icons.folder),
page: ListView(children: [
Padding(
padding: const EdgeInsets.all(8),
child: WSLExplorerWidget(distro: widget.distro),
),
),
].enumerate(
(index, widget) => AnimationConfiguration.staggeredList(
position: index,
child: SlideAnimation(
child: Padding(
padding: const EdgeInsets.all(4),
child: widget,
),
),
),
),
),
]),
label: "File",
)
],
direction: Axis.horizontal,
);
}
}
Expand Down

0 comments on commit 57f6916

Please sign in to comment.