Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Amse_Tp2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lila NICKLER
Amse_Tp2
Commits
3b2c642c
Commit
3b2c642c
authored
Feb 15, 2021
by
Lila NICKLER
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exercice 3
parent
92e27496
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
178 additions
and
115 deletions
+178
-115
Exo.dart
lib/Exo.dart
+176
-113
main.dart
lib/main.dart
+2
-2
No files found.
lib/Exo.dart
View file @
3b2c642c
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'dart:math'
as
math
;
import
'dart:math'
as
math
;
class
Exercice1
extends
StatelessWidget
{
class
Exercice1
extends
StatelessWidget
{
Widget
build
(
BuildContext
context
)
Widget
build
(
BuildContext
context
)
{
{
var
mediaQueryData
=
MediaQuery
.
of
(
context
);
var
mediaQueryData
=
MediaQuery
.
of
(
context
);
return
Scaffold
(
appBar:
AppBar
(
return
Container
(
title:
Text
(
"Exercice 1"
),
height:
mediaQueryData
.
size
.
height
-
200
,
),
child:
Image
.
network
(
"https://picsum.photos/512/1024"
),
body:
Center
(
child:
Container
(
height:
mediaQueryData
.
size
.
height
-
200
,
child:
Image
.
network
(
"https://picsum.photos/512/1024"
)),
)
);
);
}
}
}
}
...
@@ -28,26 +32,32 @@ class _Exercice2State extends State<Exercice2> {
...
@@ -28,26 +32,32 @@ class _Exercice2State extends State<Exercice2> {
double
_currentSlider3Value
=
100.0
;
double
_currentSlider3Value
=
100.0
;
bool
_mirror
=
false
;
bool
_mirror
=
false
;
Image
image
=
Image
.
network
(
"https://picsum.photos/512/1024"
);
Image
image
=
Image
.
network
(
"https://picsum.photos/512/1024"
);
double
_size
;
double
_size
;
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
var
mediaQueryData
=
MediaQuery
.
of
(
context
);
var
mediaQueryData
=
MediaQuery
.
of
(
context
);
//_size = 1/(_currentSlider3Value/100);
return
Scaffold
(
appBar:
AppBar
(
return
ListView
(
title:
Text
(
"Exercice 1"
),
),
body:
Center
(
child:
ListView
(
children:
[
children:
[
Container
(
Container
(
height:
mediaQueryData
.
size
.
height
*(
2
/
3
),
height:
mediaQueryData
.
size
.
height
*
(
2
/
3
),
width:
mediaQueryData
.
size
.
width
,
width:
mediaQueryData
.
size
.
width
,
child:
Transform
(
child:
Transform
(
origin:
Offset
(
mediaQueryData
.
size
.
width
/
2
,
mediaQueryData
.
size
.
height
*(
2
/
3
)/
2
),
origin:
Offset
(
mediaQueryData
.
size
.
width
/
2
,
mediaQueryData
.
size
.
height
*
(
2
/
3
)
/
2
),
transform:
Matrix4
(
transform:
Matrix4
(
1
,
0
,
0
,
0
,
// scale X
1
,
0
,
0
,
0
,
// scale X
0
,
1
,
0
,
0
,
// scale Y
0
,
1
,
0
,
0
,
// scale Y
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
(
1
/(
_currentSlider3Value
/
100
)),
// scale X&Y
0
,
0
,
0
,
(
1
/
(
_currentSlider3Value
/
100
)),
// scale X&Y
)
)
..
rotateX
(
math
.
pi
/
180
*
_currentSlider1Value
)
..
rotateX
(
math
.
pi
/
180
*
_currentSlider1Value
)
..
rotateY
(
_mirror
?
math
.
pi
:
0
)
..
rotateY
(
_mirror
?
math
.
pi
:
0
)
...
@@ -57,19 +67,19 @@ class _Exercice2State extends State<Exercice2> {
...
@@ -57,19 +67,19 @@ class _Exercice2State extends State<Exercice2> {
),
),
Row
(
Row
(
children:
[
children:
[
Container
(
Container
(
width:
mediaQueryData
.
size
.
width
/
8
,
width:
mediaQueryData
.
size
.
width
/
8
,
child:
child:
Text
(
"Rotation X"
)
),
Text
(
"Rotation X"
)
),
Container
(
Container
(
width:
mediaQueryData
.
size
.
width
*(
7
/
8
),
width:
mediaQueryData
.
size
.
width
*
(
7
/
8
),
child:
Slider
(
child:
Slider
(
value:
_currentSlider1Value
,
value:
_currentSlider1Value
,
min:
0
,
min:
0
,
max:
360
,
max:
360
,
divisions:
360
,
divisions:
360
,
label:
_currentSlider1Value
.
round
().
toString
(),
label:
_currentSlider1Value
.
round
().
toString
(),
onChanged:
(
double
value
)
{
onChanged:
(
double
value
)
{
setState
(()
{
setState
(()
{
_currentSlider1Value
=
value
;
_currentSlider1Value
=
value
;
});
});
...
@@ -79,11 +89,11 @@ class _Exercice2State extends State<Exercice2> {
...
@@ -79,11 +89,11 @@ class _Exercice2State extends State<Exercice2> {
Row
(
Row
(
children:
[
children:
[
Container
(
Container
(
width:
mediaQueryData
.
size
.
width
/
8
,
width:
mediaQueryData
.
size
.
width
/
8
,
child:
Text
(
"Rotation Y"
),
child:
Text
(
"Rotation Y"
),
),
),
Container
(
Container
(
width:
mediaQueryData
.
size
.
width
*(
7
/
8
),
width:
mediaQueryData
.
size
.
width
*
(
7
/
8
),
child:
child:
Slider
(
Slider
(
value:
_currentSlider2Value
,
value:
_currentSlider2Value
,
...
@@ -91,53 +101,106 @@ class _Exercice2State extends State<Exercice2> {
...
@@ -91,53 +101,106 @@ class _Exercice2State extends State<Exercice2> {
max:
360
,
max:
360
,
divisions:
360
,
divisions:
360
,
label:
_currentSlider2Value
.
round
().
toString
(),
label:
_currentSlider2Value
.
round
().
toString
(),
onChanged:
(
double
value
)
{
onChanged:
(
double
value
)
{
setState
(()
{
setState
(()
{
_currentSlider2Value
=
value
;
_currentSlider2Value
=
value
;
});
});
},
},
)),
)
),
]
]
),
),
Row
(
Row
(
children:
[
children:
[
Container
(
Container
(
width:
mediaQueryData
.
size
.
width
/
8
,
width:
mediaQueryData
.
size
.
width
/
8
,
child:
Text
(
"Taille"
),
child:
Text
(
"Taille"
),
),
),
Container
(
Container
(
width:
mediaQueryData
.
size
.
width
*(
7
/
8
),
width:
mediaQueryData
.
size
.
width
*
(
7
/
8
),
child:
Slider
(
child:
Slider
(
value:
_currentSlider3Value
,
value:
_currentSlider3Value
,
min:
0
,
min:
0
,
max:
100
,
max:
100
,
divisions:
100
,
divisions:
100
,
label:
_currentSlider3Value
.
round
().
toString
(),
label:
_currentSlider3Value
.
round
().
toString
(),
onChanged:
(
double
value
)
{
onChanged:
(
double
value
)
{
setState
(()
{
setState
(()
{
_currentSlider3Value
=
value
;
_currentSlider3Value
=
value
;
});
});
},
},
))
)
)
]
]
),
),
Row
(
children:
[
Row
(
children:
[
Container
(
Container
(
width:
mediaQueryData
.
size
.
width
/
7
,
width:
mediaQueryData
.
size
.
width
/
7
,
child:
Text
(
"Miroir"
),
),
child:
Text
(
"Miroir"
),
),
Container
(
Container
(
child:
Checkbox
(
child:
Checkbox
(
value:
_mirror
,
value:
_mirror
,
onChanged:
(
value
)
{
onChanged:
(
value
)
{
setState
(()
{
setState
(()
{
_mirror
=
!
_mirror
;
_mirror
=
!
_mirror
;
});
}
);
},
},
))
)
)
]
]
),
),
]
]
);
)
));
}
}
}
}
class
Exercice3
extends
StatelessWidget
{
@override
Widget
build
(
BuildContext
context
)
{
return
ListView
(
children:
[
Card
(
child:
ListTile
(
title:
Text
(
"Exercice 1"
),
subtitle:
Text
(
"Affichage d'une image"
),
leading:
Icon
(
Icons
.
play_arrow_rounded
),
onTap:
(){
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)=>
Exercice1
()));
},)),
Card
(
child:
ListTile
(
leading:
Icon
(
Icons
.
play_arrow_rounded
),
title:
Text
(
"Exercice 2"
),
subtitle:
Text
(
"Rotation, taille et mode miroir"
),
onTap:
(){
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)=>
Exercice2
()));
},))
],
);
}
}
class
Exercice4
extends
StatelessWidget
{
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
title:
Text
(
"Exercice 1"
),
),
body:
Center
(
child:
Container
(
child:
Image
.
network
(
"https://picsum.photos/512/1024"
)),
)
);
}
}
lib/main.dart
View file @
3b2c642c
...
@@ -34,7 +34,7 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -34,7 +34,7 @@ class _MyHomePageState extends State<MyHomePage> {
@override
@override
//static Exercice1 exo1 = new Exercice1();
//static Exercice1 exo1 = new Exercice1();
static
Exercice
2
exo2
=
new
Exercice2
();
static
Exercice
3
exo3
=
new
Exercice3
();
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
return
Scaffold
(
...
@@ -46,7 +46,7 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -46,7 +46,7 @@ class _MyHomePageState extends State<MyHomePage> {
child:
Column
(
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>[
children:
<
Widget
>[
Expanded
(
child:
exo
2
)
Expanded
(
child:
exo
3
)
],
],
),
),
),
),
...
...
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