Skip to content
This repository was archived by the owner on Jan 5, 2021. It is now read-only.

Commit e78f3b5

Browse files
author
Luis Correa
committed
webview portal nauta
1 parent f1fd4d5 commit e78f3b5

File tree

3 files changed

+80
-24
lines changed

3 files changed

+80
-24
lines changed

lib/components/login_form.dart

Lines changed: 71 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import 'package:todo/pages/connected_page.dart';
66

77
import 'package:nauta_api/nauta_api.dart';
88

9+
import 'package:webview_flutter/webview_flutter.dart';
10+
911
class LoginForm extends StatefulWidget {
1012
@override
1113
_LoginFormState createState() => _LoginFormState();
@@ -53,7 +55,7 @@ class _LoginFormState extends State<LoginForm> {
5355
labelText: 'Username',
5456
prefixIcon: Icon(
5557
Icons.alternate_email,
56-
size: 32,
58+
size: 28,
5759
)),
5860
validator: (value) {
5961
if (value.isEmpty) {
@@ -74,7 +76,7 @@ class _LoginFormState extends State<LoginForm> {
7476
labelText: 'Contraseña',
7577
prefixIcon: Icon(
7678
Icons.lock_outline,
77-
size: 32,
79+
size: 28,
7880
),
7981
),
8082
validator: (value) {
@@ -98,17 +100,33 @@ class _LoginFormState extends State<LoginForm> {
98100
onPressed: login,
99101
),
100102
),
101-
Padding(
102-
padding: EdgeInsets.all(5.0),
103-
child: MaterialButton(
104-
color: Colors.lightBlue,
105-
child: Text(
106-
'Consultar crédito',
107-
style: TextStyle(color: Colors.white),
103+
Row(
104+
mainAxisAlignment: MainAxisAlignment.center,
105+
children: <Widget>[
106+
Padding(
107+
padding: EdgeInsets.all(2.0),
108+
child: MaterialButton(
109+
color: Colors.lightBlue,
110+
child: Text(
111+
'Consultar crédito',
112+
style: TextStyle(color: Colors.white),
113+
),
114+
onPressed: credit,
115+
),
108116
),
109-
onPressed: credit,
110-
),
111-
)
117+
Padding(
118+
padding: EdgeInsets.all(2.0),
119+
child: MaterialButton(
120+
color: Colors.lightBlue,
121+
child: Text(
122+
'Portal Nauta',
123+
style: TextStyle(color: Colors.white),
124+
),
125+
onPressed: portalNauta,
126+
),
127+
)
128+
],
129+
),
112130
],
113131
),
114132
);
@@ -138,21 +156,25 @@ class _LoginFormState extends State<LoginForm> {
138156
await pr.hide();
139157

140158
Navigator.pushReplacement(
141-
context,
142-
MaterialPageRoute(
143-
builder: (context) => ConnectedPage(
144-
title: 'Conectado',
145-
username: _user.username,
146-
)));
159+
context,
160+
MaterialPageRoute(
161+
builder: (context) => ConnectedPage(
162+
title: 'Conectado',
163+
username: _user.username,
164+
),
165+
),
166+
);
147167
} on NautaException catch (e) {
148168
await pr.hide();
149-
Scaffold.of(context).showSnackBar(SnackBar(
150-
backgroundColor: Colors.red,
151-
content: Text(
152-
e.message,
153-
style: TextStyle(fontWeight: FontWeight.w800, fontSize: 18),
169+
Scaffold.of(context).showSnackBar(
170+
SnackBar(
171+
backgroundColor: Colors.red,
172+
content: Text(
173+
e.message,
174+
style: TextStyle(fontWeight: FontWeight.w800, fontSize: 18),
175+
),
154176
),
155-
));
177+
);
156178
}
157179
} // end if (form.validate())
158180
} // end login()
@@ -200,4 +222,29 @@ class _LoginFormState extends State<LoginForm> {
200222
}
201223
} // end if (form.validate())
202224
} // end credit()
225+
226+
void portalNauta() {
227+
Navigator.push(
228+
context,
229+
MaterialPageRoute(
230+
builder: (context) => PortalNauta(),
231+
),
232+
);
233+
}
234+
}
235+
236+
class PortalNauta extends StatelessWidget {
237+
@override
238+
Widget build(BuildContext context) {
239+
return Scaffold(
240+
appBar: AppBar(
241+
title: Text('Portal Nauta'),
242+
elevation: 0,
243+
),
244+
body: WebView(
245+
initialUrl: "https://www.portal.nauta.cu",
246+
javascriptMode: JavascriptMode.unrestricted,
247+
),
248+
);
249+
}
203250
}

pubspec.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,13 @@ packages:
315315
url: "https://pub.dartlang.org"
316316
source: hosted
317317
version: "2.0.8"
318+
webview_flutter:
319+
dependency: "direct main"
320+
description:
321+
name: webview_flutter
322+
url: "https://pub.dartlang.org"
323+
source: hosted
324+
version: "0.3.22+1"
318325
xml:
319326
dependency: transitive
320327
description:

pubspec.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ dependencies:
3535
permission_handler: ^3.1.0
3636
shared_preferences: ^0.5.7
3737
progress_dialog: ^1.2.4
38+
webview_flutter: ^0.3.22+1
39+
3840

3941
# The following adds the Cupertino Icons font to your application.
4042
# Use with the CupertinoIcons class for iOS style icons.

0 commit comments

Comments
 (0)