From b7ae3c05c8bca561f741373030a8e6924b476d1e Mon Sep 17 00:00:00 2001 From: Win Date: Wed, 24 Dec 2025 12:31:10 +0000 Subject: [PATCH] Page changing on tabs --- my_yaru_app/lib/main.dart | 64 ++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/my_yaru_app/lib/main.dart b/my_yaru_app/lib/main.dart index bbf7f49..503d98e 100644 --- a/my_yaru_app/lib/main.dart +++ b/my_yaru_app/lib/main.dart @@ -30,33 +30,43 @@ class _Home extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( - appBar: YaruWindowTitleBar(), body: YaruMasterDetailPage( - length: 2, - tileBuilder: (context, index, selected, availableWidth) { - if (index == 0) { - return YaruMasterTile( - title: Text('Home'), - leading: Icon(YaruIcons.home), - ); - } else { - return YaruMasterTile( - title: Text('Page 2'), - leading: Icon(YaruIcons.video_filled), - ); - } - }, - pageBuilder: (context, index) { - if (index == 0) { - return Center( - child: Text('Hello Ubuntu'), - ); - } else { - return Center( - child: Text('Hello Yaru'), - ); - } - }, - )); + length: 2, + appBar: const YaruWindowTitleBar(), + tileBuilder: (context, index, selected, availableWidth) { + if (index == 0) { + return const YaruMasterTile( + title: Text('Home'), + leading: Icon(YaruIcons.home), + ); + } else { + return const YaruMasterTile( + title: Text('Video'), + leading: Icon(YaruIcons.video_filled), + ); + } + }, + pageBuilder: (context, index) { + if (index == 0) { + return const YaruDetailPage( + appBar: YaruWindowTitleBar( + title: Text('Home'), + ), + body: Center( + child: Text('Hello Ubuntu'), + ), + ); + } else { + return const YaruDetailPage( + appBar: YaruWindowTitleBar( + title: Text('Video'), + ), + body: Center( + child: Text('Hello Yaru'), + ), + ); + } + }, + )); } }