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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: YaruWindowTitleBar(),
body: YaruMasterDetailPage( body: YaruMasterDetailPage(
length: 2, length: 2,
appBar: const YaruWindowTitleBar(),
tileBuilder: (context, index, selected, availableWidth) { tileBuilder: (context, index, selected, availableWidth) {
if (index == 0) { if (index == 0) {
return YaruMasterTile( return const YaruMasterTile(
title: Text('Home'), title: Text('Home'),
leading: Icon(YaruIcons.home), leading: Icon(YaruIcons.home),
); );
} else { } else {
return YaruMasterTile( return const YaruMasterTile(
title: Text('Page 2'), title: Text('Video'),
leading: Icon(YaruIcons.video_filled), leading: Icon(YaruIcons.video_filled),
); );
} }
}, },
pageBuilder: (context, index) { pageBuilder: (context, index) {
if (index == 0) { if (index == 0) {
return Center( return const YaruDetailPage(
appBar: YaruWindowTitleBar(
title: Text('Home'),
),
body: Center(
child: Text('Hello Ubuntu'), child: Text('Hello Ubuntu'),
),
); );
} else { } else {
return Center( return const YaruDetailPage(
appBar: YaruWindowTitleBar(
title: Text('Video'),
),
body: Center(
child: Text('Hello Yaru'), child: Text('Hello Yaru'),
),
); );
} }
}, },