Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
amse
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
Matis SPINELLI
amse
Commits
0fd135d0
Commit
0fd135d0
authored
Feb 12, 2024
by
Timothé KOBAK
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more info on the images
parent
8430accd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
16 deletions
+75
-16
data.json
tp1/assets/data.json
+1
-1
favorite_page.dart
tp1/lib/favorite_page.dart
+66
-7
pubspec.lock
tp1/pubspec.lock
+8
-8
No files found.
tp1/assets/data.json
View file @
0fd135d0
...
...
@@ -110,7 +110,7 @@
"category"
:
"course"
,
"title"
:
"Learn Programming With JavaScript"
,
"author"
:
"Olga Volkova, Will Alexander"
,
"publisher"
:
"OpenClassrooms"
,
"publisher"
:
"OpenCla
t
ssrooms"
,
"completion_time"
:
"15 hours"
,
"description"
:
"This course is designed to teach you the fundamentals of the JavaScript programming language and to give you lots of practice along the way!"
,
"image"
:
"assets/images/LearnProgrammingWithJS.jpg"
,
...
...
tp1/lib/favorite_page.dart
View file @
0fd135d0
...
...
@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import
'package:provider/provider.dart'
;
import
'app_state.dart'
;
class
FavoritePage
extends
StatelessWidget
{
@override
Widget
build
(
BuildContext
context
)
{
...
...
@@ -24,7 +23,7 @@ class FavoritePage extends StatelessWidget {
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
ImageScreen
(
imagePath:
state
.
getFav
(
index
)[
'image'
]
),
builder:
(
context
)
=>
ImageScreen
(
book:
state
.
getFav
(
index
)
),
),
);
},
...
...
@@ -43,16 +42,76 @@ class FavoritePage extends StatelessWidget {
}
class
ImageScreen
extends
StatelessWidget
{
final
String
imagePath
;
final
Map
<
String
,
dynamic
>
book
;
const
ImageScreen
({
Key
?
key
,
required
this
.
book
})
:
super
(
key:
key
);
const
ImageScreen
({
Key
?
key
,
required
this
.
imagePath
})
:
super
(
key:
key
);
String
checkNull
(
dynamic
value
)
{
return
value
!=
null
?
value
.
toString
()
:
''
;
}
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(),
body:
Center
(
child:
Image
.
asset
(
imagePath
),
appBar:
AppBar
(
title:
Text
(
book
[
'title'
]),
),
body:
SingleChildScrollView
(
padding:
EdgeInsets
.
all
(
16.0
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Image
.
asset
(
book
[
'image'
]),
SizedBox
(
height:
16.0
),
if
(
book
[
'title'
]
!=
null
)
Text
(
'Title:
${checkNull(book['title'])}
'
,
style:
TextStyle
(
fontSize:
20
,
fontWeight:
FontWeight
.
bold
,
color:
Colors
.
black87
),
),
if
(
book
[
'subtitle'
]
!=
null
)
Text
(
'Subtitle:
${checkNull(book['subtitle'])}
'
,
style:
TextStyle
(
fontSize:
18
,
color:
Colors
.
black54
),
),
SizedBox
(
height:
8.0
),
if
(
book
[
'author'
]
!=
null
)
Text
(
'Author:
${checkNull(book['author'])}
'
,
style:
TextStyle
(
fontSize:
16
,
color:
Colors
.
black54
),
),
SizedBox
(
height:
8.0
),
if
(
book
[
'published'
]
!=
null
)
Text
(
'Published:
${checkNull(book['published'])}
'
,
style:
TextStyle
(
fontSize:
16
,
color:
Colors
.
black54
),
),
SizedBox
(
height:
8.0
),
if
(
book
[
'publisher'
]
!=
null
)
Text
(
'Publisher:
${checkNull(book['publisher'])}
'
,
style:
TextStyle
(
fontSize:
16
,
color:
Colors
.
black54
),
),
SizedBox
(
height:
8.0
),
if
(
book
[
'pages'
]
!=
null
)
Text
(
'Pages:
${checkNull(book['pages'])}
'
,
style:
TextStyle
(
fontSize:
16
,
color:
Colors
.
black54
),
),
SizedBox
(
height:
8.0
),
if
(
book
[
'description'
]
!=
null
)
Text
(
'Description:
${checkNull(book['description'])}
'
,
style:
TextStyle
(
fontSize:
16
,
color:
Colors
.
black54
),
),
SizedBox
(
height:
16.0
),
ElevatedButton
(
onPressed:
()
{
//TODO: LOGIC HERE
},
child:
Text
(
'Remove from favorites'
,
style:
TextStyle
(
fontSize:
16
)),
),
],
),
),
);
}
...
...
tp1/pubspec.lock
View file @
0fd135d0
...
...
@@ -79,26 +79,26 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256:
"7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
sha256:
cdd14e3836065a1f6302a236ec8b5f700695c803c57ae11a1c84df31e6bcf831
url: "https://pub.dev"
source: hosted
version: "10.0.
4
"
version: "10.0.
3
"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "
06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8
"
sha256: "
9b2ef90589911d665277464e0482b209d39882dffaaf4ef69a3561a3354b2ebc
"
url: "https://pub.dev"
source: hosted
version: "3.0.
3
"
version: "3.0.
2
"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256:
"6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
sha256:
fd3cd66cb2bcd7b50dcd3b413af49d78051f809c8b3f6e047962765c15a0d23d
url: "https://pub.dev"
source: hosted
version: "3.0.
1
"
version: "3.0.
0
"
lints:
dependency: transitive
description:
...
...
@@ -127,10 +127,10 @@ packages:
dependency: transitive
description:
name: meta
sha256:
"7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
sha256:
d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
url: "https://pub.dev"
source: hosted
version: "1.1
2
.0"
version: "1.1
1
.0"
nested:
dependency: transitive
description:
...
...
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