-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Comunicação HTTP: Flutter com web API
- Loading branch information
Showing
12 changed files
with
299 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"http_interceptor","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\http_interceptor-0.1.1\\\\","dependencies":[]},{"name":"sqflite","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.1.7+2\\\\","dependencies":[]}],"android":[{"name":"http_interceptor","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\http_interceptor-0.1.1\\\\","dependencies":[]},{"name":"sqflite","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.1.7+2\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"http_interceptor","dependencies":[]},{"name":"sqflite","dependencies":[]}],"date_created":"2020-07-28 09:47:41.675852","version":"1.17.5"} | ||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"http_interceptor","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\http_interceptor-0.1.1\\\\","dependencies":[]},{"name":"sqflite","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.1.7+2\\\\","dependencies":[]}],"android":[{"name":"http_interceptor","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\http_interceptor-0.1.1\\\\","dependencies":[]},{"name":"sqflite","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.1.7+2\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"http_interceptor","dependencies":[]},{"name":"sqflite","dependencies":[]}],"date_created":"2020-07-28 09:51:18.786436","version":"1.17.5"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class ResponseDialog extends StatelessWidget { | ||
final String title; | ||
final String message; | ||
final String buttonText; | ||
final IconData icon; | ||
final Color colorIcon; | ||
|
||
ResponseDialog({ | ||
this.title = "", | ||
this.message = "", | ||
this.icon, | ||
this.buttonText = 'Ok', | ||
this.colorIcon = Colors.black, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return AlertDialog( | ||
title: Visibility( | ||
child: Text(title), | ||
visible: title.isNotEmpty, | ||
), | ||
content: Column( | ||
mainAxisSize: MainAxisSize.min, | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
crossAxisAlignment: CrossAxisAlignment.center, | ||
children: <Widget>[ | ||
Visibility( | ||
child: Padding( | ||
padding: const EdgeInsets.only(top: 16.0), | ||
child: Icon( | ||
icon, | ||
size: 64, | ||
color: colorIcon, | ||
), | ||
), | ||
visible: icon != null, | ||
), | ||
Visibility( | ||
child: Padding( | ||
padding: const EdgeInsets.only(top: 16.0), | ||
child: Text( | ||
message, | ||
textAlign: TextAlign.center, | ||
style: TextStyle( | ||
fontSize: 24.0, | ||
), | ||
), | ||
), | ||
visible: message.isNotEmpty, | ||
) | ||
], | ||
), | ||
actions: <Widget>[ | ||
FlatButton( | ||
child: Text(buttonText), | ||
onPressed: () => Navigator.pop(context), | ||
) | ||
], | ||
); | ||
} | ||
} | ||
|
||
class SuccessDialog extends StatelessWidget { | ||
final String title; | ||
final String message; | ||
final IconData icon; | ||
|
||
SuccessDialog( | ||
this.message, { | ||
this.title = 'Success', | ||
this.icon = Icons.done, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ResponseDialog( | ||
title: title, | ||
message: message, | ||
icon: icon, | ||
colorIcon: Colors.green, | ||
); | ||
} | ||
} | ||
|
||
class FailureDialog extends StatelessWidget { | ||
final String title; | ||
final String message; | ||
final IconData icon; | ||
|
||
FailureDialog( | ||
this.message, { | ||
this.title = 'Failure', | ||
this.icon = Icons.warning, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ResponseDialog( | ||
title: title, | ||
message: message, | ||
icon: icon, | ||
colorIcon: Colors.red, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class TransactionAuthDialog extends StatefulWidget { | ||
final Function(String password) onConfirm; | ||
|
||
TransactionAuthDialog({ | ||
@required this.onConfirm, | ||
}); | ||
|
||
@override | ||
_TransactionAuthDialogState createState() => _TransactionAuthDialogState(); | ||
} | ||
|
||
class _TransactionAuthDialogState extends State<TransactionAuthDialog> { | ||
|
||
final TextEditingController _passwordController = TextEditingController(); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return AlertDialog( | ||
title: Text('Authenticate'), | ||
content: TextField( | ||
controller: _passwordController, | ||
obscureText: true, | ||
maxLength: 4, | ||
decoration: InputDecoration(border: OutlineInputBorder()), | ||
textAlign: TextAlign.center, | ||
keyboardType: TextInputType.number, | ||
style: TextStyle(fontSize: 64, letterSpacing: 24), | ||
), | ||
actions: <Widget>[ | ||
FlatButton( | ||
onPressed: () => Navigator.pop(context), | ||
child: Text('Cancel'), | ||
), | ||
FlatButton( | ||
onPressed: () { | ||
widget.onConfirm(_passwordController.text); | ||
Navigator.pop(context); | ||
}, | ||
child: Text('Confirm'), | ||
), | ||
], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.