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