Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
Movie-app
Project
Project
Details
Activity
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
Dio Maulana
Movie-app
Commits
0b4af86c
Commit
0b4af86c
authored
Feb 16, 2022
by
Dio Maulana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
detail done
parent
bc917573
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
256 additions
and
73 deletions
+256
-73
main.dart
lib/main.dart
+17
-1
movie_detail_api.dart
lib/models/movie_detail_api.dart
+30
-0
movie_detail_arg.dart
lib/models/movie_detail_arg.dart
+6
-0
terserah.dart
lib/models/terserah.dart
+57
-0
main_page.dart
lib/pages/main_page.dart
+5
-0
movie_detail.dart
lib/pages/movie_detail.dart
+132
-66
pubspec.lock
pubspec.lock
+8
-0
pubspec.yaml
pubspec.yaml
+1
-6
No files found.
lib/main.dart
View file @
0b4af86c
...
@@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
...
@@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import
'package:movie_app/pages/main_page.dart'
;
import
'package:movie_app/pages/main_page.dart'
;
import
'package:movie_app/pages/movie_detail.dart'
;
import
'package:movie_app/pages/movie_detail.dart'
;
import
'models/movie_detail_arg.dart'
;
void
main
(
)
{
void
main
(
)
{
runApp
(
MyApp
());
runApp
(
MyApp
());
}
}
...
@@ -15,10 +17,24 @@ class _MyAppState extends State<MyApp> {
...
@@ -15,10 +17,24 @@ class _MyAppState extends State<MyApp> {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
return
MaterialApp
(
// onGenerateRoute: (settings) {
// if (settings.name == '/detail') {
// final args = settings.arguments.toString();
// return PageRouteBuilder(
// settings: settings,
// pageBuilder: (_, __, ___) => detailMovie(args),
// transitionsBuilder: (_, a, __, c) => FadeTransition(
// opacity: a,
// child: c,
// ));
// }
// },
initialRoute:
'/'
,
initialRoute:
'/'
,
routes:
{
routes:
{
'/'
:
(
context
)
=>
MainPages
(),
'/'
:
(
context
)
=>
MainPages
(),
'/detail'
:
(
context
)
=>
detailMovie
(),
'/detail'
:
(
context
)
=>
detailMovie
(
// ModalRoute.of(context)!.settings.arguments as ScreenArguments),
ModalRoute
.
of
(
context
)!.
settings
.
arguments
as
String
),
},
},
);
);
}
}
...
...
lib/models/movie_detail_api.dart
0 → 100644
View file @
0b4af86c
class
movieDetail
{
final
String
title
;
final
String
poster_path
;
final
String
overview
;
final
double
vote_average
;
List
<
dynamic
>
genre
=
[];
movieDetail
(
this
.
title
,
this
.
poster_path
,
this
.
overview
,
this
.
vote_average
,
this
.
genre
);
factory
movieDetail
.
fromJson
(
dynamic
json
)
{
var
nameGenre
=
[];
for
(
int
i
=
0
;
i
<
json
[
'genres'
].
length
;
i
++)
{
print
(
json
[
'genres'
][
i
][
'name'
]);
var
genreName
=
''
;
if
(
json
[
'genres'
][
i
][
'name'
]
==
null
)
{
genreName
=
'Thriller'
;
}
else
{
genreName
=
json
[
'genres'
][
i
][
'name'
];
}
nameGenre
.
add
(
genreName
);
}
return
movieDetail
(
json
[
'title'
]
as
String
,
json
[
'poster_path'
]
as
String
,
json
[
'overview'
]
as
String
,
json
[
'vote_average'
]
as
double
,
nameGenre
as
List
<
dynamic
>);
}
}
lib/models/movie_detail_arg.dart
0 → 100644
View file @
0b4af86c
class
ScreenArguments
{
final
String
id
;
final
String
image
;
ScreenArguments
(
this
.
id
,
this
.
image
);
}
lib/models/terserah.dart
0 → 100644
View file @
0b4af86c
import
'package:flutter/material.dart'
;
void
main
(
)
=>
runApp
(
const
MyApp
());
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
static
const
String
_title
=
'Flutter Code Sample'
;
@override
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
title:
_title
,
home:
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
_title
)),
body:
const
MyStatelessWidget
(),
),
);
}
}
class
MyStatelessWidget
extends
StatelessWidget
{
const
MyStatelessWidget
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
Center
(
child:
ElevatedButton
(
child:
const
Text
(
'showModalBottomSheet'
),
onPressed:
()
{
showModalBottomSheet
<
void
>(
context:
context
,
builder:
(
BuildContext
context
)
{
return
Container
(
height:
200
,
color:
Colors
.
amber
,
child:
Center
(
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
const
Text
(
'Modal BottomSheet'
),
ElevatedButton
(
child:
const
Text
(
'Close BottomSheet'
),
onPressed:
()
=>
Navigator
.
pop
(
context
),
)
],
),
),
);
},
);
},
),
);
}
}
lib/pages/main_page.dart
View file @
0b4af86c
...
@@ -6,6 +6,7 @@ import 'package:http/http.dart' as http;
...
@@ -6,6 +6,7 @@ import 'package:http/http.dart' as http;
import
'package:movie_app/pages/movie_detail.dart'
;
import
'package:movie_app/pages/movie_detail.dart'
;
import
'../config.dart'
;
import
'../config.dart'
;
// import '../models/movie_detail_arg.dart';
class
MainPages
extends
StatefulWidget
{
class
MainPages
extends
StatefulWidget
{
@override
@override
...
@@ -219,6 +220,10 @@ class _MainPagesState extends State<MainPages> {
...
@@ -219,6 +220,10 @@ class _MainPagesState extends State<MainPages> {
Navigator
.
pushNamed
(
Navigator
.
pushNamed
(
context
,
context
,
'/detail'
,
'/detail'
,
// arguments: ScreenArguments(
// id,
// image,
// ),
arguments:
id
,
arguments:
id
,
);
);
},
},
...
...
lib/pages/movie_detail.dart
View file @
0b4af86c
This diff is collapsed.
Click to expand it.
pubspec.lock
View file @
0b4af86c
...
@@ -69,6 +69,13 @@ packages:
...
@@ -69,6 +69,13 @@ packages:
url: "https://pub.dartlang.org"
url: "https://pub.dartlang.org"
source: hosted
source: hosted
version: "1.0.4"
version: "1.0.4"
flutter_rating_bar:
dependency: "direct main"
description:
name: flutter_rating_bar
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
flutter_test:
flutter_test:
dependency: "direct dev"
dependency: "direct dev"
description: flutter
description: flutter
...
@@ -186,3 +193,4 @@ packages:
...
@@ -186,3 +193,4 @@ packages:
version: "2.1.1"
version: "2.1.1"
sdks:
sdks:
dart: ">=2.16.0 <3.0.0"
dart: ">=2.16.0 <3.0.0"
flutter: ">=1.12.13+hotfix.5"
pubspec.yaml
View file @
0b4af86c
...
@@ -30,15 +30,10 @@ dependencies:
...
@@ -30,15 +30,10 @@ dependencies:
cupertino_icons
:
^1.0.2
cupertino_icons
:
^1.0.2
flutter
:
flutter
:
sdk
:
flutter
sdk
:
flutter
flutter_rating_bar
:
^4.0.0
http
:
^0.13.4
http
:
^0.13.4
dev_dependencies
:
dev_dependencies
:
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints
:
^1.0.0
flutter_lints
:
^1.0.0
flutter_test
:
flutter_test
:
sdk
:
flutter
sdk
:
flutter
...
...
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