@@ -4,17 +4,25 @@ import 'package:flutter/material.dart';
44
55import 'package:flutter_bloc/flutter_bloc.dart' ;
66
7+ import 'package:webtrit_phone/app/notifications/notifications.dart' ;
78import 'package:webtrit_phone/features/features.dart' ;
89import 'package:webtrit_phone/l10n/l10n.dart' ;
910import 'package:webtrit_phone/models/models.dart' ;
10- import 'package:webtrit_phone/app/notifications/notifications.dart' ;
1111import 'package:webtrit_phone/widgets/widgets.dart' hide ConfirmDialog;
1212
1313class DialogInfo extends StatefulWidget {
14- const DialogInfo (this .userId, this .participantId, {super .key});
14+ const DialogInfo (
15+ this .userId,
16+ this .participantId, {
17+ required this .isAudioCallEnabled,
18+ required this .isVideoCallEnabled,
19+ super .key,
20+ });
1521
1622 final String userId;
1723 final String participantId;
24+ final bool isAudioCallEnabled;
25+ final bool isVideoCallEnabled;
1826
1927 @override
2028 State <DialogInfo > createState () => _DialogInfoState ();
@@ -110,31 +118,22 @@ class _DialogInfoState extends State<DialogInfo> {
110118 ),
111119 const SizedBox (height: 24 ),
112120 if (contact != null && contact.kind == ContactKind .visible) ...[
113- Divider (),
121+ const Divider (),
114122 Expanded (
115123 child: ListView (
116124 children: [
117125 for (ContactPhone contactPhone in contact.phones)
118126 ListTile (
127+ contentPadding: EdgeInsets .zero,
119128 title: Text (contactPhone.number),
120129 trailing: Row (
121130 mainAxisSize: MainAxisSize .min,
122- children: [
123- IconButton (
124- splashRadius: 24 ,
125- icon: const Icon (Icons .call),
126- onPressed: () => _onCall (contactPhone, contact, false ),
127- ),
128- IconButton (
129- splashRadius: 24 ,
130- icon: const Icon (Icons .videocam),
131- onPressed: () => _onCall (contactPhone, contact, true ),
132- ),
133- ],
131+ children: _buildCallActions (contactPhone, contact),
134132 ),
135133 ),
136134 for (ContactEmail contactEmail in contact.emails)
137135 ListTile (
136+ contentPadding: EdgeInsets .zero,
138137 title: Text (contactEmail.address),
139138 trailing: IconButton (
140139 splashRadius: 24 ,
@@ -147,7 +146,7 @@ class _DialogInfoState extends State<DialogInfo> {
147146 ),
148147 const SizedBox (height: 8 ),
149148 ] else
150- Spacer (),
149+ const Spacer (),
151150 ],
152151 ),
153152 );
@@ -170,4 +169,22 @@ class _DialogInfoState extends State<DialogInfo> {
170169 },
171170 );
172171 }
172+
173+ /// Returns a list of call action buttons based on provided configuration.
174+ List <Widget > _buildCallActions (ContactPhone contactPhone, Contact contact) {
175+ return [
176+ if (widget.isAudioCallEnabled)
177+ IconButton (
178+ splashRadius: 24 ,
179+ icon: const Icon (Icons .call),
180+ onPressed: () => _onCall (contactPhone, contact, false ),
181+ ),
182+ if (widget.isVideoCallEnabled)
183+ IconButton (
184+ splashRadius: 24 ,
185+ icon: const Icon (Icons .videocam),
186+ onPressed: () => _onCall (contactPhone, contact, true ),
187+ ),
188+ ];
189+ }
173190}
0 commit comments