Page changing on tabs

This commit is contained in:
Win 2025-12-24 12:31:10 +00:00
parent 6883acfff5
commit b7ae3c05c8
1 changed files with 37 additions and 27 deletions

View File

@ -30,30 +30,40 @@ class _Home extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: YaruWindowTitleBar(),
body: YaruMasterDetailPage(
length: 2,
appBar: const YaruWindowTitleBar(),
tileBuilder: (context, index, selected, availableWidth) {
if (index == 0) {
return YaruMasterTile(
return const YaruMasterTile(
title: Text('Home'),
leading: Icon(YaruIcons.home),
);
} else {
return YaruMasterTile(
title: Text('Page 2'),
return const YaruMasterTile(
title: Text('Video'),
leading: Icon(YaruIcons.video_filled),
);
}
},
pageBuilder: (context, index) {
if (index == 0) {
return Center(
return const YaruDetailPage(
appBar: YaruWindowTitleBar(
title: Text('Home'),
),
body: Center(
child: Text('Hello Ubuntu'),
),
);
} else {
return Center(
return const YaruDetailPage(
appBar: YaruWindowTitleBar(
title: Text('Video'),
),
body: Center(
child: Text('Hello Yaru'),
),
);
}
},