@@ -7,12 +7,15 @@ import 'package:flutter/services.dart';
77import 'package:future_loading_dialog/future_loading_dialog.dart' ;
88import 'package:matrix/encryption.dart' ;
99import 'package:matrix/matrix.dart' ;
10+ import 'package:yaru/yaru.dart' ;
1011
1112import '../../../common/view/build_context_x.dart' ;
1213import '../../../l10n/l10n.dart' ;
1314import '../../view/chat_avatar.dart' ;
15+ import '../../view/chat_master/chat_master_detail_page.dart' ;
1416
15- // TODO: code by fluffy-chat, replace
17+ // Credit: this code has been initially copied from https://github.com/krille-chan/fluffychat
18+ // Thank you @krille-chan
1619class KeyVerificationDialog extends StatefulWidget {
1720 Future <void > show (BuildContext context) => showAdaptiveDialog (
1821 context: context,
@@ -21,14 +24,10 @@ class KeyVerificationDialog extends StatefulWidget {
2124 );
2225
2326 final KeyVerification request;
24- final Function ()? onCancel;
25- final Function ()? onDone;
2627
2728 const KeyVerificationDialog ({
2829 super .key,
2930 required this .request,
30- this .onCancel,
31- this .onDone,
3231 });
3332
3433 @override
@@ -188,7 +187,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
188187 );
189188 buttons.add (
190189 TextButton .icon (
191- icon: const Icon (Icons .close ),
190+ icon: const Icon (YaruIcons .window_close ),
192191 style: TextButton .styleFrom (foregroundColor: Colors .red),
193192 label: Text (l10n.reject),
194193 onPressed: () => widget.request.rejectVerification ().then ((_) {
@@ -200,7 +199,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
200199 );
201200 buttons.add (
202201 TextButton .icon (
203- icon: const Icon (Icons .check ),
202+ icon: const Icon (YaruIcons .checkmark ),
204203 label: Text (l10n.accept),
205204 onPressed: () => widget.request.acceptVerification (),
206205 ),
@@ -233,7 +232,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
233232 );
234233 buttons.add (
235234 TextButton .icon (
236- icon: const Icon (Icons .close ),
235+ icon: const Icon (YaruIcons .window_close ),
237236 label: Text (l10n.cancel),
238237 onPressed: () => widget.request.cancel (),
239238 ),
@@ -273,7 +272,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
273272 );
274273 buttons.add (
275274 TextButton .icon (
276- icon: const Icon (Icons .close ),
275+ icon: const Icon (YaruIcons .window_close ),
277276 style: TextButton .styleFrom (
278277 foregroundColor: Colors .red,
279278 ),
@@ -283,7 +282,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
283282 );
284283 buttons.add (
285284 TextButton .icon (
286- icon: const Icon (Icons .check_outlined ),
285+ icon: const Icon (YaruIcons .checkmark ),
287286 label: Text (l10n.theyMatch),
288287 onPressed: () => widget.request.acceptSas (),
289288 ),
@@ -308,7 +307,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
308307 mainAxisSize: MainAxisSize .min,
309308 children: < Widget > [
310309 const Icon (
311- Icons .check_circle_outlined ,
310+ YaruIcons .ok ,
312311 color: Colors .green,
313312 size: 128.0 ,
314313 ),
@@ -325,12 +324,17 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
325324 l10n.close,
326325 ),
327326 onPressed: () {
328- widget.onDone? .call ();
329327 if (context.mounted) {
330328 Navigator .of (
331329 context,
332330 rootNavigator: false ,
333331 ).pop ();
332+ Navigator .of (context).pushAndRemoveUntil (
333+ MaterialPageRoute (
334+ builder: (_) => const ChatMasterDetailPage (),
335+ ),
336+ (route) => false ,
337+ );
334338 }
335339 },
336340 ),
@@ -340,7 +344,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
340344 body = Column (
341345 mainAxisSize: MainAxisSize .min,
342346 children: < Widget > [
343- const Icon (Icons .cancel , color: Colors .red, size: 128.0 ),
347+ const Icon (YaruIcons .edit_clear , color: Colors .red, size: 128.0 ),
344348 const SizedBox (height: 16 ),
345349 Text (
346350 'Error ${widget .request .canceledCode }: ${widget .request .canceledReason }' ,
0 commit comments