@@ -3,11 +3,13 @@ import 'dart:io';
33import 'package:flutter/foundation.dart' ;
44import 'package:flutter/material.dart' ;
55import 'package:flutter_it/flutter_it.dart' ;
6+ import 'package:liquid_progress_indicator_v2/liquid_progress_indicator.dart' ;
67import 'package:yaru/yaru.dart' ;
78
89import '../../../common/chat_manager.dart' ;
910import '../../../common/view/build_context_x.dart' ;
1011import '../../../common/view/ui_constants.dart' ;
12+ import '../../../l10n/l10n.dart' ;
1113import '../../create_or_edit/edit_room_manager.dart' ;
1214import '../../titlebar/side_bar_button.dart' ;
1315
@@ -40,6 +42,18 @@ class ChatNoSelectedRoomPage extends StatelessWidget with WatchItMixin {
4042 },
4143 );
4244
45+ final loadingArchive = watchValue (
46+ (ChatManager m) => m.toggleArchiveCommand.isRunning,
47+ );
48+
49+ final clearingArchive = watchValue (
50+ (EditRoomManager m) => m.forgetAllRoomsCommand.isRunning,
51+ );
52+
53+ final progress = watchValue (
54+ (EditRoomManager m) => m.forgetAllRoomsCommand.progress,
55+ );
56+
4357 return Scaffold (
4458 appBar: YaruWindowTitleBar (
4559 heroTag: '<Right hero tag>' ,
@@ -61,12 +75,79 @@ class ChatNoSelectedRoomPage extends StatelessWidget with WatchItMixin {
6175 mainAxisSize: MainAxisSize .min,
6276 spacing: kBigPadding,
6377 children: [
64- Image .asset ('assets/nebuchadnezzar.png' , width: 100 ),
65- const Text ('Please select a chatroom from the side panel.' ),
78+ loadingArchive
79+ ? LiquidCustomProgressIndicator (
80+ backgroundColor:
81+ context.theme.colorScheme.surfaceContainerHighest,
82+ direction: Axis .vertical,
83+ value: 0.5 ,
84+ shapePath: _buildArchiveIconPath (),
85+ )
86+ : clearingArchive
87+ ? LiquidCustomProgressIndicator (
88+ backgroundColor:
89+ context.theme.colorScheme.surfaceContainerHighest,
90+ direction: Axis .vertical,
91+ value: progress,
92+ shapePath: _buildBoatPath (),
93+ )
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.' ,
99+ ),
66100 ],
67101 ),
68102 ),
69103 ),
70104 );
71105 }
106+
107+ Path _buildBoatPath () {
108+ return Path ()
109+ ..moveTo (15 , 120 )
110+ ..lineTo (0 , 85 )
111+ ..lineTo (50 , 85 )
112+ ..lineTo (50 , 0 )
113+ ..lineTo (105 , 80 )
114+ ..lineTo (60 , 80 )
115+ ..lineTo (60 , 85 )
116+ ..lineTo (120 , 85 )
117+ ..lineTo (105 , 120 )
118+ ..close ();
119+ }
120+
121+ Path _buildArchiveIconPath () {
122+ final path = Path ()
123+ // 1. THE LID (Top Part)
124+ // Starting at the bottom-left of the lid
125+ ..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)
133+ ..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
139+ ..close ()
140+ // 3. THE HANDLE (Slot)
141+ // Adding a rounded rectangle cutout in the center
142+ ..addRRect (
143+ RRect .fromRectAndRadius (
144+ const Rect .fromLTWH (35 , 50 , 30 , 10 ),
145+ const Radius .circular (5 ),
146+ ),
147+ )
148+ // Set the fill type to evenOdd so the handle appears as a "hole"
149+ ..fillType = PathFillType .evenOdd;
150+
151+ return path;
152+ }
72153}
0 commit comments