Compare commits
22 Commits
Author | SHA1 | Date | |
---|---|---|---|
7750126ee4 | |||
e4540dd3e5 | |||
0d1ea5d66f | |||
53342d5520 | |||
1fd6e56208 | |||
2aeacb034b | |||
c2e260293c | |||
beea120e04 | |||
463aa47a52 | |||
fa90ba8c21 | |||
23dedfb726 | |||
e7b4744016 | |||
29338f807b | |||
be4804fad1 | |||
595e63c4a7 | |||
327b18049b | |||
105f3f0229 | |||
28c79a6ad2 | |||
b2f15acda8 | |||
189c866f58 | |||
e5680bb350 | |||
7a0731ba85 |
207
covas_mobile/lib/MyHomePage.dart
Normal file
207
covas_mobile/lib/MyHomePage.dart
Normal file
@@ -0,0 +1,207 @@
|
|||||||
|
// ignore_for_file: unnecessary_brace_in_string_interps
|
||||||
|
|
||||||
|
import 'dart:io';
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:covas_mobile/classes/alert.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
|
import 'variable/globals.dart' as globals;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
runApp(const MyApp());
|
||||||
|
}
|
||||||
|
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
const MyApp({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
// This widget is the root of your application.
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MaterialApp(
|
||||||
|
title: 'Flutter Demo',
|
||||||
|
theme: ThemeData(
|
||||||
|
// This is the theme of your application.
|
||||||
|
//
|
||||||
|
// Try running your application with "flutter run". You'll see the
|
||||||
|
// application has a blue toolbar. Then, without quitting the app, try
|
||||||
|
// changing the primarySwatch below to Colors.green and then invoke
|
||||||
|
// "hot reload" (press "r" in the console where you ran "flutter run",
|
||||||
|
// or simply save your changes to "hot reload" in a Flutter IDE).
|
||||||
|
// Notice that the counter didn't reset back to zero; the application
|
||||||
|
// is not restarted.
|
||||||
|
primarySwatch: Colors.blue,
|
||||||
|
),
|
||||||
|
home: const MyHomePage(title: 'Flutter Demo Home Page'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MyHomePage extends StatefulWidget {
|
||||||
|
const MyHomePage({Key? key, required this.title}) : super(key: key);
|
||||||
|
|
||||||
|
// This widget is the home page of your application. It is stateful, meaning
|
||||||
|
// that it has a State object (defined below) that contains fields that affect
|
||||||
|
// how it looks.
|
||||||
|
|
||||||
|
// This class is the configuration for the state. It holds the values (in this
|
||||||
|
// case the title) provided by the parent (in this case the App widget) and
|
||||||
|
// used by the build method of the State. Fields in a Widget subclass are
|
||||||
|
// always marked "final".
|
||||||
|
|
||||||
|
final String title;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MyHomePage> createState() => _MyHomePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MyHomePageState extends State<MyHomePage> with ShowErrorDialog {
|
||||||
|
String listUser = "";
|
||||||
|
|
||||||
|
Future<void> _incrementCounter() async {
|
||||||
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
var user = prefs.getString("user") ?? "";
|
||||||
|
var jwt = prefs.getString("jwt") ?? "";
|
||||||
|
String former = "";
|
||||||
|
|
||||||
|
if ((user.isNotEmpty) && (jwt.isNotEmpty)) {
|
||||||
|
var urlGet = Uri.parse("http://${globals.api}/users");
|
||||||
|
|
||||||
|
var responseGet = await http
|
||||||
|
.get(urlGet, headers: {HttpHeaders.cookieHeader: '${jwt}; ${user}'});
|
||||||
|
|
||||||
|
stderr.writeln('Response Get status: ${responseGet.statusCode}');
|
||||||
|
if (responseGet.statusCode == 200) {
|
||||||
|
stderr.writeln('Response Get body: ${responseGet.body}');
|
||||||
|
var json = jsonDecode(responseGet.body);
|
||||||
|
for (var user in json) {
|
||||||
|
former = "$former\n ${user['name']}";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var text = "";
|
||||||
|
switch (responseGet.statusCode) {
|
||||||
|
case 400:
|
||||||
|
{
|
||||||
|
text = "Requête mal construite";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 406:
|
||||||
|
{
|
||||||
|
text = "Mot de passe incorrect";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 404:
|
||||||
|
{
|
||||||
|
text = "Utilisateur inconnu";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 403:
|
||||||
|
{
|
||||||
|
text = "Vous n'avez pas l'autorisation de faire cette action";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 410:
|
||||||
|
{
|
||||||
|
text = "Token invalide";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 500:
|
||||||
|
{
|
||||||
|
text = "Probleme interne du serveur";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
text = "Probleme d'authentification inconnu";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
showErrorDialog(context, text);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
showErrorDialog(context, "Cache invalide");
|
||||||
|
}
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
// This call to setState tells the Flutter framework that something has
|
||||||
|
// changed in this State, which causes it to rerun the build method below
|
||||||
|
// so that the display can reflect the updated values. If we changed
|
||||||
|
// _counter without calling setState(), then the build method would not be
|
||||||
|
// called again, and so nothing would appear to happen.
|
||||||
|
listUser = former;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
final _formKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
// This method is rerun every time setState is called, for instance as done
|
||||||
|
// by the _incrementCounter method above.
|
||||||
|
//
|
||||||
|
// The Flutter framework has been optimized to make rerunning build methods
|
||||||
|
// fast, so that you can just rebuild anything that needs updating rather
|
||||||
|
// than having to individually change instances of widgets.
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
// Here we take the value from the MyHomePage object that was created by
|
||||||
|
// the App.build method, and use it to set our appbar title.
|
||||||
|
title: Text(widget.title),
|
||||||
|
),
|
||||||
|
body: Center(
|
||||||
|
// Center is a layout widget. It takes a single child and positions it
|
||||||
|
// in the middle of the parent.
|
||||||
|
child: Column(
|
||||||
|
// Column is also a layout widget. It takes a list of children and
|
||||||
|
// arranges them vertically. By default, it sizes itself to fit its
|
||||||
|
// children horizontally, and tries to be as tall as its parent.
|
||||||
|
//
|
||||||
|
// Invoke "debug painting" (press "p" in the console, choose the
|
||||||
|
// "Toggle Debug Paint" action from the Flutter Inspector in Android
|
||||||
|
// Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
|
||||||
|
// to see the wireframe for each widget.
|
||||||
|
//
|
||||||
|
// Column has various properties to control how it sizes itself and
|
||||||
|
// how it positions its children. Here we use mainAxisAlignment to
|
||||||
|
// center the children vertically; the main axis here is the vertical
|
||||||
|
// axis because Columns are vertical (the cross axis would be
|
||||||
|
// horizontal).
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Form(
|
||||||
|
key: _formKey,
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
// Add TextFormFields and ElevatedButton here.
|
||||||
|
TextFormField(
|
||||||
|
// The validator receives the text that the user has entered.
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return 'Please enter some text';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Text(
|
||||||
|
'You have pushed the button this many times:',
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'$listUser',
|
||||||
|
style: Theme.of(context).textTheme.headline4,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
floatingActionButton: FloatingActionButton(
|
||||||
|
onPressed: _incrementCounter,
|
||||||
|
tooltip: 'Increment',
|
||||||
|
child: const Icon(Icons.add),
|
||||||
|
), // This trailing comma makes auto-formatting nicer for build methods.
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
32
covas_mobile/lib/classes/alert.dart
Normal file
32
covas_mobile/lib/classes/alert.dart
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../main.dart';
|
||||||
|
|
||||||
|
mixin ShowErrorDialog<T extends StatefulWidget> on State<T> {
|
||||||
|
void showErrorDialog(BuildContext context, String text) {
|
||||||
|
// Create AlertDialog
|
||||||
|
AlertDialog dialog = AlertDialog(
|
||||||
|
title: Text("Error"),
|
||||||
|
content: Text(text),
|
||||||
|
actions: [
|
||||||
|
ElevatedButton(
|
||||||
|
child: Text("OK"),
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
primary: Colors.red,
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 50, vertical: 20),
|
||||||
|
textStyle:
|
||||||
|
TextStyle(fontSize: 15, fontWeight: FontWeight.normal)),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop("Yes, Of course!"); // Return value
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
// Call showDialog function to show dialog.
|
||||||
|
Future futureValue = showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return dialog;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@@ -1,115 +1,231 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'MyHomePage.dart';
|
||||||
|
|
||||||
|
import 'classes/alert.dart';
|
||||||
|
|
||||||
|
import 'variable/globals.dart' as globals;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
runApp(const MyApp());
|
runApp(MyApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
const MyApp({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
// This widget is the root of your application.
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
title: 'Flutter Demo',
|
debugShowCheckedModeBanner: false,
|
||||||
theme: ThemeData(
|
home: LoginDemo(),
|
||||||
// This is the theme of your application.
|
|
||||||
//
|
|
||||||
// Try running your application with "flutter run". You'll see the
|
|
||||||
// application has a blue toolbar. Then, without quitting the app, try
|
|
||||||
// changing the primarySwatch below to Colors.green and then invoke
|
|
||||||
// "hot reload" (press "r" in the console where you ran "flutter run",
|
|
||||||
// or simply save your changes to "hot reload" in a Flutter IDE).
|
|
||||||
// Notice that the counter didn't reset back to zero; the application
|
|
||||||
// is not restarted.
|
|
||||||
primarySwatch: Colors.blue,
|
|
||||||
),
|
|
||||||
home: const MyHomePage(title: 'Flutter Demo Home Page'),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyHomePage extends StatefulWidget {
|
class LoginDemo extends StatefulWidget {
|
||||||
const MyHomePage({Key? key, required this.title}) : super(key: key);
|
|
||||||
|
|
||||||
// This widget is the home page of your application. It is stateful, meaning
|
|
||||||
// that it has a State object (defined below) that contains fields that affect
|
|
||||||
// how it looks.
|
|
||||||
|
|
||||||
// This class is the configuration for the state. It holds the values (in this
|
|
||||||
// case the title) provided by the parent (in this case the App widget) and
|
|
||||||
// used by the build method of the State. Fields in a Widget subclass are
|
|
||||||
// always marked "final".
|
|
||||||
|
|
||||||
final String title;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<MyHomePage> createState() => _MyHomePageState();
|
_LoginDemoState createState() => _LoginDemoState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _MyHomePageState extends State<MyHomePage> {
|
class _LoginDemoState extends State<LoginDemo> with ShowErrorDialog {
|
||||||
int _counter = 0;
|
TextEditingController inputPseudo = TextEditingController();
|
||||||
|
TextEditingController inputPassword = TextEditingController();
|
||||||
|
Future<void> _login(BuildContext context) async {
|
||||||
|
var url = Uri.parse("http://${globals.api}/token");
|
||||||
|
var pseudo = inputPseudo.text;
|
||||||
|
var password = inputPassword.text;
|
||||||
|
if ((pseudo.isNotEmpty) && (password.isNotEmpty)) {
|
||||||
|
try {
|
||||||
|
String credentials = "${pseudo}:${password}";
|
||||||
|
Codec<String, String> stringToBase64 = utf8.fuse(base64);
|
||||||
|
String encoded = stringToBase64.encode(credentials);
|
||||||
|
var response = await http.get(url, headers: {
|
||||||
|
HttpHeaders.authorizationHeader: 'Basic $encoded',
|
||||||
|
});
|
||||||
|
|
||||||
void _incrementCounter() {
|
if ((response.statusCode == 200) || (response.statusCode == 201)) {
|
||||||
setState(() {
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
// This call to setState tells the Flutter framework that something has
|
|
||||||
// changed in this State, which causes it to rerun the build method below
|
var cookies = response.headers["set-cookie"].toString().split(";");
|
||||||
// so that the display can reflect the updated values. If we changed
|
for (var cookie in cookies) {
|
||||||
// _counter without calling setState(), then the build method would not be
|
var cookiesMany = cookie.split(",");
|
||||||
// called again, and so nothing would appear to happen.
|
for (var cookie2 in cookiesMany) {
|
||||||
_counter++;
|
switch (cookie2.split("=")[0]) {
|
||||||
});
|
case "jwt":
|
||||||
|
{
|
||||||
|
prefs.setString("jwt", cookie2.toString());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "user":
|
||||||
|
{
|
||||||
|
prefs.setString("user", cookie2.toString());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (_) => MyHomePage(title: 'Flutter Demo')));
|
||||||
|
} else {
|
||||||
|
var text = "";
|
||||||
|
switch (response.statusCode) {
|
||||||
|
case 400:
|
||||||
|
{
|
||||||
|
text = "Requête mal construite";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 406:
|
||||||
|
{
|
||||||
|
text = "Mot de passe incorrect";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 404:
|
||||||
|
{
|
||||||
|
text = "Utilisateur inconnu";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 403:
|
||||||
|
{
|
||||||
|
text = "Utilisateur desactive";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 410:
|
||||||
|
{
|
||||||
|
text = "Token invalide";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 500:
|
||||||
|
{
|
||||||
|
text = "Probleme interne du serveur";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
text = "Probleme d'authentification inconnu";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
showErrorDialog(context, text);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
showErrorDialog(context, "${e}");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
showErrorDialog(context, "Champ vide");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void start() async {
|
||||||
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
var jwt = prefs.getString("jwt") ?? "";
|
||||||
|
var user = prefs.getString("user") ?? "";
|
||||||
|
if ((jwt.isNotEmpty) && (user.isNotEmpty)) {
|
||||||
|
var urlToken = Uri.parse("http://${globals.api}/token");
|
||||||
|
|
||||||
|
var responseToken = await http.get(urlToken,
|
||||||
|
headers: {HttpHeaders.cookieHeader: '${jwt}; ${user}'});
|
||||||
|
if (responseToken.statusCode == 200) {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (_) => MyHomePage(title: 'Flutter Demo')));
|
||||||
|
} else {
|
||||||
|
prefs.remove("jwt");
|
||||||
|
prefs.remove("user");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
start();
|
||||||
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// This method is rerun every time setState is called, for instance as done
|
|
||||||
// by the _incrementCounter method above.
|
|
||||||
//
|
|
||||||
// The Flutter framework has been optimized to make rerunning build methods
|
|
||||||
// fast, so that you can just rebuild anything that needs updating rather
|
|
||||||
// than having to individually change instances of widgets.
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
// Here we take the value from the MyHomePage object that was created by
|
title: Text("Login Page"),
|
||||||
// the App.build method, and use it to set our appbar title.
|
|
||||||
title: Text(widget.title),
|
|
||||||
),
|
),
|
||||||
body: Center(
|
body: SingleChildScrollView(
|
||||||
// Center is a layout widget. It takes a single child and positions it
|
|
||||||
// in the middle of the parent.
|
|
||||||
child: Column(
|
child: Column(
|
||||||
// Column is also a layout widget. It takes a list of children and
|
|
||||||
// arranges them vertically. By default, it sizes itself to fit its
|
|
||||||
// children horizontally, and tries to be as tall as its parent.
|
|
||||||
//
|
|
||||||
// Invoke "debug painting" (press "p" in the console, choose the
|
|
||||||
// "Toggle Debug Paint" action from the Flutter Inspector in Android
|
|
||||||
// Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
|
|
||||||
// to see the wireframe for each widget.
|
|
||||||
//
|
|
||||||
// Column has various properties to control how it sizes itself and
|
|
||||||
// how it positions its children. Here we use mainAxisAlignment to
|
|
||||||
// center the children vertically; the main axis here is the vertical
|
|
||||||
// axis because Columns are vertical (the cross axis would be
|
|
||||||
// horizontal).
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
const Text(
|
Padding(
|
||||||
'You have pushed the button this many times:',
|
padding: const EdgeInsets.only(top: 60.0),
|
||||||
|
child: Center(
|
||||||
|
child: Container(
|
||||||
|
width: 200,
|
||||||
|
height: 150,
|
||||||
|
/*decoration: BoxDecoration(
|
||||||
|
color: Colors.red,
|
||||||
|
borderRadius: BorderRadius.circular(50.0)),*/
|
||||||
|
child: Image.asset('asset/images/flutter-logo.png')),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Padding(
|
||||||
'$_counter',
|
//padding: const EdgeInsets.only(left:15.0,right: 15.0,top:0,bottom: 0),
|
||||||
style: Theme.of(context).textTheme.headline4,
|
padding: EdgeInsets.symmetric(horizontal: 15),
|
||||||
|
child: TextField(
|
||||||
|
controller: inputPseudo,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
labelText: 'Pseudo',
|
||||||
|
hintText: 'Enter pseudo existent'),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
||||||
|
//padding: EdgeInsets.symmetric(horizontal: 15),
|
||||||
|
child: TextField(
|
||||||
|
controller: inputPassword,
|
||||||
|
obscureText: true,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
labelText: 'Password',
|
||||||
|
hintText: 'Enter secure password'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
FlatButton(
|
||||||
|
onPressed: () {
|
||||||
|
//TODO FORGOT PASSWORD SCREEN GOES HERE
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'Forgot Password',
|
||||||
|
style: TextStyle(color: Colors.blue, fontSize: 15),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
height: 50,
|
||||||
|
width: 250,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.blue, borderRadius: BorderRadius.circular(20)),
|
||||||
|
child: FlatButton(
|
||||||
|
onPressed: () {
|
||||||
|
_login(context);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'Login',
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 25),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 130,
|
||||||
|
),
|
||||||
|
Text('New User? Create Account')
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
floatingActionButton: FloatingActionButton(
|
|
||||||
onPressed: _incrementCounter,
|
|
||||||
tooltip: 'Increment',
|
|
||||||
child: const Icon(Icons.add),
|
|
||||||
), // This trailing comma makes auto-formatting nicer for build methods.
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1
covas_mobile/lib/variable/globals.dart
Normal file
1
covas_mobile/lib/variable/globals.dart
Normal file
@@ -0,0 +1 @@
|
|||||||
|
String api = "10.0.2.2:8083/api";
|
@@ -5,6 +5,8 @@
|
|||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
import shared_preferences_macos
|
||||||
|
|
||||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
|
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
||||||
}
|
}
|
||||||
|
@@ -57,6 +57,20 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.0"
|
version: "1.3.0"
|
||||||
|
ffi:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: ffi
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.1"
|
||||||
|
file:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: file
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "6.1.4"
|
||||||
flutter:
|
flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description: flutter
|
description: flutter
|
||||||
@@ -74,6 +88,32 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
flutter_web_plugins:
|
||||||
|
dependency: transitive
|
||||||
|
description: flutter
|
||||||
|
source: sdk
|
||||||
|
version: "0.0.0"
|
||||||
|
http:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: http
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.13.5"
|
||||||
|
http_parser:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: http_parser
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "4.0.1"
|
||||||
|
js:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: js
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.6.4"
|
||||||
lints:
|
lints:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -109,6 +149,104 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.8.1"
|
version: "1.8.1"
|
||||||
|
path_provider_linux:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: path_provider_linux
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.7"
|
||||||
|
path_provider_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: path_provider_platform_interface
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.4"
|
||||||
|
path_provider_windows:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: path_provider_windows
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.3"
|
||||||
|
platform:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: platform
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "3.1.0"
|
||||||
|
plugin_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: plugin_platform_interface
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.3"
|
||||||
|
process:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: process
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "4.2.4"
|
||||||
|
shared_preferences:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: shared_preferences
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.15"
|
||||||
|
shared_preferences_android:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: shared_preferences_android
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.13"
|
||||||
|
shared_preferences_ios:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: shared_preferences_ios
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.1"
|
||||||
|
shared_preferences_linux:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: shared_preferences_linux
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.1"
|
||||||
|
shared_preferences_macos:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: shared_preferences_macos
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.4"
|
||||||
|
shared_preferences_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: shared_preferences_platform_interface
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.0"
|
||||||
|
shared_preferences_web:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: shared_preferences_web
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.4"
|
||||||
|
shared_preferences_windows:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: shared_preferences_windows
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.1"
|
||||||
sky_engine:
|
sky_engine:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
@@ -156,6 +294,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.4.9"
|
version: "0.4.9"
|
||||||
|
typed_data:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: typed_data
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.3.1"
|
||||||
vector_math:
|
vector_math:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -163,5 +308,20 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.2"
|
version: "2.1.2"
|
||||||
|
win32:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: win32
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.0"
|
||||||
|
xdg_directories:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: xdg_directories
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.2.0+2"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.17.6 <3.0.0"
|
dart: ">=2.17.6 <3.0.0"
|
||||||
|
flutter: ">=3.0.0"
|
||||||
|
@@ -34,6 +34,8 @@ dependencies:
|
|||||||
# The following adds the Cupertino Icons font to your application.
|
# The following adds the Cupertino Icons font to your application.
|
||||||
# Use with the CupertinoIcons class for iOS style icons.
|
# Use with the CupertinoIcons class for iOS style icons.
|
||||||
cupertino_icons: ^1.0.2
|
cupertino_icons: ^1.0.2
|
||||||
|
http: ^0.13.5
|
||||||
|
shared_preferences: ^2.0.15
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
Reference in New Issue
Block a user