@@ -169,9 +169,10 @@ class _SearchAddBar extends StatelessWidget {
169169 ),
170170 const SizedBox (width: AppSpacing .lg),
171171 FilledButton .icon (
172- onPressed: onAdd,
173- icon: const Icon (Icons .add),
174- label: const Text ('Add Peer' )),
172+ onPressed: () => _showAddPeerDialog (context),
173+ icon: const Icon (Icons .add),
174+ label: const Text ('Add Peer' ),
175+ ),
175176 ],
176177 );
177178 }
@@ -317,9 +318,10 @@ class _PeersEmptyState extends StatelessWidget {
317318 Theme .of (context).colorScheme.onSurface.withOpacity (0.6 ))),
318319 const SizedBox (height: AppSpacing .xxl),
319320 FilledButton .icon (
320- onPressed: () {},
321- icon: const Icon (Icons .add),
322- label: const Text ('Add Peer' )),
321+ onPressed: () => _showAddPeerDialog (context),
322+ icon: const Icon (Icons .add),
323+ label: const Text ('Add Peer' ),
324+ ),
323325 ],
324326 );
325327 }
@@ -359,3 +361,37 @@ class _SummaryItem extends StatelessWidget {
359361 );
360362 }
361363}
364+
365+ void _showAddPeerDialog (BuildContext context) {
366+ final controller = TextEditingController ();
367+
368+ showDialog (
369+ context: context,
370+ builder: (context) => AlertDialog (
371+ title: const Text ('Add Peer' ),
372+ content: TextField (
373+ controller: controller,
374+ decoration: const InputDecoration (
375+ hintText: 'Enter peer IP' ,
376+ ),
377+ keyboardType: TextInputType .url,
378+ ),
379+ actions: [
380+ TextButton (
381+ onPressed: () => Navigator .of (context).pop (),
382+ child: const Text ('Cancel' ),
383+ ),
384+ ElevatedButton (
385+ onPressed: () {
386+ final ip = controller.text.trim ();
387+ if (ip.isNotEmpty) {
388+ print ('Add peer: $ip ' );
389+ }
390+ Navigator .of (context).pop ();
391+ },
392+ child: const Text ('Add' ),
393+ ),
394+ ],
395+ ),
396+ );
397+ }
0 commit comments