@@ -54,6 +54,18 @@ class ChatNoSelectedRoomPage extends StatelessWidget with WatchItMixin {
5454 (EditRoomManager m) => m.forgetAllRoomsCommand.progress,
5555 );
5656
57+ final isArchiveActive = watchPropertyValue (
58+ (ChatManager m) => m.archiveActive,
59+ );
60+
61+ final isArchiveEmpty =
62+ watchStream (
63+ (ChatManager m) => m.filteredRoomsStream,
64+ initialValue: di <ChatManager >().filteredRooms,
65+ preserveState: false ,
66+ ).data? .isEmpty ??
67+ true ;
68+
5769 return Scaffold (
5870 appBar: YaruWindowTitleBar (
5971 heroTag: '<Right hero tag>' ,
@@ -91,11 +103,38 @@ class ChatNoSelectedRoomPage extends StatelessWidget with WatchItMixin {
91103 value: progress,
92104 shapePath: _buildBoatPath (),
93105 )
94- : Image .asset ('assets/nebuchadnezzar.png' , width: 100 ),
95- Text (
96- loadingArchive || clearingArchive
97- ? context.l10n.loadingPleaseWait
98- : 'Please select a chatroom from the side panel.' ,
106+ : isArchiveActive
107+ ? CustomPaint (
108+ size: const Size (90 , 90 ),
109+ painter: _PathPainter (
110+ path: _buildArchiveIconPath (),
111+ color: context.theme.colorScheme.primary,
112+ ),
113+ )
114+ : Image .asset (
115+ 'assets/nebuchadnezzar.png' ,
116+ width: 90 ,
117+ height: 90 ,
118+ ),
119+ SizedBox (
120+ width: 300 ,
121+ child: Padding (
122+ padding: const EdgeInsets .symmetric (
123+ horizontal: kMediumPadding,
124+ ),
125+ child: Text (
126+ loadingArchive
127+ ? context.l10n.loadingArchivePleaseWait
128+ : clearingArchive
129+ ? context.l10n.clearingArchivePleaseWait
130+ : isArchiveActive
131+ ? isArchiveEmpty
132+ ? context.l10n.archiveIsEmpty
133+ : context.l10n.pleaseSelectAChatRoom
134+ : context.l10n.pleaseSelectAChatRoom,
135+ textAlign: TextAlign .center,
136+ ),
137+ ),
99138 ),
100139 ],
101140 ),
@@ -120,34 +159,61 @@ class ChatNoSelectedRoomPage extends StatelessWidget with WatchItMixin {
120159
121160 Path _buildArchiveIconPath () {
122161 final path = Path ()
123- // 1. THE LID (Top Part)
124- // Starting at the bottom-left of the lid
125162 ..moveTo (10 , 35 )
126- ..lineTo (90 , 35 ) // Bottom edge of lid
127- ..lineTo (90 , 20 ) // Right side
128- ..quadraticBezierTo (90 , 10 , 80 , 10 ) // Top-right corner
129- ..lineTo (20 , 10 ) // Top edge
130- ..quadraticBezierTo (10 , 10 , 10 , 20 ) // Top-left corner
131- ..close ()
132- // 2. THE BODY (Bottom Part)
163+ ..lineTo (90 , 35 )
164+ ..lineTo (90 , 20 )
165+ ..quadraticBezierTo (90 , 10 , 80 , 10 )
166+ ..lineTo (20 , 10 )
167+ ..quadraticBezierTo (10 , 10 , 10 , 20 )
133168 ..moveTo (15 , 40 )
134- ..lineTo (85 , 40 ) // Top edge of body
135- ..lineTo (85 , 80 ) // Right side
136- ..quadraticBezierTo (85 , 90 , 75 , 90 ) // Bottom-right corner
137- ..lineTo (25 , 90 ) // Bottom edge
138- ..quadraticBezierTo (15 , 90 , 15 , 80 ) // Bottom-left corner
169+ ..lineTo (85 , 40 )
170+ ..lineTo (85 , 80 )
171+ ..quadraticBezierTo (85 , 90 , 75 , 90 )
172+ ..lineTo (25 , 90 )
173+ ..quadraticBezierTo (15 , 90 , 15 , 80 )
139174 ..close ()
140- // 3. THE HANDLE (Slot)
141- // Adding a rounded rectangle cutout in the center
142175 ..addRRect (
143176 RRect .fromRectAndRadius (
144177 const Rect .fromLTWH (35 , 50 , 30 , 10 ),
145178 const Radius .circular (5 ),
146179 ),
147180 )
148- // Set the fill type to evenOdd so the handle appears as a "hole"
149181 ..fillType = PathFillType .evenOdd;
150182
151183 return path;
152184 }
153185}
186+
187+ class _PathPainter extends CustomPainter {
188+ final Path path;
189+ final Color color;
190+
191+ _PathPainter ({required this .path, required this .color});
192+
193+ @override
194+ void paint (Canvas canvas, Size size) {
195+ final pathBounds = path.getBounds ();
196+ final double scaleX = size.width / pathBounds.width;
197+ final double scaleY = size.height / pathBounds.height;
198+ final double scale = scaleX < scaleY ? scaleX : scaleY;
199+
200+ canvas
201+ ..save ()
202+ ..translate (size.width / 2 , size.height / 2 )
203+ ..scale (scale)
204+ ..translate (- pathBounds.center.dx, - pathBounds.center.dy);
205+
206+ final paint = Paint ()
207+ ..color = color
208+ ..style = PaintingStyle .fill;
209+
210+ canvas
211+ ..drawPath (path, paint)
212+ ..restore ();
213+ }
214+
215+ @override
216+ bool shouldRepaint (covariant _PathPainter oldDelegate) {
217+ return oldDelegate.path != path || oldDelegate.color != color;
218+ }
219+ }
0 commit comments