1+ import 'dart:io' ;
2+
13import 'package:flutter/material.dart' ;
24import 'package:watch_it/watch_it.dart' ;
35import 'package:yaru/yaru.dart' ;
@@ -23,29 +25,22 @@ class WeatherPage extends StatelessWidget with WatchItMixin {
2325 initialIndex: appModel.tabIndex,
2426 length: 2 ,
2527 child: Scaffold (
26- drawer: Drawer (
27- child: Builder (
28- builder: (context) {
29- return SideBar (
30- onSelected: () => Scaffold .of (context).closeDrawer (),
31- );
32- },
33- ),
34- ),
28+ drawer: Platform .isMacOS ? null : const _Drawer (),
29+ endDrawer: Platform .isMacOS ? const _Drawer () : null ,
3530 backgroundColor: Colors .transparent,
3631 appBar: YaruWindowTitleBar (
37- leading: showDrawer
38- ? Builder (
39- builder : (context) {
40- return Center (
41- child : IconButton (
42- onPressed : () => Scaffold . of (context). openDrawer (),
43- icon : const Icon ( YaruIcons .menu),
44- ),
45- );
46- } ,
47- )
48- : null ,
32+ leading: Platform .isMacOS
33+ ? null
34+ : showDrawer
35+ ? const _DrawerButton ()
36+ : null ,
37+ actions : [
38+ if ( Platform .isMacOS && showDrawer)
39+ const Padding (
40+ padding : EdgeInsets . only (right : 8 ),
41+ child : _DrawerButton () ,
42+ ),
43+ ] ,
4944 backgroundColor: Colors .transparent,
5045 border: BorderSide .none,
5146 title: SizedBox (
@@ -64,3 +59,50 @@ class WeatherPage extends StatelessWidget with WatchItMixin {
6459 );
6560 }
6661}
62+
63+ class _DrawerButton extends StatelessWidget {
64+ const _DrawerButton ();
65+
66+ @override
67+ Widget build (BuildContext context) {
68+ return Builder (
69+ builder: (context) {
70+ return Center (
71+ child: IconButton (
72+ onPressed: () {
73+ if (Platform .isMacOS) {
74+ Scaffold .of (context).openEndDrawer ();
75+ } else {
76+ Scaffold .of (context).openDrawer ();
77+ }
78+ },
79+ icon: const Icon (YaruIcons .menu),
80+ ),
81+ );
82+ },
83+ );
84+ }
85+ }
86+
87+ class _Drawer extends StatelessWidget {
88+ const _Drawer ();
89+
90+ @override
91+ Widget build (BuildContext context) {
92+ return Drawer (
93+ child: Builder (
94+ builder: (context) {
95+ return SideBar (
96+ onSelected: () {
97+ if (Platform .isMacOS) {
98+ Scaffold .of (context).closeEndDrawer ();
99+ } else {
100+ Scaffold .of (context).closeDrawer ();
101+ }
102+ },
103+ );
104+ },
105+ ),
106+ );
107+ }
108+ }
0 commit comments