Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
Flood Prediction
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Intelligent Tank Management System
Flood Prediction
Commits
e15088b4
Commit
e15088b4
authored
Apr 27, 2022
by
Mohamed Naseef
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AjouterVoiture.dart
parent
f4f294c2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
162 additions
and
0 deletions
+162
-0
AjouterVoiture.dart
AjouterVoiture.dart
+162
-0
No files found.
AjouterVoiture.dart
0 → 100644
View file @
e15088b4
import
'dart:convert'
;
import
'dart:async'
;
import
'package:flutter/material.dart'
;
import
'package:location/utils/utils.dart'
;
import
'main.dart'
;
import
'package:http/http.dart'
as
http
;
import
'modifier.dart'
;
import
'TypeVoiture.dart'
;
import
'voiture.dart'
;
class
AllPersonData
extends
StatefulWidget
{
@override
_AllPersonDataState
createState
()
=>
_AllPersonDataState
();
}
class
_AllPersonDataState
extends
State
<
AllPersonData
>
{
Future
allPerson
()
async
{
var
url
=
"http://192.168.43.245/location/viewAll.php"
;
var
response
=
await
http
.
get
(
Uri
.
parse
(
url
));
var
jsonData
=
json
.
decode
(
response
.
body
);
List
<
Voiture
>
voitures
=
[];
for
(
var
v
in
jsonData
)
{
Voiture
voiture
=
Voiture
(
int
.
parse
(
v
[
"id_voiture"
]),
v
[
"Marque"
],
v
[
"image"
],
v
[
"Modele"
],
v
[
"vitesses"
],
v
[
"nbr_places"
],
v
[
"Prix"
],
v
[
"Couleur"
],
v
[
"Disponibilite"
],
v
[
"Code"
]);
voitures
.
add
(
voiture
);
}
print
(
voitures
.
length
);
return
voitures
;
}
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
backgroundColor:
Colors
.
purple
.
shade900
,
title:
Center
(
child:
Text
(
'VOITURES'
)),
),
floatingActionButton:
FloatingActionButton
(
backgroundColor:
Colors
.
purple
.
shade900
,
child:
Icon
(
Icons
.
add
),
onPressed:
()
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
DemoUploadImage
(),
),
);
debugPrint
(
'Clicked FloatingActionButton Button'
);
},
),
body:
RefreshIndicator
(
color:
Colors
.
blue
,
onRefresh:
()
{
return
Navigator
.
pushReplacement
(
context
,
PageRouteBuilder
(
pageBuilder:
(
a
,
b
,
c
)
=>
AllPersonData
()));
},
child:
FutureBuilder
(
future:
allPerson
(),
builder:
(
BuildContext
context
,
AsyncSnapshot
snapshot
)
{
if
(
snapshot
.
hasError
)
print
(
snapshot
.
error
);
return
snapshot
.
hasData
?
ListView
.
builder
(
itemCount:
snapshot
.
data
.
length
,
itemBuilder:
(
BuildContext
context
,
int
id
)
{
return
Card
(
elevation:
20
,
child:
ListTile
(
title:
Stack
(
alignment:
Alignment
.
topLeft
,
children:
[
Container
(
child:
Image
.
network
(
"http://192.168.43.245/location/uploads/
${snapshot.data[id].image}
"
),
),
InkWell
(
child:
Icon
(
Icons
.
delete
),
onTap:
()
{
setState
(()
{
var
url
=
Uri
.
parse
(
'http://192.168.43.245/location/delete.php'
);
http
.
post
(
url
,
body:
{
'id_voiture'
:
snapshot
.
data
[
id
].
id_voiture
.
toString
(),
});
});
},
),
],
),
subtitle:
Center
(
child:
Text
(
snapshot
.
data
[
id
].
Marque
,
style:
MainHeading
,
)),
trailing:
GestureDetector
(
child:
Icon
(
Icons
.
edit
),
onTap:
()
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
AllModifier
(
id_voiture:
snapshot
.
data
[
id
].
id_voiture
,
Marque:
snapshot
.
data
[
id
].
Marque
,
image:
snapshot
.
data
[
id
].
image
,
Modele:
snapshot
.
data
[
id
].
Modele
,
vitesses:
snapshot
.
data
[
id
].
vitesses
,
nbr_places:
snapshot
.
data
[
id
].
nbr_places
,
Prix:
snapshot
.
data
[
id
].
Prix
,
Couleur:
snapshot
.
data
[
id
].
Couleur
,
Disponibilite:
snapshot
.
data
[
id
].
Disponibilite
,
Code:
snapshot
.
data
[
id
].
Code
,
),
),
);
},
),
onTap:
()
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
TypeVoiture
(
id_voiture:
snapshot
.
data
[
id
].
id_voiture
,
Marque:
snapshot
.
data
[
id
].
Marque
,
image:
snapshot
.
data
[
id
].
image
,
Modele:
snapshot
.
data
[
id
].
Modele
,
vitesses:
snapshot
.
data
[
id
].
vitesses
,
nbr_places:
snapshot
.
data
[
id
].
nbr_places
,
Prix:
snapshot
.
data
[
id
].
Prix
,
Couleur:
snapshot
.
data
[
id
].
Couleur
,
Disponibilite:
snapshot
.
data
[
id
].
Disponibilite
,
Code:
snapshot
.
data
[
id
].
Code
,
),
));
},
),
);
})
:
Center
(
child:
CircularProgressIndicator
(),
);
},
),
),
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment