Skip to content

Commit 8a83877

Browse files
Merge pull request #16 from geeksesi/master
feat: open kerio url by click on the logo
2 parents a3e0926 + 7378ca5 commit 8a83877

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

lib/views/kerio_login.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/material.dart';
22
import 'package:http/http.dart' as http;
33
import 'package:ir_net/data/shared_preferences.dart';
4+
import 'package:url_launcher/url_launcher.dart';
45

56
class KerioLoginView extends StatefulWidget {
67
const KerioLoginView({super.key});
@@ -121,7 +122,15 @@ class _KerioLoginViewState extends State<KerioLoginView> {
121122
hintText: 'Kerio login page IP',
122123
hintStyle: const TextStyle(color: Colors.black38),
123124
suffixIcon: IconButton(
124-
onPressed: null,
125+
onPressed: () {
126+
final url = _ipController.text.trim();
127+
if (url.isNotEmpty) {
128+
final uri = Uri.tryParse(url.startsWith('http') ? url : 'http://$url');
129+
if (uri != null) {
130+
launchUrl(uri);
131+
}
132+
}
133+
},
125134
icon: Image.asset('assets/kerio.png', width: 24, height: 24),
126135
),
127136
),

0 commit comments

Comments
 (0)